Пример #1
0
 /**
  * @param User $newUser
  * @return User
  */
 private function initUser(User $newUser)
 {
     $utils = new UserUtils($this->container);
     $newUser->setIsActive(false);
     $newUser->setPassword($utils->encodePassword($newUser, $newUser->getPassword()));
     return $newUser;
 }
Пример #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $utils = new UserUtils($this->container);
     $user = new User();
     $user->setUsername('darth');
     $user->setPassword($utils->encodePassword($user, 'pass'));
     $user->setIsActive(false);
     $manager->persist($user);
     $user1 = new User();
     $user1->setUsername('vikbert');
     $user1->setPassword($utils->encodePassword($user1, 'pass'));
     $user1->setIsActive(true);
     $user1->setEmail('*****@*****.**');
     $manager->persist($user1);
     $user2 = new User();
     $user2->setUsername('demo');
     $user2->setPassword($utils->encodePassword($user2, 'pass'));
     $user2->setIsActive(false);
     $manager->persist($user2);
     $manager->flush();
 }