Ejemplo n.º 1
0
 /**
  * Selects a collection of Campus objects pre-filled with all related objects.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Campus objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     CampusPeer::addSelectColumns($criteria);
     $startcol2 = CampusPeer::NUM_HYDRATE_COLUMNS;
     SchoolPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + SchoolPeer::NUM_HYDRATE_COLUMNS;
     $criteria->addJoin(CampusPeer::SCHOOL_ID, SchoolPeer::ID, $join_behavior);
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = CampusPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = CampusPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://www.propelorm.org/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = CampusPeer::getOMClass();
             $obj1 = new $cls();
             $obj1->hydrate($row);
             CampusPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined School rows
         $key2 = SchoolPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = SchoolPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = SchoolPeer::getOMClass();
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 SchoolPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Campus) to the collection in $obj2 (School)
             $obj2->addCampus($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Ejemplo n.º 2
0
 public static function doSelectJoinAllExceptCountry(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     MemberDetailPeer::addSelectColumns($c);
     $startcol2 = MemberDetailPeer::NUM_COLUMNS - MemberDetailPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     RegionPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + RegionPeer::NUM_COLUMNS;
     ReligionPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + ReligionPeer::NUM_COLUMNS;
     SchoolPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + SchoolPeer::NUM_COLUMNS;
     $c->addJoin(MemberDetailPeer::REGION_ID, RegionPeer::ID);
     $c->addJoin(MemberDetailPeer::RELIGION_ID, ReligionPeer::ID);
     $c->addJoin(MemberDetailPeer::SCHOOL_OF_ORIGIN, SchoolPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = MemberDetailPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = RegionPeer::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->getRegion();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addMemberDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initMemberDetails();
             $obj2->addMemberDetail($obj1);
         }
         $omClass = ReligionPeer::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->getReligion();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addMemberDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initMemberDetails();
             $obj3->addMemberDetail($obj1);
         }
         $omClass = SchoolPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getSchool();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addMemberDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initMemberDetails();
             $obj4->addMemberDetail($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Ejemplo n.º 3
0
 /**
  * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
  *
  * Use this method directly if you want to work with an executed statement durirectly (for example
  * to perform your own object hydration).
  *
  * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  * @param      PropelPDO $con The connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  * @return     PDOStatement The executed PDOStatement object.
  * @see        BasePeer::doSelect()
  */
 public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(SchoolPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     if (!$criteria->hasSelectClause()) {
         $criteria = clone $criteria;
         SchoolPeer::addSelectColumns($criteria);
     }
     // Set the correct dbName
     $criteria->setDbName(self::DATABASE_NAME);
     // BasePeer returns a PDOStatement
     return BasePeer::doSelect($criteria, $con);
 }
 public static function doSelectJoinAllExceptDegree(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     StudentEducationHistoryPeer::addSelectColumns($c);
     $startcol2 = StudentEducationHistoryPeer::NUM_COLUMNS - StudentEducationHistoryPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     StudentPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + StudentPeer::NUM_COLUMNS;
     SchoolPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + SchoolPeer::NUM_COLUMNS;
     $c->addJoin(StudentEducationHistoryPeer::STUDENT_ID, StudentPeer::ID);
     $c->addJoin(StudentEducationHistoryPeer::SCHOOL_ID, SchoolPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = StudentEducationHistoryPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = StudentPeer::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->getStudent();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addStudentEducationHistory($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initStudentEducationHistorys();
             $obj2->addStudentEducationHistory($obj1);
         }
         $omClass = SchoolPeer::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->getSchool();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addStudentEducationHistory($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initStudentEducationHistorys();
             $obj3->addStudentEducationHistory($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Ejemplo n.º 5
0
 public static function doSelectRS(Criteria $criteria, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     if (!$criteria->getSelectColumns()) {
         $criteria = clone $criteria;
         SchoolPeer::addSelectColumns($criteria);
     }
     $criteria->setDbName(self::DATABASE_NAME);
     return BasePeer::doSelect($criteria, $con);
 }