Tag Archives: guard

sfDoctrineGuardPlugin is evil (on delete cascade)

It happened once, a while ago and it happened again… We’ve deleted a user on the sf_guard_user table and ALL records from ALL tables with that user’s ID (on created_by / updated_by field), got dropped!

Some wise guy thought it made sense to delete all user’s related entries when you delete the user :S

Heres how to change that weird behaviour. On all your schema models, change the old “Signable: ~”, to:

1
2
3
4
5
6
ActAs:
  Signable:
    created:
      onDelete: set null
    updated:
      onDelete: set null