本文整理汇总了PHP中Division::getCourses方法的典型用法代码示例。如果您正苦于以下问题:PHP Division::getCourses方法的具体用法?PHP Division::getCourses怎么用?PHP Division::getCourses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Division
的用法示例。
在下文中一共展示了Division::getCourses方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAvailableStudentsForDivision
/**
* Get every student that isnt inscripted in other division.
* The inscription depends on the aproval method implemented by each school
*
* @param Division $division
*
* @return array Student[]
*/
public function getAvailableStudentsForDivision(Division $division)
{
$students_in = array();
foreach ($division->getCourses() as $course) {
foreach ($course->getNonOptionCourseSubjects() as $course_subject) {
$criteria_course = $this->getAvailableStudentsForCourseSubjectCriteria($course_subject);
$criteria_course->clearSelectColumns();
$criteria_course->addSelectColumn(StudentPeer::ID);
$stmt = StudentPeer::doSelectStmt($criteria_course);
$students_in = array_merge($stmt->fetchAll(PDO::FETCH_COLUMN), $students_in);
}
}
$c = new Criteria();
//$c->addAnd(StudentPeer::ID,$not_in,Criteria::NOT_IN);
$c->add(StudentPeer::ID, $students_in, Criteria::IN);
return StudentPeer::doSelect($c);
}
示例2: getAvailableStudentsForDivision
/**
* Get every student that isnt inscripted in other division.
* The inscription depends on the aproval method implemented by each school
*
* @param Division $division
*
* @return array Student[]
*/
public function getAvailableStudentsForDivision(Division $division)
{
// Get students just inscripted in other divisions
$not_in_criteria = new Criteria();
$not_in_criteria->addJoin(DivisionStudentPeer::STUDENT_ID, StudentPeer::ID);
$not_in_criteria->addJoin(DivisionStudentPeer::DIVISION_ID, DivisionPeer::ID, Criteria::INNER_JOIN);
$not_in_criteria->add(DivisionPeer::CAREER_SCHOOL_YEAR_ID, $division->getCareerSchoolYear()->getId());
$not_in_criteria->clearSelectColumns();
$not_in_criteria->addSelectColumn(StudentPeer::ID);
$stmt = StudentPeer::doSelectStmt($not_in_criteria);
$not_in = $stmt->fetchAll(PDO::FETCH_COLUMN);
$students_in = array();
foreach ($division->getCourses() as $course) {
foreach ($course->getNonOptionCourseSubjects() as $course_subject) {
$criteria_course = $this->getAvailableStudentsForCourseSubjectCriteria($course_subject);
$criteria_course->clearSelectColumns();
$criteria_course->addSelectColumn(StudentPeer::ID);
$stmt = StudentPeer::doSelectStmt($criteria_course);
$students_in = array_merge($stmt->fetchAll(PDO::FETCH_COLUMN), $students_in);
}
}
$students_in = array_diff($students_in, $not_in);
$c = new Criteria();
//$c->addAnd(StudentPeer::ID,$not_in,Criteria::NOT_IN);
$c->add(StudentPeer::ID, $students_in, Criteria::IN);
return StudentPeer::doSelect($c);
}