Ejemplo n.º 1
0
 /**
  * @param $name
  * @param $passwd
  * @param $email
  * @return User
  */
 public function addUser($name, $passwd, $email)
 {
     $user = new User();
     $user->setUsername($name);
     $user->setEmail($email);
     $user->setPlainPassword($passwd);
     $user->setEnabled(true);
     return $user;
 }
Ejemplo n.º 2
0
 protected function findOrCreateUser($username, $email)
 {
     $user = $this->get('enhavo_user.repository.user')->findOneBy(['username' => $username]);
     if ($user === null) {
         $user = new User();
         $user->setEmail($email);
         $user->setUsername($username);
         $this->getManager()->persist($user);
     }
     return $user;
 }