I want to delete my relations to via the $hasone. But because I am using nested set modeling, i want to use my own delete 'function'. How can i do this? CakePHP doesn't use my standard delete-function...
Thanks
I want to delete my relations to via the $hasone. But because I am using nested set modeling, i want to use my own delete 'function'. How can i do this? CakePHP doesn't use my standard delete-function...
Thanks
If you still want to use $this->Model->delete()
instead of going into your model and defining your own function like myDelete()
(easier and probably a better idea...) - have a look at this post on polymorphism:
Is it possible to overwrite a function in PHP
On another note, Cake's functions are built to support cascading and modifying data through (often complex) model relationships, and you'd be better to work with it if you can.
The manual says this:
You can hook custom logic into the delete process using the beforeDelete and afterDelete callbacks present in both Models and Behaviors.
I'd suggest you see what you can do with that before proceeding, or otherwise just define your own custom function in the model called myDelete()
and use that.