예제 #1
0
파일: User.php 프로젝트: siciarek/suggester
 public function getNormalizedRoles(\Application\Frontend\Entity\User $user)
 {
     $roles = \Symfony\Component\Yaml\Yaml::parse($user->getRoles());
     foreach ($user->groups as $g) {
         $temp = \Symfony\Component\Yaml\Yaml::parse($g->getRoles());
         $roles = array_unique(array_merge($temp, $roles), SORT_STRING);
     }
     $output = [];
     foreach ($roles as $role) {
         $data = $this->expandRole($role);
         $output = array_unique(array_merge($output, $data), SORT_STRING);
     }
     return $output;
 }
예제 #2
0
 /**
  * @Route("/create", name="backend.user.create")
  * @Route("/edit/{id:[1-9]\d*}", name="backend.user.edit")
  */
 public function editAction($id = 0)
 {
     /**
      * @var User $user
      */
     $user = $id === 0 ? new User() : User::findFirst($id);
     if (!$user instanceof User) {
         throw new \Application\Common\Exceptions\NotFoundException();
     }
     $this->view->form = new UserForm($user);
 }