/** * Selects a collection of Usuario 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 Usuario 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(UsuarioPeer::DATABASE_NAME); } UsuarioPeer::addSelectColumns($criteria); $startcol2 = UsuarioPeer::NUM_HYDRATE_COLUMNS; PerfilPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + PerfilPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(UsuarioPeer::PERFIL_ID, PerfilPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseUsuarioPeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = UsuarioPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = UsuarioPeer::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 = UsuarioPeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); UsuarioPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Perfil rows $key2 = PerfilPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = PerfilPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = PerfilPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); PerfilPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (Usuario) to the collection in $obj2 (Perfil) $obj2->addUsuario($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of Empresa objects pre-filled with all related objects except Taula1. * * @param Criteria $c * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of Empresa objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptTaula1(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $c = clone $c; // Set the correct dbName if it has not been overridden // $c->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } EmpresaPeer::addSelectColumns($c); $startcol2 = EmpresaPeer::NUM_COLUMNS - EmpresaPeer::NUM_LAZY_LOAD_COLUMNS; ProvinciaPeer::addSelectColumns($c); $startcol3 = $startcol2 + (ProvinciaPeer::NUM_COLUMNS - ProvinciaPeer::NUM_LAZY_LOAD_COLUMNS); UsuarioPeer::addSelectColumns($c); $startcol4 = $startcol3 + (UsuarioPeer::NUM_COLUMNS - UsuarioPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(EmpresaPeer::ID_PROVINCIA), array(ProvinciaPeer::ID_PROVINCIA), $join_behavior); $c->addJoin(array(EmpresaPeer::ID_USUARIO), array(UsuarioPeer::ID_USUARIO), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = EmpresaPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = EmpresaPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $omClass = EmpresaPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); EmpresaPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Provincia rows $key2 = ProvinciaPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = ProvinciaPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = ProvinciaPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); ProvinciaPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Empresa) to the collection in $obj2 (Provincia) $obj2->addEmpresa($obj1); } // if joined row is not null // Add objects for joined Usuario rows $key3 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = UsuarioPeer::getInstanceFromPool($key3); if (!$obj3) { $omClass = UsuarioPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); UsuarioPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Empresa) to the collection in $obj3 (Usuario) $obj3->addEmpresa($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of Libro objects pre-filled with all related objects except Genero. * * @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 Libro objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptGenero(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } LibroPeer::addSelectColumns($criteria); $startcol2 = LibroPeer::NUM_HYDRATE_COLUMNS; UsuarioPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + UsuarioPeer::NUM_HYDRATE_COLUMNS; PrivacidadPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + PrivacidadPeer::NUM_HYDRATE_COLUMNS; UsuarioPeer::addSelectColumns($criteria); $startcol5 = $startcol4 + UsuarioPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(LibroPeer::USUARIO_ULT_ACC, UsuarioPeer::ID, $join_behavior); $criteria->addJoin(LibroPeer::ID_PRIVACIDAD, PrivacidadPeer::ID, $join_behavior); $criteria->addJoin(LibroPeer::ID_USUARIO, UsuarioPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = LibroPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = LibroPeer::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 = LibroPeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); LibroPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Usuario rows $key2 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = UsuarioPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = UsuarioPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); UsuarioPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Libro) to the collection in $obj2 (Usuario) $obj2->addLibroRelatedByUsuario_ult_acc($obj1); } // if joined row is not null // Add objects for joined Privacidad rows $key3 = PrivacidadPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = PrivacidadPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = PrivacidadPeer::getOMClass(); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); PrivacidadPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Libro) to the collection in $obj3 (Privacidad) $obj3->addLibro($obj1); } // if joined row is not null // Add objects for joined Usuario rows $key4 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = UsuarioPeer::getInstanceFromPool($key4); if (!$obj4) { $cls = UsuarioPeer::getOMClass(); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); UsuarioPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (Libro) to the collection in $obj4 (Usuario) $obj4->addLibroRelatedById_usuario($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Persists this object to the database. * * If the object is new, it inserts it; otherwise an update is performed. * All modified related objects will also be persisted in the doSave() * method. This method wraps all precipitate database operations in a * single transaction. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see doSave() */ public function save(PropelPDO $con = null) { foreach (sfMixer::getCallables('BaseUsuario:save:pre') as $callable) { $affectedRows = call_user_func($callable, $this, $con); if (is_int($affectedRows)) { return $affectedRows; } } if ($this->isNew() && !$this->isColumnModified(UsuarioPeer::CREATED_AT)) { $this->setCreatedAt(time()); } if ($this->isModified() && !$this->isColumnModified(UsuarioPeer::UPDATED_AT)) { $this->setUpdatedAt(time()); } if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(UsuarioPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $affectedRows = $this->doSave($con); $con->commit(); foreach (sfMixer::getCallables('BaseUsuario:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } UsuarioPeer::addInstanceToPool($this); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } }
/** * Selects a collection of Mensaje objects pre-filled with all related objects. * * @param Criteria $c * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of Mensaje objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { foreach (sfMixer::getCallables('BaseMensajePeer:doSelectJoinAll:doSelectJoinAll') as $callable) { call_user_func($callable, 'BaseMensajePeer', $c, $con); } $c = clone $c; // Set the correct dbName if it has not been overridden if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } MensajePeer::addSelectColumns($c); $startcol2 = MensajePeer::NUM_COLUMNS - MensajePeer::NUM_LAZY_LOAD_COLUMNS; UsuarioPeer::addSelectColumns($c); $startcol3 = $startcol2 + (UsuarioPeer::NUM_COLUMNS - UsuarioPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(MensajePeer::ID_USUARIO), array(UsuarioPeer::ID_USUARIO), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = MensajePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = MensajePeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $omClass = MensajePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); MensajePeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Usuario rows $key2 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = UsuarioPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = UsuarioPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); UsuarioPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (Mensaje) to the collection in $obj2 (Usuario) $obj2->addMensaje($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of Mensaje 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 Mensaje 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); } MensajePeer::addSelectColumns($criteria); $startcol2 = MensajePeer::NUM_HYDRATE_COLUMNS; UsuarioPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + UsuarioPeer::NUM_HYDRATE_COLUMNS; UsuarioPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + UsuarioPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(MensajePeer::ID_USUARIO_DESTINATARIO, UsuarioPeer::ID, $join_behavior); $criteria->addJoin(MensajePeer::ID_USUARIO_REMITENTE, UsuarioPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = MensajePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = MensajePeer::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 = MensajePeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); MensajePeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Usuario rows $key2 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = UsuarioPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = UsuarioPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); UsuarioPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (Mensaje) to the collection in $obj2 (Usuario) $obj2->addMensajeRelatedById_usuario_destinatario($obj1); } // if joined row not null // Add objects for joined Usuario rows $key3 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = UsuarioPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = UsuarioPeer::getOMClass(); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); UsuarioPeer::addInstanceToPool($obj3, $key3); } // if obj3 loaded // Add the $obj1 (Mensaje) to the collection in $obj3 (Usuario) $obj3->addMensajeRelatedById_usuario_remitente($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * * @param mixed $key Primary key to use for the query * @param PropelPDO $con A connection object * * @return Usuario A model object, or null if the key is not found * @throws PropelException */ protected function findPkSimple($key, $con) { $sql = 'SELECT `ID`, `USUARIO`, `CLAVE`, `NOMBRE`, `APELLIDO`, `PERFIL_ID`, `CREATED_AT`, `UPDATED_AT`, `CREATED_BY`, `UPDATED_BY` FROM `usuario` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); } $obj = null; if ($row = $stmt->fetch(PDO::FETCH_NUM)) { $obj = new Usuario(); $obj->hydrate($row); UsuarioPeer::addInstanceToPool($obj, (string) $key); } $stmt->closeCursor(); return $obj; }
/** * Persists this object to the database. * * If the object is new, it inserts it; otherwise an update is performed. * All modified related objects will also be persisted in the doSave() * method. This method wraps all precipitate database operations in a * single transaction. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see doSave() */ 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(UsuarioPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); $isInsert = $this->isNew(); try { $ret = $this->preSave($con); if ($isInsert) { $ret = $ret && $this->preInsert($con); } else { $ret = $ret && $this->preUpdate($con); } if ($ret) { $affectedRows = $this->doSave($con); if ($isInsert) { $this->postInsert($con); } else { $this->postUpdate($con); } $this->postSave($con); UsuarioPeer::addInstanceToPool($this); } else { $affectedRows = 0; } $con->commit(); return $affectedRows; } catch (Exception $e) { $con->rollBack(); throw $e; } }
public static function doSelectJoinAllExceptPermiso(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } RelUsuarioPermisoPeer::addSelectColumns($c); $startcol2 = RelUsuarioPermisoPeer::NUM_COLUMNS - RelUsuarioPermisoPeer::NUM_LAZY_LOAD_COLUMNS; UsuarioPeer::addSelectColumns($c); $startcol3 = $startcol2 + (UsuarioPeer::NUM_COLUMNS - UsuarioPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(RelUsuarioPermisoPeer::FK_USUARIO_ID), array(UsuarioPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = RelUsuarioPermisoPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = RelUsuarioPermisoPeer::getInstanceFromPool($key1))) { } else { $omClass = RelUsuarioPermisoPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); RelUsuarioPermisoPeer::addInstanceToPool($obj1, $key1); } $key2 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = UsuarioPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = UsuarioPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); UsuarioPeer::addInstanceToPool($obj2, $key2); } $obj2->addRelUsuarioPermiso($obj1); } $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Populates an object of the default type or an object that inherit from the default. * * @param array $row PropelPDO resultset row. * @param int $startcol The 0-based offset for reading from the resultset row. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. * @return array (Usuario object, last column rank) */ public static function populateObject($row, $startcol = 0) { $key = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol); if (null !== ($obj = UsuarioPeer::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, $startcol, true); // rehydrate $col = $startcol + UsuarioPeer::NUM_HYDRATE_COLUMNS; } else { $cls = UsuarioPeer::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $startcol); UsuarioPeer::addInstanceToPool($obj, $key); } return array($obj, $col); }
/** * Selects a collection of Tarea objects pre-filled with all related objects except Empresa. * * @param Criteria $c * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of Tarea objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptEmpresa(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $c = clone $c; // Set the correct dbName if it has not been overridden // $c->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } TareaPeer::addSelectColumns($c); $startcol2 = TareaPeer::NUM_COLUMNS - TareaPeer::NUM_LAZY_LOAD_COLUMNS; FormularioPeer::addSelectColumns($c); $startcol3 = $startcol2 + (FormularioPeer::NUM_COLUMNS - FormularioPeer::NUM_LAZY_LOAD_COLUMNS); CampoPeer::addSelectColumns($c); $startcol4 = $startcol3 + (CampoPeer::NUM_COLUMNS - CampoPeer::NUM_LAZY_LOAD_COLUMNS); UsuarioPeer::addSelectColumns($c); $startcol5 = $startcol4 + (UsuarioPeer::NUM_COLUMNS - UsuarioPeer::NUM_LAZY_LOAD_COLUMNS); ParametroPeer::addSelectColumns($c); $startcol6 = $startcol5 + (ParametroPeer::NUM_COLUMNS - ParametroPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(TareaPeer::ID_FORMULARIO), array(FormularioPeer::ID_FORMULARIO), $join_behavior); $c->addJoin(array(TareaPeer::ID_CAMPO), array(CampoPeer::ID_CAMPO), $join_behavior); $c->addJoin(array(TareaPeer::ID_USUARIO), array(UsuarioPeer::ID_USUARIO), $join_behavior); $c->addJoin(array(TareaPeer::ID_ESTADO_TAREA), array(ParametroPeer::ID_PARAMETRO), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = TareaPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = TareaPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $omClass = TareaPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); TareaPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Formulario rows $key2 = FormularioPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = FormularioPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = FormularioPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); FormularioPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Tarea) to the collection in $obj2 (Formulario) $obj2->addTarea($obj1); } // if joined row is not null // Add objects for joined Campo rows $key3 = CampoPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = CampoPeer::getInstanceFromPool($key3); if (!$obj3) { $omClass = CampoPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); CampoPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Tarea) to the collection in $obj3 (Campo) $obj3->addTarea($obj1); } // if joined row is not null // Add objects for joined Usuario rows $key4 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = UsuarioPeer::getInstanceFromPool($key4); if (!$obj4) { $omClass = UsuarioPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); UsuarioPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (Tarea) to the collection in $obj4 (Usuario) $obj4->addTarea($obj1); } // if joined row is not null // Add objects for joined Parametro rows $key5 = ParametroPeer::getPrimaryKeyHashFromRow($row, $startcol5); if ($key5 !== null) { $obj5 = ParametroPeer::getInstanceFromPool($key5); if (!$obj5) { $omClass = ParametroPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj5 = new $cls(); $obj5->hydrate($row, $startcol5); ParametroPeer::addInstanceToPool($obj5, $key5); } // if $obj5 already loaded // Add the $obj1 (Tarea) to the collection in $obj5 (Parametro) $obj5->addTarea($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of Postulantes objects pre-filled with all related objects except Libro. * * @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 Postulantes objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptLibro(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } PostulantesPeer::addSelectColumns($criteria); $startcol2 = PostulantesPeer::NUM_HYDRATE_COLUMNS; UsuarioPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + UsuarioPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(PostulantesPeer::ID_POSTULANTE, UsuarioPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = PostulantesPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = PostulantesPeer::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 = PostulantesPeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); PostulantesPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Usuario rows $key2 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = UsuarioPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = UsuarioPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); UsuarioPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Postulantes) to the collection in $obj2 (Usuario) $obj2->addPostulantes($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of Transaccion objects pre-filled with all related objects except TipoPago. * * @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 Transaccion objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptTipoPago(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(TransaccionPeer::DATABASE_NAME); } TransaccionPeer::addSelectColumns($criteria); $startcol2 = TransaccionPeer::NUM_HYDRATE_COLUMNS; ClientePeer::addSelectColumns($criteria); $startcol3 = $startcol2 + ClientePeer::NUM_HYDRATE_COLUMNS; UsuarioPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + UsuarioPeer::NUM_HYDRATE_COLUMNS; TipoTransaccionPeer::addSelectColumns($criteria); $startcol5 = $startcol4 + TipoTransaccionPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(TransaccionPeer::CLIENTE_ID, ClientePeer::ID, $join_behavior); $criteria->addJoin(TransaccionPeer::USUARIO_ID, UsuarioPeer::ID, $join_behavior); $criteria->addJoin(TransaccionPeer::TIPO_TRANSACCION_ID, TipoTransaccionPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseTransaccionPeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = TransaccionPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = TransaccionPeer::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 = TransaccionPeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); TransaccionPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Cliente rows $key2 = ClientePeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = ClientePeer::getInstanceFromPool($key2); if (!$obj2) { $cls = ClientePeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); ClientePeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Transaccion) to the collection in $obj2 (Cliente) $obj2->addTransaccion($obj1); } // if joined row is not null // Add objects for joined Usuario rows $key3 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = UsuarioPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = UsuarioPeer::getOMClass(); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); UsuarioPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Transaccion) to the collection in $obj3 (Usuario) $obj3->addTransaccion($obj1); } // if joined row is not null // Add objects for joined TipoTransaccion rows $key4 = TipoTransaccionPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = TipoTransaccionPeer::getInstanceFromPool($key4); if (!$obj4) { $cls = TipoTransaccionPeer::getOMClass(); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); TipoTransaccionPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (Transaccion) to the collection in $obj4 (TipoTransaccion) $obj4->addTransaccion($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }