/** * This methoe check if this is the last student reincorporation checking at created_at * * @return boolean */ public function isLastStudentReincorporation() { $c = new Criteria(); $c->add(StudentReincorporationPeer::STUDENT_ID, $this->getStudentId()); $c->add(StudentReincorporationPeer::CAREER_SCHOOL_YEAR_PERIOD_ID, $this->getCareerSchoolYearPeriodId()); $c->add(StudentReincorporationPeer::COURSE_SUBJECT_ID, $this->getCourseSubjectId()); $c->addDescendingOrderByColumn(StudentReincorporationPeer::CREATED_AT); $last = StudentReincorporationPeer::doSelectOne($c); return $last->getCreatedAt() == $this->getCreatedAt(); }
public function hasReincorporations($career_school_year_id, $course_subject_id = null) { $c = new Criteria(); $c->add(StudentReincorporationPeer::STUDENT_ID, $this->getId()); if (is_null($course_subject_id)) { $c->add(StudentReincorporationPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year_id); } else { $c->add(StudentReincorporationPeer::COURSE_SUBJECT_ID, $course_subject_id); } return StudentReincorporationPeer::doCount($c); }