Exemplo n.º 1
0
 public function load(ObjectManager $em)
 {
     $passwordEncoder = $this->container->get('security.password_encoder');
     $johnUser = new User();
     $johnUser->setUsername('john_user');
     $johnUser->setEmail('*****@*****.**');
     #$johnUser->setPassword('kitten');
     $encodedPassword = $passwordEncoder->encodePassword($johnUser, 'kitten');
     $johnUser->setPassword($encodedPassword);
     $johnUser->setRoles(array('ROLE_USER'));
     $annaAdmin = new User();
     $annaAdmin->setUsername('anna_admin');
     $annaAdmin->setEmail('*****@*****.**');
     #$annaAdmin->setPassword('kitten');
     $encodedPassword = $passwordEncoder->encodePassword($annaAdmin, 'kitten');
     $annaAdmin->setPassword($encodedPassword);
     $annaAdmin->setRoles(array('ROLE_ADMIN'));
     $annaAdmin->setIsActive(true);
     $em->persist($johnUser);
     $em->persist($annaAdmin);
     $em->flush();
 }
 /**
  * {@inheritDoc}
  */
 public function setEmail($email)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setEmail', array($email));
     return parent::setEmail($email);
 }