コード例 #1
0
ファイル: LoadUsers.php プロジェクト: jmsteinmetz/Dime
 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param Doctrine\Common\Persistence\ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $defaultUser = new User();
     $defaultUser->setUsername('admin');
     $defaultUser->setPlainPassword('kitten');
     $defaultUser->setEnabled(true);
     $defaultUser->addRole(User::ROLE_SUPER_ADMIN);
     $defaultUser->setFirstname('Default');
     $defaultUser->setLastname('User');
     $defaultUser->setEmail('*****@*****.**');
     $manager->persist($defaultUser);
     $testUser = new User();
     $testUser->setUsername('test');
     $testUser->setPlainPassword('kitten');
     $testUser->setEnabled(true);
     $testUser->addRole(User::ROLE_DEFAULT);
     $testUser->setFirstname('Test');
     $testUser->setLastname('User');
     $testUser->setEmail('*****@*****.**');
     $manager->persist($testUser);
     $manager->flush();
     $this->addReference('default-user', $defaultUser);
     $this->addReference('test-user', $testUser);
 }