On 4 nov, 09:02, "[email protected]" <[email protected]>
wrote:
> OK, I don't know if it is the same to import and use the model or to
> use the default model of the controller.
>
> In the action I save the model like this:
>
> $this->Group->Save
>
> So in the component I'd like to set the locale just before the save. I
> would put the code in the initialize callback of the component:
>
> ....
> $this->controller->[...access the group model somehow...]->locale =
> the_new_locale;
> ....
>
> Sorry, but I don't know if this is the same of importing the model and
> use it. Pheraps the right question is:
>
> Does '$this->Group' works on an INSTANCE or on the CLASS??
>
> Answer this question, and I will be a happy man.
>
> THANKS!!
try
$this->controller->{$this->controller->modelClass}->locale =
'lowercase';
OR
ClassRegistry::init('ThisModel')->locale = 'lowercase';
Depending on if you want the controller's model irrespective of what
it is, or a specific model that may or may not be attached to the
controller.
hth,
AD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---