/** * @param RepeatedDrivingAssertionRegisterDTO $dto * @return ArrayCollection */ public function repeatedRegisterDTOtoMonthlyDrivingAssertions(RepeatedDrivingAssertionRegisterDTO $dto) { $monthlyDrivingAssertions = new ArrayCollection(); /** @var ShiftSelectionDTO $shiftSelectionDTO */ foreach ($dto->getMonthlyShiftSelections() as $shiftSelectionDTO) { $selectionIdArray = $this->explodeMonthlySelectionId($shiftSelectionDTO->getSelectionId()); $monthlyDrivingAssertion = new RepeatedMonthlyDrivingAssertion(); $monthlyDrivingAssertion->setRelativeWeekAsText($selectionIdArray['relativeWeek']); $monthlyDrivingAssertion->setWeekdayAsText($selectionIdArray['weekday']); $monthlyDrivingAssertion->setShiftTypes($shiftSelectionDTO->getShiftSelection()); $monthlyDrivingAssertions->add($monthlyDrivingAssertion); } return $monthlyDrivingAssertions; }