/** * Checks if given step belongs to course * * @param int $step_id * @param \Calculus\BaranekBundle\Entity\Course $course * @return boolean */ public function existInCourse(int $step_id, \Calculus\BaranekBundle\Entity\Course $course) : bool { $step = $this->step_repository->findOneById($step_id); if (empty($step)) { return false; } $step_course_id = $step->getCourse()->getId(); $course_id = $course->getId(); return $course_id === $step_course_id; }