public static function retrieveLastYearStudentNotGraduatedCriteria($career_school_year)
 {
     $school_year = SchoolYearPeer::retrieveLastYearSchoolYear($career_school_year->getSchoolYear());
     $c = new Criteria();
     $c->addJoin(StudentPeer::ID, CareerStudentPeer::STUDENT_ID, Criteria::INNER_JOIN);
     $c->addAnd(CareerStudentPeer::STATUS, CareerStudentStatus::GRADUATE, criteria::NOT_EQUAL);
     $c->addAnd(CareerStudentPeer::CAREER_ID, $career_school_year->getCareer()->getId());
     $c->addAnd(StudentPeer::ID, SchoolYearStudentPeer::retrieveStudentIdsForSchoolYear($school_year), Criteria::IN);
     return $c;
 }
Beispiel #2
0
 public function createStudentsForNextYear(PropelPDO $con = null, CareerSchoolYear $last_career_school_year)
 {
     //$old_division = DivisionPeer::retrieveByDivisionTitleAndYearAndSchoolYear($this->getDivisionTitle(), $this->getYear() - 1, $last_career_school_year);
     //$students = $old_division->getStudents();
     $c = new Criteria();
     $c->addJoin(StudentPeer::ID, DivisionStudentPeer::STUDENT_ID, Criteria::INNER_JOIN);
     $c->addJoin(DivisionStudentPeer::DIVISION_ID, DivisionPeer::ID, Criteria::INNER_JOIN);
     $c->addAnd(DivisionPeer::YEAR, $this->getYear() - 1);
     $c->addAnd(DivisionPeer::DIVISION_TITLE_ID, $this->getDivisionTitleId());
     $c->addAnd(DivisionPeer::CAREER_SCHOOL_YEAR_ID, $last_career_school_year->getId());
     $c->addAnd(StudentPeer::ID, SchoolYearStudentPeer::retrieveStudentIdsForSchoolYear($last_career_school_year->getSchoolYear()), Criteria::IN);
     $students = StudentPeer::doSelect($c);
     foreach ($students as $student) {
         $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($student, $this->getCareerSchoolYear());
         StudentCareerSchoolYearPeer::clearInstancePool();
         //If the student has not repeated last year.
         if (!is_null($student_career_school_year) && !$student_career_school_year->getIsRepproved()) {
             $division_student = new DivisionStudent();
             $division_student->setStudent($student);
             $division_student->setDivision($this);
             $division_student->save($con);
             $division_student->clearAllReferences(true);
             unset($division_student);
             $student_career_school_year->clearAllReferences(true);
             unset($student_career_school_year);
         }
         $student->clearAllReferences(true);
         unset($student);
     }
     StudentPeer::clearInstancePool();
     unset($students);
 }