Re: Oop Question? - accessing protected model methods from behaviours.

2012-07-30 Thread Josejulio Martínez
I had to do the very same, but instead of displaying to me the Call to protected method Model::_deleteDependent() from context 'SoftDeletableBehavior' it tried to execute the query _deleteDependent On Monday, September 19, 2011 9:52:14 PM UTC-5, #2Will wrote: ok, so i wrapped the

Oop Question? - accessing protected model methods from behaviours.

2011-09-19 Thread #2Will
Hello I am trying to use Mariano's soft delete plugin with cakephp 2.0 but have come accross little problem Call to protected method Model::_deleteDependent() from context 'SoftDeletableBehavior' so thats $model-_deleteDependent($id, $cascade); on line 102 This error is because as per the

Oop Question? - accessing protected model methods from behaviours.

2011-09-19 Thread #2Will
Hello I am trying to use Mariano's soft delete plugin with cakephp 2.0 but have come accross little problem Call to protected method Model::_deleteDependent() from context 'SoftDeletableBehavior' so thats $model-_deleteDependent($id, $cascade); on line 102 This error is because as per the

Re: Oop Question? - accessing protected model methods from behaviours.

2011-09-19 Thread Thomas Ploch
Well, you can just use the public method `public Model::delete($id = null, $cascade = true)`, which will call `protected _Model::_deleteDependent($id, $cascade)`. Basically this is just a search and replace operation in the Behavior's code. Kind regards Thomas Am 19.09.2011 09:36, schrieb

Re: Oop Question? - accessing protected model methods from behaviours.

2011-09-19 Thread Zaky Katalan-Ezra
It looks like a bad design. Why declaring a function protected if you want to use it outside of descendant classes. Create a public function deleteDependent() in the behavior and call _deleteDependent() from this function On Mon, Sep 19, 2011 at 10:32 AM, #2Will willjbar...@gmail.com wrote:

Re: Oop Question? - accessing protected model methods from behaviours.

2011-09-19 Thread Thomas Ploch
Well, or you just use Model::delete() with the cascade parameter set to true. This is the cakephp way to do it, no need to add another wrapper method, since Model::delete already is the wrapper for this method... Kind regards Thomas Am 19.09.2011 10:38, schrieb Zaky Katalan-Ezra: It looks

Re: Oop Question? - accessing protected model methods from behaviours.

2011-09-19 Thread #2Will
Thanks for replies, appologies for the multiple posting. Well, you can just use the public method `public Model::delete($id = null, $cascade = true)`, which will call `protected _Model::_deleteDependent($id, $cascade) The behaviour is skipping delete in favor of making the record as deleted

Re: Oop Question? - accessing protected model methods from behaviours.

2011-09-19 Thread #2Will
ok, so i wrapped the protected methods in the appModel. Surely this is a hack? now the behaviour isn't very self contained and the methods that clever core devs protected are now exposed by me. so anyway, its working. i forked marianos code on github. but i doubt its the best way. will On