コード例 #1
0
ファイル: AclRuleService.php プロジェクト: fuca/sportsclub
 private function roleTypeHandle(AclRule $e)
 {
     if ($e === null) {
         throw new Exceptions\NullPointerException("Argument Event cannot be null", 0);
     }
     try {
         $role = null;
         $id = $this->getMixId($e->getRole());
         if ($id !== null) {
             $role = $this->roleService->getRole($id, false);
         }
         $e->setRole($role);
     } catch (\Exception $e) {
         throw new Exceptions\DataErrorException($e->getMessage(), $e->getCode(), $e->getPrevious());
     }
 }
コード例 #2
0
ファイル: PositionService.php プロジェクト: fuca/sportsclub
 private function posRoleTypeHandle(Position $p)
 {
     if ($p === null) {
         throw new Exceptions\NullPointerException("Argument Position cannot be null");
     }
     try {
         $role = null;
         $id = $this->getMixId($p->getRole());
         if ($id !== null) {
             $role = $this->roleService->getRole($id, false);
         }
         $p->setRole($role);
     } catch (\Exception $e) {
         $this->logError($e);
         throw new Exceptions\DataErrorException($e->getMessage(), $e->getCode(), $e->getPrevious());
     }
 }
コード例 #3
0
ファイル: AdminPresenter.php プロジェクト: fuca/sportsclub
 /**
  * Presenter action for role update page
  * @Secured(resource="updateRole")
  * @param integer $id
  */
 public function actionUpdateRole($id)
 {
     if (!$id) {
         $this->handleBadArgument($id);
     }
     try {
         $dbRole = $this->roleService->getRole((int) $id);
         if ($dbRole !== null) {
             $form = $this->getComponent('updateRoleForm');
             $dbRole->setParents($dbRole->getParents()->map(function (Role $e) {
                 return $e->getId();
             })->toArray());
             $form->setDefaults($dbRole->toArray());
         } else {
             $this->handleEntityNotExists($id);
         }
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad($id, "default", $ex);
     }
 }