Hi Mariano
Thanks for (both) replies. Much appreciated. I think that the first
solution will do the trick for me, but the second is a nice extension of
the idea.
Regards,
Langdon
Mariano Iglesias wrote:
> One other thing: if *only* a specific subset of your models should use this
> variable, then this is a better solution:
>
> 1. Create a file called app_data_aco_list_model.php on your app/ folder
> with:
>
> class AppDataAcoListModel extends AppModel
> {
> var $dataAcoList;
> }
>
> 2. For those models that *will* use this variable, change their declaration
> to (I'm assuming here a model named Model):
>
> require_once(APP . 'app_data_aco_list_model.php');
>
> class Model extends AppDataAcoListModel {
> // ...
> }
>
> 3. Do this on your AppController::beforeFilter()
>
> foreach($this->uses as $model)
> {
> if (isset($this->$model) && is_subclass_of($this->$model,
> 'AppDataAcoListModel'))
> {
> $this->$model->dataAcoList = $dataAcoList;
> }
> }
>
> -MI
>
> ---------------------------------------------------------------------------
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> blog: http://www.MarianoIglesias.com.ar
>
> -----Mensaje original-----
> De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
> de Langdon Stevenson
> Enviado el: Domingo, 25 de Febrero de 2007 07:00 p.m.
> Para: [email protected]
> Asunto: Passing value from appController to all models used by an action
>
>
> Is it possible to make available a value from appController to all of
> the models that are called by an action?
>
> I have some security filtering information that I want to make available
> to all beforeFind callBacks. The information is gathered by
> appController and currently I use:
>
> $this->ModelName->dataAcoList = $dataAcoList;
>
>
> >
--
--
Linden Row Pty Ltd
NSW : +61 2 8215 0570
Victoria : +61 3 9013 9423
Fax : +61 2 8215 0571
Mobile : +61 416 118 037
http://www.lindenrow.com.au
---------------------------
Buy fine chocolate online
http://www.chocolatereview.com.au
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---