Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('admin');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->addRole('ROLE_SUPER_ADMIN');
     $userAdmin->setPlainPassword('secret');
     $userAdmin->setEnabled(true);
     $userManager = $this->container->get('fos_user.user_manager');
     $userManager->updateUser($userAdmin);
     $manager->persist($userAdmin);
     $manager->flush();
     $this->addReference('admin-user', $userAdmin);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $demoUser = new User();
     $demoUser->setUsername('demo');
     $demoUser->setEmail('*****@*****.**');
     $demoUser->addRole('ROLE_ADMIN');
     $demoUser->setPlainPassword('demo');
     $demoUser->setEnabled(true);
     $userManager = $this->container->get('fos_user.user_manager');
     $userManager->updateUser($demoUser);
     $manager->persist($demoUser);
     $manager->flush();
     $this->addReference('user-demo', $demoUser);
 }