[symfony-users] Re: Fix ID in data fixture yml
Does this mean it orders all fixtures files across all the fixtures folders according to filename only not source folder. - meanign if you use numbers you have complete control over this? That would be very handy. On Apr 27, 8:35 pm, Eno wrote: > On Tue, 27 Apr 2010, saki wrote: > > 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 you have several fixtures files, I think it loads them alphabetically > so I usually name the files 001_blahblah, 002_blahblah so they're examined > in a specific order. > > -- > > -- > 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
Re: [symfony-users] Re: Fix ID in data fixture yml
On Tue, 27 Apr 2010, saki wrote: > 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 you have several fixtures files, I think it loads them alphabetically so I usually name the files 001_blahblah, 002_blahblah so they're examined in a specific order. -- -- 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
[symfony-users] Re: Fix ID in data fixture yml
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 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 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
[symfony-users] Re: Fix ID in data fixture yml
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 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 at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: Fix ID in data fixture yml
Hi, If you can reset the auto increment id then you can do what i do which is a bit of a hack but works. Follow the instructions here: http://osterman.com/wordpress/2007/09/28/symfony-propel-auto_increment-offset and set the autoincrement to be 1. (This only works when you do build-all-load. Not just data-load) You can then make sure the fixture you put in first is the one you want to have an id of 1 thus. User: superadmin: name: Superadmin email: r...@root.hu login: "1" deleted: "1" Cheers, Paul I add this : On Apr 27, 12:35 pm, saki 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 at http://groups.google.com/group/symfony-users?hl=en