/**
  * @param ProductionPlanEditDTO $editDTO
  * @param WorkingMonth $workingMonth
  * @return array
  * @throws \LogicException
  * @throws \InvalidArgumentException
  */
 public function editDtoToWorkingMonth(ProductionPlanEditDTO $editDTO, WorkingMonth $workingMonth)
 {
     $messages = array();
     $workingMonth->setMemo($editDTO->memo);
     $today = new \DateTime();
     $today->setTime(0, 0, 0);
     foreach ($workingMonth->getWorkingDays() as $workingDay) {
         if ($workingDay->getDate() >= $today) {
             /* only plan data is considered here, ignore past data */
             /** @var ProductionViewWorkingDayDTO $formWorkingDay */
             $formWorkingDay = $editDTO->getWorkingDayPerId($workingDay->getId());
             $workingDay->setComment($formWorkingDay->comment);
             $workingShifts = $workingDay->getShifts();
             foreach ($workingShifts as $workingShift) {
                 /** @var ProductionViewWorkingShiftDTO $formWorkingShift */
                 $formWorkingShift = $formWorkingDay->getWorkingShiftPerId($workingShift->getId());
                 if ($formWorkingShift->amountOfDrivers < 0) {
                     throw new \InvalidArgumentException();
                 }
                 if ($workingShift->getAmountOfDrivers() !== $formWorkingShift->amountOfDrivers) {
                     try {
                         $this->dispoService->processChangeInAmountOfDriversPerShift($workingShift, $workingShift->getAmountOfDrivers(), $formWorkingShift->amountOfDrivers, $messages);
                     } catch (\LogicException $e) {
                         throw new \LogicException($workingShift->getDate()->format('Y-m-d') . ', ' . $workingShift->getShiftType()->getName() . ': ' . $e->getFile() . ' ' . $e->getLine() . ' ' . $e->getMessage());
                     }
                 }
             }
         }
     }
     return $messages;
 }