/** * This method check if the students pass the year or not * * @param SchoolYear $school_year * @param PropelPDO $con */ public function closeSchoolYear(SchoolYear $school_year, PropelPDO $con = null) { $criteria = SchoolYearStudentPeer::retrieveStudentsForSchoolYearCriteria($school_year); $pager = new sfPropelPager('Student', 100); $pager->setCriteria($criteria); $pager->init(); $last_page = $pager->getLastPage(); for ($i = 1; $i <= $last_page; $i++) { $pager->setPage($i); $pager->init(); $students = $pager->getResults(); foreach ($students as $student) { if ($student->getLastStudentCareerSchoolYear()->getStatus() != StudentCareerSchoolYearStatus::WITHDRAWN_WITH_RESERVE) { $this->stepToNextYear($student, $school_year, $con); } } $school_year->setIsClosed(true); $school_year->save($con); StudentPeer::clearInstancePool(); } }