Beispiel #1
0
 /**
  * @return User
  */
 public static function createAdminUser()
 {
     $user = new User();
     $user->setFullName('Admin ADMIN');
     $user->setLogin('admin');
     $user->setMail('*****@*****.**');
     $user->setIsAdmin(true);
     $user->setAvatar('admin.png');
     $user->testingContext = true;
     $reflection = new \ReflectionObject($user);
     $property = $reflection->getProperty('id');
     $property->setAccessible(true);
     $property->setValue($user, 1);
     return $user;
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $admin = new User();
     $admin->setFullName('Admin ADMIN');
     $admin->setLogin('admin');
     $admin->setMail('*****@*****.**');
     $admin->setIsAdmin(true);
     $admin->setAvatar('admin.png');
     $admin->setBirthday(new \DateTime());
     $admin->setLastVisitHome(new \DateTime());
     $admin->setReadOnlyExpirationDate(new \DateTime());
     $user = new User();
     $user->setFullName('User USER');
     $user->setLogin('user');
     $user->setMail('*****@*****.**');
     $user->setIsAdmin(false);
     $user->setAvatar('user.png');
     $user->setBirthday(new \DateTime());
     $user->setLastVisitHome(new \DateTime());
     $user->setReadOnlyExpirationDate(new \DateTime());
     $orga = new Organization();
     $orga->setName('Orga ORGA');
     $orga->setLogin('orga');
     $orga->setContactMail('*****@*****.**');
     $manager->persist($admin);
     $manager->persist($user);
     $manager->persist($orga);
     $membership = new Member();
     $membership->setOrganization($orga);
     $membership->setUser($user);
     $membership->addPermission('daymail');
     $manager->persist($membership);
     $manager->flush();
     $this->addReference('user_admin', $admin);
     $this->addReference('user_user', $user);
     $this->addReference('user_orga', $orga);
     $this->addReference('user_membership', $orga);
 }