/** ------------------------- * Build new driving orders derived from repeated driving order plan, * for a new driving order plan. * * @param RepeatedDrivingOrderPlan $drivingOrderPlan * @param mixed $status * @return mixed|void */ public function handleNewRepeatedDrivingOrder(RepeatedDrivingOrderPlan $drivingOrderPlan, $status) { /** @var RepeatedDrivingOrder $repeatedDrivingOrder */ $repeatedDrivingOrder = $drivingOrderPlan->getRepeatedDrivingOrdersAsArray()[0]; /** @var WorkingMonthRepository $workingMonthRepository */ $workingMonthRepository = $this->container->get('workingmonth_repository'); $prospectiveWorkingMonths = $workingMonthRepository->findProspectiveWorkingMonths(); /** @var WorkingMonth $workingMonth */ foreach ($prospectiveWorkingMonths as $workingMonth) { $workingDays = $workingMonth->getWorkingDays(); /** @var WorkingDay $workingDay */ foreach ($workingDays as $workingDay) { if ($drivingOrderPlan->matching($workingDay->getDate())) { /* plan range conditions satisfied */ if ($repeatedDrivingOrder->matching($workingDay->getDate())) { /* weekday condition satisfied */ $this->handleNewRepeatedDrivingOrdersForDate($drivingOrderPlan, $workingDay->getDate(), $status); } } } } }