Example #1
0
 /**
  * @param $subject
  * @param $startDate
  * @param $endDate
  * @return Absent
  */
 public static function registerAbsent($subject, $startDate, $endDate)
 {
     $absent = new Absent();
     $absent->setSubject($subject);
     $absent->setstartDate($startDate);
     $absent->setendDate($endDate);
     return $absent;
 }
Example #2
0
 /**
  * @param Absent $absent
  * @return AbsentEmbeddedListDTO
  */
 public function absentsToAbsentEmbeddedListDTO(Absent $absent)
 {
     $absentEmbeddedListDTO = new AbsentEmbeddedListDTO();
     $absentEmbeddedListDTO->id = $absent->getId();
     $absentEmbeddedListDTO->personId = $absent->getPerson()->getId();
     $absentEmbeddedListDTO->subject = $absent->getSubject();
     $absentEmbeddedListDTO->startDate = $absent->getStartDate()->format('d.m.Y');
     $absentEmbeddedListDTO->endDate = $absent->getEndDate()->format('d.m.Y');
     return $absentEmbeddedListDTO;
 }
Example #3
0
 private function passengerCreateAbsent(Passenger $passenger)
 {
     $absent = Absent::registerAbsent('Ferien', new \DateTime('2014-11-12'), new \DateTime('2014-12-12'));
     $this->init->absentRepo->store($absent);
     $passenger->assignAbsent($absent);
     $this->init->passengerRepo->store($passenger);
     $this->init->em->flush();
     $found = false;
     $absents = $passenger->getAbsents();
     foreach ($absents as $a) {
         if ($a->getId() == $absent->getId()) {
             $found = true;
         }
     }
     $this->assertTrue($found);
 }
Example #4
0
 private function driverCreateAbsent(Driver $driver)
 {
     $absent = Absent::registerAbsent('Ferien', new \DateTime('2014-11-12'), new \DateTime('2014-12-12'));
     $absent2 = Absent::registerAbsent('Ferien da', new \DateTime('2015-11-12'), new \DateTime('2015-12-12'));
     $this->init->absentRepo->store($absent);
     $this->init->absentRepo->store($absent2);
     $driver->assignAbsent($absent);
     $driver->assignAbsent($absent2);
     $this->init->driverRepo->store($driver);
     $this->init->em->flush();
     $found = false;
     $absents = $driver->getAbsents();
     foreach ($absents as $a) {
         if ($a->getId() == $absent2->getId()) {
             $found = true;
         }
     }
     $this->assertTrue($found);
     $this->assertCount(2, $absents);
 }