setRoles() 공개 메소드

public setRoles ( array $roles )
$roles array
예제 #1
0
 /**
  * Pass an ARRAY of Role objects and will clear the collection and re-set it with new Roles.
  * Type hinted array due to interface.
  *
  * @param array $roles Of Role objects.
  */
 public function setRoles(array $roles)
 {
     $this->user_roles->clear();
     $parentRoles = array();
     foreach ($roles as $role) {
         $this->addRole($role);
         $parentRoles[] = $role->getName();
     }
     parent::setRoles($parentRoles);
 }