Example #1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('admin');
     $userAdmin->setPassword('test');
     $manager->persist($userAdmin);
     $manager->flush();
 }
Example #2
0
 private function loadUsers(ObjectManager $manager)
 {
     $passwordEncoder = $this->container->get('security.password_encoder');
     $johnUser = new User();
     $johnUser->setUsername('john_user');
     $johnUser->setEmail('*****@*****.**');
     $encodedPassword = $passwordEncoder->encodePassword($johnUser, 'kitten');
     $johnUser->setPassword($encodedPassword);
     $manager->persist($johnUser);
     $annaAdmin = new User();
     $annaAdmin->setUsername('anna_admin');
     $annaAdmin->setEmail('*****@*****.**');
     $annaAdmin->setRoles(array('ROLE_ADMIN'));
     $encodedPassword = $passwordEncoder->encodePassword($annaAdmin, 'kitten');
     $annaAdmin->setPassword($encodedPassword);
     $manager->persist($annaAdmin);
     $manager->flush();
 }
 /**
  * {@inheritDoc}
  */
 public function setUsername($username)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setUsername', array($username));
     return parent::setUsername($username);
 }