/** * @inheritdoc */ public function removeCourse(CourseInterface $course) { if ($this->courses->contains($course)) { $this->courses->removeElement($course); $course->removeTerm($this); } }
/** * @param CourseInterface $course */ public function addCourse(CourseInterface $course) { $this->courses->add($course); }
/** * @return ArrayCollection|CourseInterface[] */ public function getDirectedCourses() { //criteria not 100% reliable on many to many relationships //fix in https://github.com/doctrine/doctrine2/pull/1399 // $criteria = Criteria::create()->where(Criteria::expr()->eq("deleted", false)); // return new ArrayCollection($this->directedCourses->matching($criteria)->getValues()); $arr = $this->directedCourses->filter(function (CourseInterface $entity) { return !$entity->isDeleted(); })->toArray(); $reIndexed = array_values($arr); return new ArrayCollection($reIndexed); }
/** * @param ProgramInterface $program */ public function addProgram(ProgramInterface $program) { $this->programs->add($program); }
/** * @param CourseInterface $course */ public function addDirectedCourse(CourseInterface $course) { $this->directedCourses->add($course); }
/** * @inheritdoc */ public function isDirectingCourse($courseId) { return $this->directedCourses->map(function (CourseInterface $course) { return $course->getId(); })->contains($courseId); }