Delete System
https://symfony.com/bundles/StofDoctrineExtensionsBundle/current/softdeleteable-filter.htmlGoal
The Delete System of PHPReaction is really flexible. You can remove an Entity and their relations. You can transfer some and if nullable, you can unset the relation too. All of this is "per Entity", meaning you can handle, for example, Invoices and Bills on a coordinate a different way.
This allows to be very productive on your management since you can keep information and still be able to drop an element.
Delete System
Delete-Delete
We can Delete an Element and Delete their Relations.
To do so, you click on the delete button. A form opens. You toggle the options DELETE on the switch button and submit. The Element AND the Relations will be deleted
Delete-Transfer
We can Delete an Element and Transfer their Relations.
To do so, you click on the delete button. A form opens. You toggle the options MOVE on the switch button, choose the new owner of these relations and submit. The Element will be deleted and the Relations will be transferred to new owner.
Delete-Unset
If nullable, we can Delete an Element and Unset their Relations.
To do so, you click on the delete button. A form opens. You toggle the options MOVE on the switch button and submit. The Element will be deleted and Relations will be unset, and no other relations will substitute.
NoDelete-Transfer
@todo transfer relations without delete element
NoDelete-Delete
@todo delete relations without delete element
DeleteHandler
Namespace: PHPReaction\CommonBundle\Manager\CascadeDelete
The DeleteHandler is the helper that is used to handle all of the delete process after form submission. It is really dependent on entity's relation setter. If the setter is done wrong, there are potential Data Corruption problems created by this handler since he is forging the call to a potential setter. This class have no knowledge of the setter's content. We may add some testing on it but it is hard since it covers a lot of cases.
Handle unique properties values on deletion
To avoid unique constraints conflicts with deleted rows, when entities are deleted, unique columns values have a suffix added to them (ex: DELETEDAT2004-02-12T15:19:21+00:00).
This is handled by the SoftDeleteUniqueSuffixListener listener, which listens to postSoftDelete events.
It finds the properties from the UniqueEntity constraint attribute.