you could make this a behavior and only attach it in the methods/
actions you want it to work


On 15 Feb., 16:25, Charles Bueche <[email protected]> wrote:
> Hi,
>
> I'm using cakePHP 2.1beta.
>
> I had like to use the afterFind() in a model to massage some data.
> However, I would like to restrict its effect to only one method defined
> in the controller, and do nothing for the other methods. My initial
> though was to do something like this :
>
>     function afterFind($results) {
>         if ($this->method == 'my_special_method') {
>             foreach ($results as $key => $val) {
>                 # massage data
>             }
>             return $results;
>         }
>         else {
>             # no massaging
>            return $results;
>       }
>     }
>
> but apparently, $this does not contain the calling method. Any idea ?
>
> Thanks,
> Charles

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to