Hello,

I have models:
class User extends AppModel {
        public $hasAndBelongsToMany = array(
                'Right' => array(       'className' => 'Right',
                                                'joinTable' => 'users_rights',
                ),
        );
}

class Right extends AppModel {
        public $hasAndBelongsToMany = array(
                'User' => array(        'className' => 'User',
                                                'joinTable' => 'users_rights',
                ),
        );

};

The tables :
users :
serial id,
string login,
string password


rights:
string id,
string description


users_rights:
serial id,
int user_id,
string right_id,
string site,
boolean allowed

Now i want to add "permission" to an user:

i build this array :
$user = Array
(
    [User] => Array
        (
            [id] => 2
            [login] => paul
            [password] => abc123
        )
    [Right] => Array
        (
            [0] => Array
                (
                    [id] => login
                    [UsersRight] => Array
                        (
                            [user_id] => 2
                            [right_id] => login
                            [allowed] => true
                            [site] => mainframe
                        )

                )
            [1] => Array
                (
                    [id] => right1
                    [UsersRight] => Array
                        (
                            [user_id] => 2
                            [right_id] => right1
                            [allowed] => false
                            [site] => mainframe
                        )

                )


        )
)

Now i want to save this array.
I would like to have :
User ( 2, paul, abc123)
And
users_rights(2, 'login', 'mainframe', true);
users_rights(2, 'right1', 'mainframe', false);

But if i do $this->User->saveAll($user);
Only ['User'] data are inserted/updated and no the associations.

How can i do it ?

--~--~---------~--~----~------------~-------~--~----~
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