/** * This method checks: * * If exists more than one school year * * The school year is active * * There are not commissions in the school year that belongs to this career school year */ public function canCreateLastYearCommissions() { $has_students = $this->getSchoolYear()->countSchoolYearStudents() > 0; $has_commissions = count(CoursePeer::retrieveComissionsForCareerSchoolYear($this)) > 0; return $this->getSchoolYear()->getIsActive() && SchoolYearPeer::doCount(new Criteria()) > 1 && !$has_commissions && $has_students; }