Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
orm many many with Warden Package strange problem
  • 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(8); // My third record It works........
  • I don't know Warden, but is User -> Role defined as a many-to-many relation?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion