public static function doSelectJoinAllExceptProvincia(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     EstablecimientoPeer::addSelectColumns($c);
     $startcol2 = EstablecimientoPeer::NUM_COLUMNS - EstablecimientoPeer::NUM_LAZY_LOAD_COLUMNS;
     DistritoescolarPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (DistritoescolarPeer::NUM_COLUMNS - DistritoescolarPeer::NUM_LAZY_LOAD_COLUMNS);
     OrganizacionPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (OrganizacionPeer::NUM_COLUMNS - OrganizacionPeer::NUM_LAZY_LOAD_COLUMNS);
     NiveltipoPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + (NiveltipoPeer::NUM_COLUMNS - NiveltipoPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(EstablecimientoPeer::FK_DISTRITOESCOLAR_ID), array(DistritoescolarPeer::ID), $join_behavior);
     $c->addJoin(array(EstablecimientoPeer::FK_ORGANIZACION_ID), array(OrganizacionPeer::ID), $join_behavior);
     $c->addJoin(array(EstablecimientoPeer::FK_NIVELTIPO_ID), array(NiveltipoPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = EstablecimientoPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = EstablecimientoPeer::getInstanceFromPool($key1))) {
         } else {
             $omClass = EstablecimientoPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             EstablecimientoPeer::addInstanceToPool($obj1, $key1);
         }
         $key2 = DistritoescolarPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = DistritoescolarPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = DistritoescolarPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 DistritoescolarPeer::addInstanceToPool($obj2, $key2);
             }
             $obj2->addEstablecimiento($obj1);
         }
         $key3 = OrganizacionPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = OrganizacionPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = OrganizacionPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 OrganizacionPeer::addInstanceToPool($obj3, $key3);
             }
             $obj3->addEstablecimiento($obj1);
         }
         $key4 = NiveltipoPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = NiveltipoPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $omClass = NiveltipoPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 NiveltipoPeer::addInstanceToPool($obj4, $key4);
             }
             $obj4->addEstablecimiento($obj1);
         }
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 public static function populateObjects(PDOStatement $stmt)
 {
     $results = array();
     $cls = DistritoescolarPeer::getOMClass();
     $cls = substr('.' . $cls, strrpos('.' . $cls, '.') + 1);
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key = DistritoescolarPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj = DistritoescolarPeer::getInstanceFromPool($key))) {
             $results[] = $obj;
         } else {
             $obj = new $cls();
             $obj->hydrate($row);
             $results[] = $obj;
             DistritoescolarPeer::addInstanceToPool($obj, $key);
         }
     }
     $stmt->closeCursor();
     return $results;
 }
示例#3
0
 public function save(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("You cannot save an object that has been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(DistritoescolarPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $affectedRows = $this->doSave($con);
         $con->commit();
         DistritoescolarPeer::addInstanceToPool($this);
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }