コード例 #1
0
ファイル: LoadData.php プロジェクト: alxckn/tpSF
 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('user');
     $user->setPassword('$2a$04$KO68Ijmly1ibMcAfxQfv7uCs71JdAiUvkWxpc/NwaFVgmpwHERL8W');
     $user->setLastname('Chaks');
     $user->setFirstname('Alex');
     $user->setEmail('*****@*****.**');
     $user->setEnabled(true);
     $event = new Event();
     $event->setName('Party');
     $event->setIsDistributed(false);
     $event->setStartDate(new \DateTime("2020-12-31 12:13:40"));
     $event->setToken('aa');
     $event->setSharedToken('bb');
     $userEvent = new UserEvent();
     $userEvent->setEvent($event);
     $userEvent->setUser($user);
     $manager->persist($user);
     $manager->persist($event);
     $manager->persist($userEvent);
     $manager->flush();
 }
コード例 #2
0
 public function load(ObjectManager $manager)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('admin');
     //$userAdmin->setPassword('$2a$04$m3JSssF2nmcdtcij/6qsLOgd7tXTSHDmJi0.nFGPoSUVQpcosIwqa');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setFirstname('Mathieu');
     $userAdmin->setLastname('Chabas');
     $userAdmin->setEnabled(true);
     $visitor = new User();
     $visitor->setUsername('visitor');
     $visitor->setPlainPassword('visitor');
     $visitor->setEmail('*****@*****.**');
     $visitor->setFirstname('Dupont');
     $visitor->setLastname('Dupont');
     $visitor->setEnabled(true);
     $manager->persist($userAdmin);
     $manager->persist($visitor);
     $event = new Event();
     $event->setName('Anniversaire');
     $date = new \DateTime('2018-10-10 08:00:00');
     $event->setStartDate($date);
     $event->setOwner($userAdmin);
     $userEvent = new UserEvent();
     $userEvent->setUser($userAdmin);
     $userEvent->setEvent($event);
     $manager->persist($event);
     $manager->persist($userEvent);
     $event = new Event();
     $event->setName('Marathon');
     $date = new \DateTime('2016-10-10 10:00:00');
     $event->setStartDate($date);
     $event->setOwner($visitor);
     $userEvent = new UserEvent();
     $userEvent->setUser($visitor);
     $userEvent->setEvent($event);
     $manager->persist($event);
     $manager->persist($userEvent);
     $visitor = new User();
     $visitor->setUsername('visitor2');
     $visitor->setPlainPassword('visitor2');
     $visitor->setEmail('*****@*****.**');
     $visitor->setFirstname('Dupont2');
     $visitor->setLastname('Dupont2');
     $visitor->setEnabled(true);
     $manager->persist($visitor);
     $visitor = new User();
     $visitor->setUsername('visitor3');
     $visitor->setPlainPassword('visitor3');
     $visitor->setEmail('*****@*****.**');
     $visitor->setFirstname('Dupont3');
     $visitor->setLastname('Dupont3');
     $visitor->setEnabled(true);
     $manager->persist($visitor);
     $visitor = new User();
     $visitor->setUsername('visitor4');
     $visitor->setPlainPassword('visitor4');
     $visitor->setEmail('*****@*****.**');
     $visitor->setFirstname('Dupont4');
     $visitor->setLastname('Dupont4');
     $visitor->setEnabled(true);
     $manager->persist($visitor);
     $visitor = new User();
     $visitor->setUsername('visitor5');
     $visitor->setPlainPassword('visitor5');
     $visitor->setEmail('*****@*****.**');
     $visitor->setFirstname('Dupont5');
     $visitor->setLastname('Dupont5');
     $visitor->setEnabled(true);
     $manager->persist($visitor);
     $manager->flush();
 }