当前位置: 首页>>代码示例>>PHP>>正文


PHP StudentPeer::clearInstancePool方法代码示例

本文整理汇总了PHP中StudentPeer::clearInstancePool方法的典型用法代码示例。如果您正苦于以下问题:PHP StudentPeer::clearInstancePool方法的具体用法?PHP StudentPeer::clearInstancePool怎么用?PHP StudentPeer::clearInstancePool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StudentPeer的用法示例。


在下文中一共展示了StudentPeer::clearInstancePool方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute


//.........这里部分代码省略.........
     $new_career_school_year_2014 = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear(CareerPeer::retrieveByPK(8), SchoolYearPeer::retrieveCurrent());
     $old_career_school_year_2013 = CareerSchoolYearPeer::retrieveByPk(21);
     $new_career_school_year_2013 = CareerSchoolYearPeer::retrieveByPk(22);
     $old_career_school_year_2014 = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear(CareerPeer::retrieveByPK(4), SchoolYearPeer::retrieveCurrent());
     $last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear(SchoolYearPeer::retrieveCurrent());
     // ---------------------------------------------------------------------------------------------- //
     // Alumnos que promueven 6to deben seguir en el plan viejo
     $this->log('1 -Alumnos que promueven 6to deben seguir en el plan viejo');
     $c = new Criteria();
     $c->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $old_career_school_year_2013->getId());
     $c->add(StudentCareerSchoolYearPeer::IS_PROCESSED, true);
     $c->add(StudentCareerSchoolYearPeer::YEAR, 6);
     $c->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::APPROVED);
     $students_to_old_career_school_years = StudentCareerSchoolYearPeer::doSelect($c);
     try {
         $connection->beginTransaction();
         foreach ($students_to_old_career_school_years as $socsy) {
             $shift = $socsy->getStudent()->getShiftForSchoolYear($last_year_school_year);
             if (!$socsy->getStudent()->getIsRegistered($old_career_school_year_2014->getSchoolYear())) {
                 $socsy->getStudent()->registerToSchoolYear($old_career_school_year_2014->getSchoolYear(), $shift, $connection);
             }
         }
         $connection->commit();
     } catch (PropelException $e) {
         $connection->rollBack();
         throw $e;
     }
     // ---------------------------------------------------------------------------------------------- //
     // 2 - Resto de los alumnos que no son del CBFE van al plan nuevo en el año que les corresponda
     $this->log('2 - Resto de los alumnos que no son del CBFE van al plan nuevo en el año que les corresponda');
     try {
         $connection->beginTransaction();
         // con este criteria voy a excluir a los que aprueban 6to y deben ir a 7mo del plan viejo
         $c = new Criteria();
         $c->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $old_career_school_year_2013->getId());
         $c->add(StudentCareerSchoolYearPeer::IS_PROCESSED, true);
         $c->add(StudentCareerSchoolYearPeer::YEAR, 6);
         $c->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::APPROVED);
         $c->clearSelectColumns();
         $c->addSelectColumn(StudentCareerSchoolYearPeer::STUDENT_ID);
         $stmt = StudentCareerSchoolYearPeer::doSelectStmt($c);
         $students_to_old_career_school_years_ids = $stmt->fetchAll(PDO::FETCH_COLUMN);
         // con este criteria voy a excluir a los que son del CBFE
         $c = new Criteria();
         $c->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, 23);
         $c->add(StudentCareerSchoolYearPeer::IS_PROCESSED, true);
         $c->clearSelectColumns();
         $c->addSelectColumn(StudentCareerSchoolYearPeer::STUDENT_ID);
         $stmt = StudentCareerSchoolYearPeer::doSelectStmt($c);
         $student_cbfe_ids = $stmt->fetchAll(PDO::FETCH_COLUMN);
         // al total le saco $students_to_old_career_school_years_ids y los
         // student_cbfe_ids
         $c = new Criteria();
         //$c = StudentCareerSchoolYearPeer::retrieveLastYearStudentNotGraduatedCriteria($new_career_school_year_2014);
         $c->add(StudentCareerSchoolYearPeer::YEAR, 7, Criteria::NOT_EQUAL);
         $c->addJoin(StudentCareerSchoolYearPeer::STUDENT_ID, StudentPeer::ID, Criteria::INNER_JOIN);
         $c->add(StudentPeer::ID, array_merge($students_to_old_career_school_years_ids, $student_cbfe_ids), Criteria::NOT_IN);
         $students = StudentPeer::doSelectActive($c);
         foreach ($students as $student) {
             $shift = $student->getShiftForSchoolYear($last_year_school_year);
             if (!$student->getIsRegistered($new_career_school_year_2014->getSchoolYear()) && $shift) {
                 $slcsy = $student->getLastStudentCareerSchoolYear();
                 $slcs = $student->getLastCareerStudent();
                 if ($slcsy->getStatus() == StudentCareerSchoolYearStatus::APPROVED) {
                     $start_year = $slcsy->getYear() + 1;
                 } else {
                     $start_year = $slcsy->getYear();
                 }
                 if ($slcs->getCareerId() != $new_career_school_year_2014->getCareerId()) {
                     $student->registerToCareer($new_career_school_year_2014->getCareer(), null, null, $start_year, $connection);
                     $sys = new SchoolYearStudent();
                     $sys->setStudentId($student->getId());
                     $sys->setSchoolYearId($new_career_school_year_2014->getSchoolYear()->getId());
                     $sys->setShift($shift);
                     $sys->save($connection);
                     $this->verify($student, $new_career_school_year_2014, $connection);
                 } else {
                     $sys = new SchoolYearStudent();
                     $sys->setStudentId($student->getId());
                     $sys->setSchoolYearId($new_career_school_year_2014->getSchoolYear()->getId());
                     $sys->setShift($shift);
                     $sys->save($connection);
                     $this->verify($student, $new_career_school_year_2014, $connection);
                 }
                 if (!is_null($shift)) {
                     $shift->clearAllReferences(true);
                 }
                 $student->clearAllReferences(true);
                 unset($student);
                 unset($shift);
             }
             StudentPeer::clearInstancePool();
             unset($students);
         }
         $connection->commit();
     } catch (PropelException $e) {
         $connection->rollBack();
         throw $e;
     }
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:101,代码来源:BbaMatriculateStudentsTask.class.php

