$this->alias should have to corresponding name
try that

On 21 Mrz., 17:18, Jeremy Burns <[email protected]> wrote:
> I have a Status model with a function that is called from a few
> related models. The related models use different aliases, for example
> UserStatus, CompanyStatus, AccountStatus and so on. Here's the
> function:
>
> function activeStatuses() {
>
>         $activeStatuses = $this->find(
>                 'all',
>                 array(
>                         'fields' => array('id'),
>                         'conditions' => array('is_active' => 1)
>                 )
>         );
>
>         Set::extract('/UserStatus/id', $activeStatuses);
>
> }
>
> My challenge is that in the Set::extract statement I have to use the
> alias of the model that is calling it as that is the name of the array
> key containing the result. So in this example it is 'UserStatus'
> rather than just 'Status'.
>
> How can I make this function agnostic to the calling model (without
> passing in the model name and using it as a variable, for example)?

-- 
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