Example #1
0
 /**
  * @inheritdoc
  */
 public function removeCourse(CourseInterface $course)
 {
     if ($this->courses->contains($course)) {
         $this->courses->removeElement($course);
         $course->removeTerm($this);
     }
 }
Example #2
0
 /**
  * @param CourseInterface $course
  */
 public function addCourse(CourseInterface $course)
 {
     $this->courses->add($course);
 }
Example #3
0
 /**
  * @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);
 }
Example #4
0
 /**
  * @param ProgramInterface $program
  */
 public function addProgram(ProgramInterface $program)
 {
     $this->programs->add($program);
 }
Example #5
0
 /**
  * @param CourseInterface $course
  */
 public function addDirectedCourse(CourseInterface $course)
 {
     $this->directedCourses->add($course);
 }
Example #6
0
 /**
  * @inheritdoc
  */
 public function isDirectingCourse($courseId)
 {
     return $this->directedCourses->map(function (CourseInterface $course) {
         return $course->getId();
     })->contains($courseId);
 }