PGBI/cakephp3-soft-delete

deleteAll doesn't delete associations

el-lsan opened this issue · 2 comments

The deleteAll() does not delete the associations however it is all fine with a single row deleting as we have cascadeDelete() in _processDelete(), but not in deleteAll().

+1

PGBI commented

This is the normal cakephp behavior, it is not linked with the soft delete plugin. deleteAll (whether it is soft or hard deletion) does not cascade to associations:

See http://api.cakephp.org/3.0/class-Cake.Datasource.RepositoryInterface.html#_deleteAll

This method will not execute on associations' cascade attribute. You should use database foreign keys + ON CASCADE rules if you need cascading deletes combined with this method.