Deleting entities non-destructively in Symfony2

2019-03-18 19:51发布

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?

1条回答
The star\"
2楼-- · 2019-03-18 20:55

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

查看更多
登录 后发表回答