Esempio n. 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();
 }
Esempio n. 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();
 }
Esempio n. 3
0
 public function equals(User $user)
 {
     if (!$user instanceof User) {
         return false;
     }
     if ($this->password !== $user->getPassword()) {
         return false;
     }
     if ($this->getSalt() !== $user->getSalt()) {
         return false;
     }
     if ($this->username !== $user->getUsername()) {
         return false;
     }
     if ($this->email !== $user->getEmail()) {
         return false;
     }
     return true;
 }