public function copyCourseSubjects(PropelPDO $con = null, Division $division = null, CareerSchoolYear $career_school_year, $copy_course) { $course_subjects = $this->getCourseSubjects(); foreach ($course_subjects as $course_subject) { $copy_course_subject = new CourseSubject(); $copy_course_subject->setCourse($copy_course); $career_subject_school_year = CareerSubjectSchoolYearPeer::retrieveByCareerSubjectAndSchoolYear($course_subject->getCareerSubjectSchoolYear()->getCareerSubject(), $career_school_year->getSchoolYear()); CareerSubjectSchoolYearPeer::clearInstancePool(); $copy_course_subject->setCareerSubjectSchoolYear($career_subject_school_year); $copy_course_subject->save($con); $course_subject->copyTeachersToCourseSubject($con, $copy_course_subject); $course_subject->copyCourseSubjectDays($con, $copy_course_subject); $career_subject_school_year->clearAllReferences(true); unset($career_subject_school_year); $copy_course_subject->clearAllReferences(true); unset($copy_course_subject); $course_subject->clearAllReferences(true); unset($course_subject); } unset($course_subjects); $this->clearAllReferences(true); }
public function getErrorsWithCourseSubjectsStudent($career_school_year) { $c = new Criteria(); $c->add(CareerSchoolYearPeer::ID, $career_school_year->getId()); $c->addJoin(CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID); $c->addJoin(CareerSubjectSchoolYearPeer::ID, CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID); $c->addJoin(CourseSubjectStudentPeer::COURSE_SUBJECT_ID, CourseSubjectPeer::ID); $c->add(CourseSubjectStudentPeer::STUDENT_ID, $this->getId()); $c->clearSelectColumns(); $c->addSelectColumn(CareerSubjectSchoolYearPeer::ID); $stmt = CareerSubjectSchoolYearPeer::doSelectStmt($c); //me quedo solo con los IDs de los CareerSubjectSchoolYear $array = $stmt->fetchAll(PDO::FETCH_COLUMN); unset($stmt); //ordeno de mayot a menor arsort($array); //armo un arreglo con las claves de los CareerSubjectSchoolYear->ID y //valor la cantidad de veces que esta adentro del arreglo $array_count = array_count_values($array); unset($array); //Filtro los valores que son menores a 1 $array_filtered = array_filter($array_count, create_function('$each', 'return $each>1;')); CareerSubjectSchoolYearPeer::clearInstancePool(); unset($array_count); if (!empty($array_filtered)) { $array_filtered = SchoolBehaviourFactory::getEvaluatorInstance()->evaluateErrorsWithCareerSubjectSchoolYear($array_filtered); } return $array_filtered; }