SOLVED!

Doctrine is very clever, it does NOT load data sequentially from a yml
file.
The order of the data in a yml file IS NOT the order of the data in
the database.
I think doctrine loads all the yml files from the fixtures folder and
put them to the database one by one.
If a data has a relation to another model, doctrine catch it and put
it to the database.
Most likely my users.yml file was not the first yml in the folder, but
all the users were put to the
database sooner because of the relations in other ymls - except the
superadmin user, who
has no relation at all.

The solution (for me) was to put the content of the ymls to one file
which starts with the User declarations.
I'm happy! Thank you for your help!


On ápr. 27, 16:10, Tom Ptacnik <to...@tomor.cz> wrote:
> By which command are you trying to load fixtures?
>
> ... if by "symfony doctrine:data-load", the old data stay in the db
> and therefore you can't insert another record with id 1
> ....if you try symfony doctrine:build --all --and-load --no-
> confirmation then it should be ok, because the db will be erased with
> all records
>
> On 27 dub, 13:35, saki <sakrame...@gmail.com> wrote:
>
>
>
> > Hi!
>
> > I have a problem with data fixtures, please help me! I have some data
> > fixture files with relations and some users in the users.yml. I would
> > like to set a fix ID for the superadministrator user. The superadmin
> > definition is the first in the users.yml, however it gets the #3, I
> > don't know why...
>
> > User:
> >   superadmin:
> >     id: "1"
> >     name: Superadmin
> >     email: r...@root.hu
> >     login: "1"
> >     deleted: "1"
>
> >   other users...
>
> > I got SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate
> > entry '1' for key 'PRIMARY' error, when i add the "id: 1" row to the
> > definition. How can I solve this? How can I set a fix id for the
> > superadministrator?
>
> > --
> > 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 symfony-users@googlegroups.com
> > To unsubscribe from this group, send email to
> > symfony-users+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/symfony-users?hl=en
>
> --
> 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 symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
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 symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to