Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting entities non-destructively in Symfony2

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?

like image 735
Kaivosukeltaja Avatar asked Apr 29 '12 13:04

Kaivosukeltaja


1 Answers

What you want is Soft Delete. There is a Doctrine extension for that and a bundle to integrate it with Symfony.

like image 77
Elnur Abdurrakhimov Avatar answered Nov 05 '22 08:11

Elnur Abdurrakhimov