Ask your Symfony questions! Pay money and get answers fast! (more info)

Help. Couldn't call Doctrine_Core::set()... when loading fixture Symfony

  • SOLVED

Symfony 1.4.
Who can explain why loading the fixture generates: Couldn't call Doctrine_Core::set(), second argument should be an instance of Doctrine_Record or Doctrine_Null when setting one-to-one references (or one-to-many).

I was using my own schema and decided to simplify things by using a simple schema from the doctrine documentation. But the error is still occurring. It occurs when the data for phonenumbers tries to load from the fixture. See below:


Schema:

detect_relations: true
options:
collate: utf8_general_ci
charset: utf8
type: InnoDB


User:
columns:
name: string(20)
relations:
Phonenumbers:
type: many
class: Phonenumber
local: id
foreign: user_id

Phonenumber:
columns:
user_id: integer
phonenumber: string(50)
relations:
User:
local: user_id
foreign: id



Fixture:

User:
User1:
name: John

PhoneNumber:
phone1:
user: User11
phonenumber: 3332

Answers (2)

2010-07-22

Damon Jones answers:

You have "user: User11" in your fixtures, but you have no User11 declared. Also, I think the case for the relation name should match (User: instead of user:), see below:


PhoneNumber:
phone1:
User: User1
phonenumber: 3332

2010-07-22

GlobalOrangeLab answers:

Hi there,

It should be like as:


User:
User1:
name: John

PhoneNumber:
phone1:
User: User11
phonenumber: 3332


Hope this helps!