/**
  * Convert one driving order to one embedded list DTO
  *
  * @param DrivingOrder $drivingOrder
  * @return DrivingOrderEmbeddedListDTO
  */
 public function drivingOrderToDrivingOrderEmbeddedListDTO(DrivingOrder $drivingOrder)
 {
     $listDTO = new DrivingOrderEmbeddedListDTO();
     $listDTO->id = $drivingOrder->getId();
     $listDTO->passengerId = $drivingOrder->getPassenger()->getId();
     $listDTO->isDeleted = !$drivingOrder->isActive();
     $listDTO->sortOrder = $drivingOrder->getSortOrder();
     $listDTO->pickupDate = $this->dateTimeService->convertToLocalDateTime($drivingOrder->getPickUpDate())->format('d.m.Y');
     $listDTO->pickupTime = $this->dateTimeService->convertToLocalDateTime($drivingOrder->getPickUpTime())->format('H:i');
     $listDTO->addressFromString = $drivingOrder->getRoute()->getStartAddress()->toString();
     $listDTO->addressToString = $drivingOrder->getRoute()->getTargetAddress()->toString();
     return $listDTO;
 }
 /**
  * Converts an overbooked driving order to a human readable string.
  *
  * @param DrivingOrder $drivingOrder
  * @return string
  */
 private function getDrivingOrderString(DrivingOrder $drivingOrder)
 {
     /** @var DateTimeService $timeService */
     $timeService = $this->container->get('tixi_api.datetimeservice');
     $tr = $this->container->get('translator');
     $body = $tr->trans('drivingorder.issue.body');
     $dateStr = $drivingOrder->getPickUpDate()->format('d.m.Y');
     $timeStr = $timeService->convertToLocalTimeString($drivingOrder->getPickUpTime());
     $adr = $drivingOrder->getRoute()->getStartAddress();
     $location = $adr->getStreet() . ', ' . $adr->getCity();
     return $body . ' ' . $drivingOrder->getPassenger()->getNameStringForContact() . ' : ' . $dateStr . ' ' . $timeStr . ', ' . $location;
 }