Esempio n. 1
0
 public function testSetEmployee()
 {
     $employee = new Employee();
     $project = new Project();
     $this->assertNull($project->getEmployee());
     $project->setEmployee($employee);
     $this->assertEquals($employee, $project->getEmployee());
 }
Esempio n. 2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $faker = Factory::create();
     for ($i = 0; $i < 10; $i++) {
         $project = new Project();
         $project->setName($faker->sentence(6));
         $project->setDescription($faker->paragraph(2));
         $project->setCompany($this->getReference('company-' . $faker->numberBetween(0, 9)));
         $project->setEmployee($this->getReference('employee-' . $faker->numberBetween(0, 9)));
         $project->setStatus($this->getReference('project-status-' . $i));
         $this->addReference('project-' . $i, $project);
         $manager->persist($project);
     }
     $manager->flush();
 }
Esempio n. 3
0
 /**
  * Add projects
  *
  * @param Project $project
  *
  * @return Employee
  */
 public function addProject(Project $project)
 {
     $this->projects[] = $project;
     $project->setEmployee($this);
     return $this;
 }