/** ------------------------- * Get the repeated driving assertion plan id for one driver and one shift * * @param Driver $driver * @param Shift $shift * @return mixed|null */ protected function getPlanIdFor(Driver $driver, Shift $shift) { $drivingAssertions = $driver->getDrivingAssertions(); /** @var DrivingAssertion $drivingAssertion */ foreach ($drivingAssertions as $drivingAssertion) { if ($drivingAssertion->getShift() === $shift) { /** @var RepeatedDrivingAssertionPlan $rdaPlan */ $rdaPlan = $drivingAssertion->getRepeatedDrivingAssertionPlan(); return is_object($rdaPlan) ? $rdaPlan->getId() : null; } } return null; }