Ejemplo n.º 1
0
 public function getSubjectTransfers($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseSubjectTransferPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collSubjectTransfers === null) {
         if ($this->isNew()) {
             $this->collSubjectTransfers = array();
         } else {
             $criteria->add(SubjectTransferPeer::GRADE_CONVERSION_ID, $this->getId());
             SubjectTransferPeer::addSelectColumns($criteria);
             $this->collSubjectTransfers = SubjectTransferPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(SubjectTransferPeer::GRADE_CONVERSION_ID, $this->getId());
             SubjectTransferPeer::addSelectColumns($criteria);
             if (!isset($this->lastSubjectTransferCriteria) || !$this->lastSubjectTransferCriteria->equals($criteria)) {
                 $this->collSubjectTransfers = SubjectTransferPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastSubjectTransferCriteria = $criteria;
     return $this->collSubjectTransfers;
 }
Ejemplo n.º 2
0
 public static function doSelectJoinAllExceptSubject(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     SubjectTransferPeer::addSelectColumns($c);
     $startcol2 = SubjectTransferPeer::NUM_COLUMNS - SubjectTransferPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     GradeConversionPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + GradeConversionPeer::NUM_COLUMNS;
     TestApplicantPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + TestApplicantPeer::NUM_COLUMNS;
     $c->addJoin(SubjectTransferPeer::GRADE_CONVERSION_ID, GradeConversionPeer::ID);
     $c->addJoin(SubjectTransferPeer::TEST_APPLICANT_ID, TestApplicantPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = SubjectTransferPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = GradeConversionPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getGradeConversion();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addSubjectTransfer($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initSubjectTransfers();
             $obj2->addSubjectTransfer($obj1);
         }
         $omClass = TestApplicantPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getTestApplicant();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addSubjectTransfer($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initSubjectTransfers();
             $obj3->addSubjectTransfer($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }