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