graemetait / cakephp-soft-delete

Soft delete for CakePHP models.
9 stars 4 forks source link

Not working with Containable #1

Open DIDoS opened 8 years ago

DIDoS commented 8 years ago

When using the containable behaviour in a Model that includes a Model using the soft delete Behaviour the soft deleted Items are visible.

I would appreciate a discussion so I can create a pull request.

graemetait commented 8 years ago

Hi,

I do use Containable a lot, and although I haven't experienced that issue myself, I can imagine how it would happen. If you've got a fix I'd certainly be interested in a PR.

Thanks.

DIDoS commented 8 years ago

Hey burriko, I can't see how your Behaviour should be able to handle this.. The beforeFind doesn't seem to be executed since the contained Model has the Softdelete Behaviour and the "parent" does not. It seems like the CakePHP Containable does not execute the beforeFind of the contained Model (and therefore its Behaviour). When adding the Behaviour to the "parent" Model a fatal is thrown in SoftDeletableBehavior:45 since $find_condition is null.

How should/did that work with your Containables?