示例2: createStudentsForNextYear

 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);
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:32,代码来源:Division.php

示例3: matriculateLastYearStudents

 public function matriculateLastYearStudents()
 {
     $con = Propel::getConnection();
     try {
         $con->beginTransaction();
         $criteria = StudentCareerSchoolYearPeer::retrieveLastYearStudentNotGraduatedCriteria($this);
         $last_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($this->getSchoolYear());
         $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) {
                 //no tiene reserva de banco y no es libre
                 if ($student->getLastStudentCareerSchoolYear()->getStatus() != StudentCareerSchoolYearStatus::WITHDRAWN && $student->getLastStudentCareerSchoolYear()->getStatus() != StudentCareerSchoolYearStatus::FREE) {
                     if ($student->getPerson()->getIsActive()) {
                         $shift = $student->getShiftForSchoolYear($last_school_year);
                         if (!$student->getIsRegistered($this->getSchoolYear())) {
                             $student->registerToSchoolYear($this->getSchoolYear(), $shift, $con);
                         }
                         if (!is_null($shift)) {
                             $shift->clearAllReferences(true);
                         }
                         $student->clearAllReferences(true);
                         unset($student);
                         unset($shift);
                     }
                 }
             }
             StudentPeer::clearInstancePool();
             unset($students);
         }
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:41,代码来源:CareerSchoolYear.php

示例4: closeSchoolYear

 /**
  * 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();
     }
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:27,代码来源:BaseEvaluatorBehaviour.class.php


注:本文中的StudentPeer::clearInstancePool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。