Exemplo n.º 1
0
 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('admin');
     // todo - fill in this encoded password... ya know... somehow...
     $user->setName('Artur');
     $user->setSurname('Dziocha');
     $user->setPassword($this->encodePassword($user, 'makow5'));
     $user->setRoles(['ROLE_ADMIN']);
     $user->setIsActive(true);
     $user->setEmail('*****@*****.**');
     $manager->persist($user);
     // the queries aren't done until now
     $manager->flush();
     $user = new User();
     $user->setUsername('user');
     // todo - fill in this encoded password... ya know... somehow...
     $user->setPassword($this->encodePassword($user, 'makow5'));
     $user->setName('Piotr');
     $user->setSurname('Strzemiecki');
     $user->setRoles(['ROLE_USER']);
     $user->setIsActive(true);
     $user->setEmail('*****@*****.**');
     $manager->persist($user);
     // the queries aren't done until now
     $manager->flush();
 }