PGBI/cakephp3-soft-delete

Soft deleting not propagating to associations

pgmassari opened this issue · 1 comments

I have a simple setup in Cake 3.2.5 (also tried with 3.3.1)

Clients hasMany Addresses
Clients hasMany Contacts

Both associations with:

'cascadeCallbacks' => true
'dependent' => true

All the three models have the SoftDelete behavior loaded. No others behaviors loaded in this example.

Whenever I delete() a client, I expect all related addresses and contacts to be soft deleted, as stated in the documentation. https://github.com/PGBI/cakephp3-soft-delete#soft-deleting--associations

Still, only the client gets soft deleted, while addresses and contacts are left dangling in the database.

I tried the same setup with just commenting out the $this->addBehavior('SoftDelete'); in the three models. The cascading works as expected: main row and associated rows get deleted.

Also, I tried to comment out the $this->addBehavior('SoftDelete'); only in the Client model. This time, the client row gets deleted, while the related rows do get soft deleted.

You resolved?