public function additionAction()
 {
     $testUser = new user();
     $testUser->setUsername('u');
     $testUser->setPassword($this->encodePassword($testUser, 'u'));
     $manager = $this->getDoctrine()->getEntityManager();
     $manager->persist($testUser);
     $manager->flush();
     return $this->render('TicketBundle:Default:index.html.twig', array('text' => 'test user added.'));
 }
Exemple #2
0
 public function load(ObjectManager $manager)
 {
     $testUser = new user();
     $testUser->setUsername('u');
     $testUser->setPassword($this->encodePassword($testUser, 'u'));
     $manager->persist($testUser);
     $testAdmin = new user();
     $testAdmin->setUsername('a');
     $testAdmin->setPassword($this->encodePassword($testUser, 'a'));
     $testAdmin->setRoles(array('ROLE_ADMIN'));
     $manager->persist($testAdmin);
     $manager->flush();
 }
 /**
  * {@inheritDoc}
  */
 public function setUsername($username)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setUsername', array($username));
     return parent::setUsername($username);
 }