示例#1
0
 /**
  * @param Role $role
  * @param $limit
  */
 public function increaseRoleMaxUsers(Role $role, $limit)
 {
     $role->setMaxUsers($role->getMaxUsers() + $limit);
     $this->om->persist($role);
     $this->om->flush();
 }
示例#2
0
 /**
  * @EXT\Route(
  *     "role/{role}/edit/name/{name}",
  *     name="platform_role_name_edit",
  *     options={"expose"=true}
  * )
  * @EXT\Method("POST")
  *
  * @param Role $role
  * @return JsonResponse
  */
 public function editRoleNameAction(Role $role, $name)
 {
     if (ctype_space($name)) {
         return new JsonResponse(array('name' => $role->getName(), 'limit' => $role->getMaxUsers(), 'translationKey' => $role->getTranslationKey()), 500);
     }
     $role->setTranslationKey($name);
     $this->roleManager->edit($role);
     return new JsonResponse(array('name' => $role->getName(), 'limit' => $role->getMaxUsers(), 'translationKey' => $role->getTranslationKey()));
 }