예제 #1
0
 /**
  *
  */
 private function getRoleByUniqueRef($roleRef)
 {
     // Allow the role to be specified as a primary key or by the exact name
     if (ctype_digit($roleRef)) {
         $roleParam = ['conditions' => 'id = ?0 AND active = ?1', 'bind' => [$roleRef, 'Y']];
     } else {
         $roleParam = ['conditions' => 'name = ?0 AND active = ?1', 'bind' => [$roleRef, 'Y']];
     }
     if (($role = Roles::findFirst($roleParam)) === false) {
         throw new ArgumentValidationException("Unable to find role {$roleRef}", 1);
     }
     return $role;
 }