/**
  * @param WorkTime $workTime
  * @param \DateTime $endDate
  * @param \DateTime $duration
  * @param string $description
  */
 public function stopWorkTime(WorkTime $workTime, \DateTime $endDate, \DateTime $duration, $description)
 {
     $workTime->setEndDate($endDate);
     $workTime->setDuration($duration);
     $workTime->setDescription($description);
     $this->getEntityManager()->merge($workTime);
     $this->getEntityManager()->flush();
 }
Ejemplo n.º 2
0
 /**
  * @param WorkTime $workTime
  * @return WorkTimeDTO
  */
 public static function withEntity(WorkTime $workTime)
 {
     $dto = new WorkTimeDTO();
     $dto->setId($workTime->getId());
     $dto->setDescription($workTime->getDescription());
     $dto->setDuration($workTime->getDuration() ? $workTime->getDuration()->format('H:i') : null);
     $dto->setStartDate($workTime->getStartDate());
     $dto->setEndDate($workTime->getEndDate());
     $dto->setProject(ProjectDTO::withEntity($workTime->getProject()));
     return $dto;
 }