Exemplo n.º 1
0
 private function loadData()
 {
     $roleAdmin = new Role('ROLE_SUPER_ADMIN');
     $roleAdmin->setName('Super administrateur');
     $roleAdmin->setDescription('Role de super administrateur');
     $this->em->persist($roleAdmin);
     $this->em->flush();
     $roleUser = new Role('ROLE_USER');
     $roleUser->setName('Utilisateur');
     $roleUser->setDescription('Role d\'utilisateur authentifié');
     $this->em->persist($roleUser);
     $this->em->flush();
     $userAdmin = new User();
     $userAdmin->setUsername('admin');
     $userAdmin->setFirstName('admin');
     $userAdmin->setLastName('admin');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole($roleAdmin);
     $this->em->persist($userAdmin);
     $this->em->flush();
     $userAdmin = new User();
     $userAdmin->setUsername('julien');
     $userAdmin->setFirstName('Julien');
     $userAdmin->setLastName('lembo');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole($roleUser);
     $this->em->persist($userAdmin);
     $this->em->flush();
     $userAdmin = new User();
     $userAdmin->setUsername('arthur');
     $userAdmin->setFirstName('Arthur');
     $userAdmin->setLastName('Leroy');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole($roleUser);
     $this->em->persist($userAdmin);
     $this->em->flush();
     $userAdmin = new User();
     $userAdmin->setUsername('bernard');
     $userAdmin->setFirstName('Bernard');
     $userAdmin->setLastName('Martin');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole($roleUser);
     $this->em->persist($userAdmin);
     $this->em->flush();
     $userAdmin = new User();
     $userAdmin->setUsername('jane');
     $userAdmin->setFirstName('Jane');
     $userAdmin->setLastName('Birkin');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole($roleUser);
     $this->em->persist($userAdmin);
     $this->em->flush();
     //Load menu
     $menuIndex = new Menu();
     $menuIndex->setTitle('Acceuil');
     $this->em->persist($menuIndex);
     $this->em->flush();
     $menuAdmin = new Menu();
     $menuAdmin->setTitle('Administration');
     $menuAdmin->setTarget('admin');
     $menuAdmin->setType(3);
     $menuAdmin->setParent($menuIndex);
     $menuAdmin->setIcon('ui-icon ui-icon-gear');
     $this->em->persist($menuAdmin);
     $this->em->flush();
     $menuUser = new Menu();
     $menuUser->setTitle('Mon Role');
     $menuUser->setTarget('role_user');
     $menuUser->setType(3);
     $menuUser->setParent($menuIndex);
     $menuUser->setIcon('ui-icon ui-icon-person');
     $this->em->persist($menuUser);
     $this->em->flush();
 }
Exemplo n.º 2
0
 private function installTestUsers($roleUser)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('julien');
     $userAdmin->setFirstName('Julien');
     $userAdmin->setLastName('lembo');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole($roleUser);
     $this->manager->persist($userAdmin);
     $this->manager->flush();
     $userAdmin = new User();
     $userAdmin->setUsername('arthur');
     $userAdmin->setFirstName('Arthur');
     $userAdmin->setLastName('Leroy');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole($roleUser);
     $this->manager->persist($userAdmin);
     $this->manager->flush();
     $userAdmin = new User();
     $userAdmin->setUsername('bernard');
     $userAdmin->setFirstName('Bernard');
     $userAdmin->setLastName('Martin');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole($roleUser);
     $this->manager->persist($userAdmin);
     $this->manager->flush();
     $userAdmin = new User();
     $userAdmin->setUsername('jane');
     $userAdmin->setFirstName('Jane');
     $userAdmin->setLastName('Birkin');
     $userAdmin->setEmail('*****@*****.**');
     $userAdmin->setPlainPassword('admin');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole($roleUser);
     $this->manager->persist($userAdmin);
     $this->manager->flush();
 }