Hi,

that makes sense, but no I get this error:

Invalid row key specified: (robeet_section) , referred to in
(robeet_section) sec2

I dont understand what's invalid?!

On 2 Apr., 11:10, "mikael.randy" <[email protected]> wrote:
> To use reference in fixture, dont use the field name, but the relation
> name
>
> RobeetSection:
>   sec1:
>     name:      Section1
>   sec2:
>     name:      Section2
>     RobeetSection: sec1
>
> On 26 mar, 14:54, comb <[email protected]> wrote:
>
> > Hi, I was recommended from the forum.symfony-project.org to ask my
> > question here.
>
> > If I make a schema.yml that needs references to own objects and than
> > load a fixture-file, where the first object should be referenced in
> > the second, the data-load of the fixture fails.
>
> > Example:
>
> > #config/doctrine/schema.yml
> > RobeetSection:
> >   actAs: { Timestampable: ~ }
> >   columns:
> >     name: { type: string(255), notnull: true, unique: true }
> >     parent_id: { type: integer }
> >   relations:
> >     RobeetSection: { onDelete: CASCADE, local: parent_id, foreign:
> > id }
>
> > #data/fixtures/sections.yml
> > RobeetSection:
> >   sec1:
> >     name:      Section1
> >     parent_id: null
> >   sec2:
> >     name:      Section2
> >     parent_id: sec1
>
> > $ php symfony doctrine:data-load
>
> > fails with:
>
> > SQLSTATE[HY000]: General error: 1452 Cannot add or update a child row:
> > a foreign key constraint fails (`robeet`.`robeet_section`, CONSTRAINT
> > `robeet_section_parent_id_robeet_section_id` FOREIGN KEY (`parent_id`)
> > REFERENCES `robeet_section` (`id`) ON DELETE CASCADE)
>
> > what can I do?
>
> > (topic in 
> > symfony-forum:http://forum.symfony-project.org/index.php?t=rview&goto=96255#msg_96255
> > )

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to