예제 #1
0
 public function load(ObjectManager $manager)
 {
     $role_manager = ProjectRole::PROJECT_ROLE_LEADER;
     $role = new ProjectRole();
     $role->setName($role_manager);
     $manager->persist($role);
     $project = new Project();
     $project->setName('Project1');
     $manager->persist($project);
     $projectUser = new ProjectUser();
     $projectUser->setProject($project);
     $projectUser->setUser($this->getReference('user1'));
     $projectUser->addRole($role);
     $manager->persist($projectUser);
     $projectUser = new ProjectUser();
     $projectUser->setProject($project);
     $projectUser->setUser($this->getReference('user2'));
     $manager->persist($projectUser);
     $project = new Project();
     $project->setName('Project2');
     $this->addReference('Project2', $project);
     $manager->persist($project);
     $projectUser = new ProjectUser();
     $projectUser->setProject($project);
     $projectUser->setUser($this->getReference('user3'));
     $manager->persist($projectUser);
     $projectUser = new ProjectUser();
     $projectUser->setProject($project);
     $projectUser->setUser($this->getReference('user4'));
     $manager->persist($projectUser);
     $manager->flush();
     $projectService = $this->container->get('app.project.service');
     $projectService->setUserToProjectLeader($this->getReference('user3'), $this->getReference('Project2'));
     $projectService->addUserToProject($this->getReference('user1'), $manager->getRepository('CustomFosUserBundle:Project')->findOneByName('Project2'));
 }
예제 #2
0
 /**
  * Fonction chargeants les données de projets
  *
  * @param ObjectManager $manager Manager de Fixtures
  *
  * @return void
  */
 public function load(ObjectManager $manager)
 {
     $projet1 = new Project();
     $projet2 = new Project();
     $projet3 = new Project();
     $projet1->setName('Projet de martin');
     $projet2->setName('Projet de charles');
     $projet3->setName('Projet de gregoire');
     $projet1->setPicture('http://thingiverse-production-new.s3.amazonaws.com/' . 'renders/81/3a/fe/1b/67/s105_preview_featured.jpg');
     $projet2->setPicture('http://thingiverse-production-new.s3.amazonaws.com/' . 'renders/8d/14/ce/a2/af/d7cd591717d65159d228d939146d31b4_preview_featured.JPG');
     $projet3->setPicture('https://thingiverse-production-new.s3.amazonaws.com/' . 'renders/f4/3f/0a/ce/2b/3dc783ba406af2c3a1a9ae087654c83f_preview_featured.jpg');
     $manager->persist($projet1);
     $manager->persist($projet2);
     $manager->persist($projet3);
     $manager->flush();
     $this->addReference('projet-martin', $projet1);
     $this->addReference('projet-charles', $projet2);
     $this->addReference('projet-gregoire', $projet3);
     $projectService = $this->container->get('app.project.service');
     $projectService->addUserToProject($this->getReference('user-martin'), $projet1);
     $projectService->addUserToProject($this->getReference('user-charles'), $projet2);
     $projectService->addUserToProject($this->getReference('user-charles'), $projet3);
     $projectService->addUserToProject($this->getReference('user-gregoire'), $projet3);
     $projectService->addUserToProject($this->getReference('user-gregoire'), $projet1);
     $projectService->setUserToProjectLeader($this->getReference('user-martin'), $projet1);
     $projectService->setUserToProjectLeader($this->getReference('user-gregoire'), $projet3);
 }