Is there a good, clean and simple way to delete entities non-destructively in Symfony 2? I'd like to give my administrators a chance to undelete items, while sacrificing as little of the automation provided by the framework as possible.
If there is no built-in solution or third party bundle to help me, what would be the best way to do this? Adding a deleted
property to entities would require lots of added logic to keep them from cluttering the controllers created by doctrine:generate:crud
, so maybe they should be stored in a separate table in serialized form?
What you want is Soft Delete. There is a Doctrine extension for that and a bundle to integrate it with Symfony.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With