Since Components look to the Controller for knowledge of Models, how
about loading up your extra Models in the Controller?
http://book.cakephp.org/view/961/components-helpers-and-uses
var $uses = array('model1', 'model2');
Regards,
Don
On May 13, 11:22 am, taq <[email protected]> wrote:
> in component function Modelclass load the model same name of
> conrtroller
> i have question how to load other model to use in component
> ÔÓébehind backslash i try to load other model to component
> public function initialize(&$controller, $settings = array()) {
> $this->settings = array_merge($this->defaults, $settings);
> $this->controller = &$controller;
> }
>
> public function register() {
> $this->__isLoggedIn();
> if (!empty($this->controller->data)) {
> extract($this->settings);
> debugger::dump($model =
> $this->controller->modelClass);
> $this->controller->loadModel($model);
> //
> $this->controller->{$model}->Myprofile->save($this->controller->data);
>
> // $this->controller->data['Myprofile']
> ['user_id'] = $this->controller->{$model}->id;
>
> $this->controller->{$model}->set($this->controller->data);
> if ($this->controller->{$model}->validates()) {
--
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