Hi All,
I encounter a very strange problem with the Warden Package.
Here 2 working method :
$role = Model_Role::find_by_id(1);
$role->users[] = Model_User::find_by_id(6);
$role->save(false); // i have to set to false because i get a frozen error message
$role = Model_Role::find_by_id(1);
unset($role->users[6]);
$role->save();
Here 2 non working method :
$user = Model_User::find_by_id(6);
$user->roles[] = Model_Role::find_by_id(1);
$user->save();
$user = Model_User::find_by_id(6);
unset($user->roles[1]);
$user->save(false);
Could you help me ? I want to assign multiples roles to user but working with the $user object and no the $role object.
ok i found the problem.
In fact it doesn't work with the first record...............
I don't know why but if instead of :
$user = Model_User::find_by_id(6);
I set :
$user = Model_User::find_by_id(7); // My second record
Or :
$user = Model_User::find_by_id(; // My third record
It works........