Пример #1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('admin');
     $user->setEmail('*****@*****.**');
     $user->setEnabled(true);
     $user->setRoles(array('ROLE_SUPER_ADMIN'));
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
     $user->setPassword($encoder->encodePassword('admin', $user->getSalt()));
     $manager->persist($user);
     $manager->flush();
     $this->addReference('user1', $user);
     $user = new User();
     $user->setUsername('o.quiroz');
     $user->setEmail('*****@*****.**');
     $user->setEnabled(true);
     $user->setRoles(array('ROLE_SUPER_ADMIN'));
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
     $user->setPassword($encoder->encodePassword('o.quiroz', $user->getSalt()));
     $manager->persist($user);
     $manager->flush();
     $this->addReference('user2', $user);
     $user = new User();
     $user->setUsername('n.ramirez');
     $user->setEmail('*****@*****.**');
     $user->setEnabled(true);
     $user->setRoles(array('ROLE_SUPER_ADMIN'));
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
     $user->setPassword($encoder->encodePassword('o.quiroz', $user->getSalt()));
     $manager->persist($user);
     $manager->flush();
     $this->addReference('user3', $user);
 }
 /**
  * {@inheritDoc}
  */
 public function setRoles(array $roles)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setRoles', array($roles));
     return parent::setRoles($roles);
 }