public static function setAvailableStudentsForCourse(CourseSubject $course_subject) { $course = $course_subject->getCourse(); $school_year = $course->getSchoolYear(); $pathways = $school_year->getPathways(); $available_pathway_students = array(); foreach ($pathways as $pathway) { $c = new Criteria(); $c->addJoin(PathwayStudentPeer::STUDENT_ID, StudentCareerSubjectAllowedPathwayPeer::STUDENT_ID); $c->add(PathwayStudentPeer::PATHWAY_ID, $pathway->getId()); $c->add(PathwayStudentPeer::YEAR, $course_subject->getYear()); $c->add(StudentCareerSubjectAllowedPathwayPeer::CAREER_SUBJECT_ID, $course_subject->getCareerSubjectSchoolYear()->getCareerSubject()->getId()); foreach (PathwayStudentPeer::doSelect($c) as $ps) { $available_pathway_students[] = $ps->getStudent(); } } self::$_students = array_merge($course_subject->getPathwayStudents(), $available_pathway_students); }