hi

i have two models: User and Address.. the relation is User hasOne
Address.

In my users_controller i declare it like this:

        var $name = 'Users';
        var $hasOne = 'UserAddress';

    var $uses = array('UserAddress');


now after all information are entered in the form i am saving the user
first, then getting the user_id to save the address: this happens in a
controller function:

$this->User->save($this->data);

                                        if ( $this->User->save($this->data) ){
                                                 $this->data 
['UserAddress']['fk_user_id'] = $this->User->id;

                                                 
$this->data['UserAddress']['title']= $this -> Session ->
read('User.contact.title');
                                                 
$this->User->UserAddress->save($this->data);
                                        }


the user is saved perfectly. but cake has a problem with my
UserAddress model. this is the error that pops up:


Undefined property: User::$UserAddress [APP\controllers
\users_controller.php, line 90]
Code | Context


                         $this->data[User'Address']['title']= $this ->
Session -> read('User.contact.title');

                         $this->User>UserAddress->save($this->data);

Fatal error: Call to a member function save() on a non-object in C:
\Development\xampp\htdocs\muh\app\controllers\users_controller.php on
line 90


so no information is saved for UserAddress


can u help me? thx :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to