I've found another solution:
1. schema.yml -> onDelete: CASCADE -> SET NULL
2.1. check if the foreign key fields have NULL(=FALSE) attribute, now
you have to change it to TRUE...
2. symfony doctrine:build --all
3. works fine :)

thank you for your help!

On Mar 19, 10:45 am, Lea Hänsenberger <baerne...@gmail.com> wrote:
> before the line where you delete the user. Probably you have to save the 
> partner after unlinking and before deleting the user.
>
> On Mar 19, 2010, at 10:12 , saki wrote:
>
> > thank you! where can I put the unlink row?
>
> > On Mar 18, 7:35 pm, Lea Hänsenberger <baerne...@gmail.com> wrote:
> >> hi,
> >> there's still a partner with a foreign key pointing to the user you want 
> >> to delete. you should first unlink the user from the partner:
> >> $partner->unlink('rmUser',$user_id);
>
> >> Then you should be able to delete the user object.
>
> >> cheers,
> >> Lea
>
> >> On Mar 18, 2010, at 13:19 , saki wrote:
>
> >>> hi guys!
>
> >>> Please help me to solve my little problem. I have two tables. Users
> >>> and Partners... in the schema.yml file you can see the relation..
>
> >>> rmPartner:
> >>>  ...
> >>>  relations:
> >>>    rmUser: { onDelete: CASCADE, local: contact, foreign: id }
>
> >>> Unfortunately, when I delete a User, symfony deletes his Partner(s),
> >>> too. I think onDelete: CASCADE cause this. A removed and run: symfony
> >>> doctrine:build --all ... now, when i want to delete a user, a get:
>
> >>> 500 | Internal Server Error | Doctrine_Connection_Mysql_Exception
> >>> SQLSTATE[HY000]: General error: 1451 Cannot delete or update a parent
> >>> row: a foreign key constraint fails (`rm`.`rm_partner`, CONSTRAINT
> >>> `rm_partner_contact_rm_user_id` FOREIGN KEY (`contact`) REFERENCES
> >>> `rm_user` (`id`))
>
> >>> How can I solve this? What should I do, when i dont want to delete the
> >>> related rows?
>
> >>> Thank you in advance!
>
> >>> --
> >>> 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
>
> > --
> > 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
>
> > To unsubscribe from this group, send email to 
> > symfony-users+unsubscribegooglegroups.com or reply to this email with the 
> > words "REMOVE ME" as the subject.

-- 
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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to