logo

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

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

atentaten | 07/22/10 at 12:18pm | Edit


(2) Possible Answers Submitted...

  • avatar
    Last edited:
    07/22/10
    12:59pm
    Damon Jones says:

    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

  • avatar
    Last edited:
    07/22/10
    12:54pm
    GlobalOrangeLab says:

    Hi there,

    It should be like as:


    User:
    User1:
    name: John

    PhoneNumber:
    phone1:
    User: User11
    phonenumber: 3332


    Hope this helps!

    Previous versions of this answer: 07/22/10 at 12:53pm | 07/22/10 at 12:54pm

This question has expired.





Current status of this question: Completed