function register(User $user)
 {
     if (count($user->getRoles()) <= 0) {
         $role_user = $this->em->getRepository("{$this->roleClass}")->findOneBy(array('role' => 'ROLE_USER'));
         $user->addRole($role_user);
     }
     $user->setAccountNonExpired(TRUE);
     $user->setAccountNonLocked(TRUE);
     $user->setCredentialsNonExpired(TRUE);
     $user->setEnabled(TRUE);
     $this->em->persist($user);
     $this->em->flush();
     return $user;
 }
Пример #2
0
 function __construct()
 {
     parent::__construct();
     $this->userRoles = new ArrayCollection();
     $this->posts = new ArrayCollection();
 }
Пример #3
0
 function __construct()
 {
     parent::__construct();
     $this->roles = new ArrayCollection();
 }