Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soft deleting not propagating to associations #22

Open
pgmassari opened this issue Aug 21, 2016 · 1 comment
Open

Soft deleting not propagating to associations #22

pgmassari opened this issue Aug 21, 2016 · 1 comment

Comments

@pgmassari
Copy link

pgmassari commented Aug 21, 2016

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.

@alexsmonte
Copy link

You resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants