Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 317
semsem Avatar asked Aug 02 '26 02:08

semsem


1 Answers

You can listen to the following events:

  • preSoftDelete
  • postSoftDelete

on the Category entity.

Hope this help

like image 122
Matteo Avatar answered Aug 03 '26 19:08

Matteo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!