Example #1
0
 public function load(ObjectManager $manager)
 {
     $factory = $this->container->get('security.encoder_factory');
     $user = new User();
     $encoder = $factory->getEncoder($user);
     $user = new User();
     $user->setUsername('*****@*****.**');
     $user->setPassword($encoder->encodePassword($this->container->getParameter('user_password'), $user->getSalt()));
     $manager->persist($user);
     $address = new Address();
     $address->setAddress1('9 Place du Docteur Michel');
     $address->setCity('Foulain');
     $address->setZip('52800');
     $address->setCountry('France');
     $manager->persist($address);
     $client = new Client();
     $client->setFirstName('Delphine');
     $client->setLastName('Achini');
     $client->setEmail('*****@*****.**');
     $client->setPhone('0679402652');
     $client->setAddress($address);
     $client->setUser($user);
     $manager->persist($client);
     $manager->flush();
 }
Example #2
0
 public function load(ObjectManager $manager)
 {
     $factory = $this->container->get('security.encoder_factory');
     $user = new User();
     $encoder = $factory->getEncoder($user);
     $user = new User();
     $user->setUsername('*****@*****.**');
     $user->setPassword($encoder->encodePassword($this->container->getParameter('user_password'), $user->getSalt()));
     $user->setRoles(array('ROLE_ADMIN'));
     $manager->persist($user);
     $manager->flush();
 }
Example #3
0
 public function forceRegister($email, $username = null, $password = null)
 {
     if (!$username) {
         $username = $email;
     }
     if (!$password) {
         $password = $this->builder->randomPassword();
     }
     $user = new User();
     $user->setEmail($email);
     $user->setUsername($username);
     $user->setPlainPassword($password);
     $user->setPassword($this->encoder->encodePassword($user, $user->getPlainPassword()));
     $user->setLocale($this->params['locale']);
     $user->setActive(User::ACTIVE);
     $this->em->persist($user);
     $this->em->flush();
     return $user;
 }