Symfony 1.4: Deleting a sfGuardUser

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-04-26T14:21:50Z Indexed on 2010/04/26 14:23 UTC
Read the original article Hit count: 211

Hi,

I'm having some trouble with the following...

I have a sfGuardUser table set up normally, and it has a one-to-one relationship with a Profile table, which contains some additional user info.

When a user wants to delete themselves from the site, I'd like to retain their info in the Profile table for various purposes BUT delete the sfGuardUser in order to keep that table cleaner/shorter (not just set it to inactive).

I was under the impression that I could set the FK in the Profile table to NULL and then delete the sfGuardUser, but it seems the FK-constraint fails. Indeed, it seems I can't delete either and the queries fail:

  • If I try to delete the sfGuardUser, the Profile table will have an invalid FK
  • If I try to delete a Profile, the sfGuardUser will have an invalid FK

Other than leaving outdated sfGuardUsers and Profiles in these tables, or having to use a cascaded delete to get rid of both, can anyone tell me if there's any other way around this?

Thank you.

© Stack Overflow or respective owner

Related posts about symfony

Related posts about symfony-1.4