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; }
function __construct() { parent::__construct(); $this->userRoles = new ArrayCollection(); $this->posts = new ArrayCollection(); }
function __construct() { parent::__construct(); $this->roles = new ArrayCollection(); }