Search code examples
phpsymfonydoctrine-ormdoctrinesoft-delete

Symfony ORM PostRemove with soft deletable


I have an entity category and another entity article joined with cat_id and cascaded remove.

The category entity is softDeleteable

When i try to delete a category, the default behaviour is to delete related articles because they are cascaded onDelete.

I want to detect the doctrine orm event PostRemove in the entity article if i soft deleted the parent category of the article.

The doctrine can't detect PostRemove ORM event in the article entity and only detect PreRemove event.

When i disable softDeleteable extension it works fine, but i want to use it.


Solution

  • You can listen to the following events:

    on the Category entity.

    Hope this help