private function adddUser($firstname, $lastname, $email, $password, array $roles, $address, $company = null) { $user = $this->userManager->createUser(); $user->setUsername($email); $user->setEmail($email); $user->setFirstname($firstname); $user->setLastname($lastname); $user->setPlainPassword($password); $user->setRoles($roles); $user->setAddress($address); $user->setCompany($company ?: null); $user->setEnabled(true); $this->userManager->updateUser($user, false); return $user; }
private function testIfUsernameAlreadyInUse() { $email = $this->userManager->findUserByUsername($this->submitDatas['email']); if ($email) { throw new \Exception(json_encode(array("email" => "Cet email est déjà utilisé.")), 403); } }
/** * Constructor. * * @param EncoderFactoryInterface $encoderFactory * @param CanonicalizerInterface $usernameCanonicalizer * @param CanonicalizerInterface $emailCanonicalizer * @param ObjectManager $om * @param string $class */ public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, ObjectManager $om, $class) { parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer); $this->objectManager = $om; $this->repository = $om->getRepository($class); $metadata = $om->getClassMetadata($class); $this->class = $metadata->getName(); }
/** * Constructor. * * @param EncoderFactoryInterface $encoderFactory * @param CanonicalizerInterface $usernameCanonicalizer * @param CanonicalizerInterface $emailCanonicalizer * @param DocumentManager $dm * @param string $class */ public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, DocumentManager $dm, $class) { parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer); $this->dm = $dm; $this->repository = $dm->getRepository($class); $metadata = $dm->getClassMetadata($class); $this->class = $metadata->name; }
/** * Constructor. * * @param EncoderFactoryInterface $encoderFactory * @param string $algorithm * @param CanonicalizerInterface $usernameCanonicalizer * @param CanonicalizerInterface $emailCanonicalizer * @param EntityManager $em * @param string $class */ public function __construct(EncoderFactoryInterface $encoderFactory, $algorithm, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, EntityManager $em, $class) { parent::__construct($encoderFactory, $algorithm, $usernameCanonicalizer, $emailCanonicalizer); $this->em = $em; $this->repository = $em->getRepository($class); $metadata = $em->getClassMetadata($class); $this->class = $metadata->name; }
public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, Connection $connection, $collection, $class) { $this->connection = $connection; $this->collection = $collection; $this->documentHandler = new DocumentHandler($this->connection); $this->class = $class; parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer); }
/** * @param UserManager $userManager * @param UserInterface $user */ private function deleteUserIfHeExists($userManager, $user) { if ($user) { $userManager->deleteUser($user); } }
/** * @param FilterUserResponseEvent $event */ public function onPasswordResettingSuccess(FilterUserResponseEvent $event) { $user = $event->getUser(); $user->setPasswordChanged(true); $this->userManager->updateUser($user); }
/** * Fonction permettant de savoir si un utilisateur existe déja selon son username et email * @since 2.3 fourth argument id has ben removed * @param UserManager $userManager * @param string $username * @param string $userMail */ private function userAlreadyExist(UserManager $userManager, $username, $userMail) { $alreadyExist = false; $userByUsername = $userManager->findUserByUsername($username); $userByUserMail = $userManager->findUserByEmail($userMail); if (isset($userByUsername)) { $this->get('session')->getFlashBag()->add('notice', "Le nom d'utilisateur est déjà utilisé."); $alreadyExist = true; } if (isset($userByUserMail)) { $this->get('session')->getFlashBag()->add('notice', "L'adresse e-mail est déjà utilisée."); $alreadyExist = true; } return $alreadyExist; }
/** * Constructor. * * @param EncoderFactoryInterface $encoderFactory * @param CanonicalizerInterface $usernameCanonicalizer * @param CanonicalizerInterface $emailCanonicalizer * @param string $proxyClass * @param string $modelClass */ public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, $proxyClass, $modelClass) { parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer); $this->class = $proxyClass; $this->modelClass = $modelClass; }
/** * Constructor. * * @param EncoderFactoryInterface $encoderFactory * @param CanonicalizerInterface $usernameCanonicalizer * @param CanonicalizerInterface $emailCanonicalizer * @param ObjectManager $om * @param string $class */ public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, ObjectManager $om, $class) { parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer); $this->objectManager = $om; $this->entity = $class; }