public function getNotas($ciclolectivo_id) { $notaAlumno = array(); $notaActividad = array(); // notas del alumno $criteria = new Criteria(); $criteria->add(BoletinActividadesPeer::FK_ALUMNO_ID, $this->getId()); $criteria->add(PeriodoPeer::CALCULAR, false); $criteria->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $ciclolectivo_id); $criteria->addJoin(BoletinActividadesPeer::FK_ESCALANOTA_ID, EscalanotaPeer::ID); $criteria->addJoin(BoletinActividadesPeer::FK_PERIODO_ID, PeriodoPeer::ID); $criteria->addAsColumn("boletinActividades_periodo_id", BoletinActividadesPeer::FK_PERIODO_ID); $criteria->addAsColumn("boletinActividades_actividad_id", BoletinActividadesPeer::FK_ACTIVIDAD_ID); $criteria->addAsColumn("escalanota_nombre", EscalanotaPeer::NOMBRE); $aBoletinActividades = BasePeer::doSelect($criteria); foreach ($aBoletinActividades as $boletinActividades) { $notaAlumno[$boletinActividades[0]][$boletinActividades[1]] = $boletinActividades[2]; $notaActividad[$boletinActividades[1]][$boletinActividades[0]] = $boletinActividades[2]; } $c = new Criteria(); $c->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $ciclolectivo_id); $c->add(PeriodoPeer::CALCULAR, true); $periodos = PeriodoPeer::doSelect($c); foreach ($notaActividad as $act_indice => &$act) { foreach ($periodos as $periodo) { //validar que esten ok if (trim($periodo->getFormula()) != '') { list($class_formula, $parametros) = explode('|', $periodo->getFormula()); $parametros = explode(',', $parametros); //if (array_intersect($parametros,array_keys($act)) == $parametros) { sfContext::getInstance()->getLogger()->debug("estan todo slo ids"); $class_formula = "formula_{$class_formula}"; require_once sfConfig::get('sf_lib_dir') . DIRECTORY_SEPARATOR . 'formulas' . DIRECTORY_SEPARATOR . $class_formula . ".class.php"; $formula = new $class_formula(); $notas_parametros = array(); foreach ($parametros as $parametro) { if (isset($act[$parametro])) { array_push($notas_parametros, sprintf("%01.2f", str_replace(",", ".", $act[$parametro]))); } else { array_push($notas_parametros, ''); } } $nota = $formula->calcular($notas_parametros); $notaAlumno[$periodo->getId()][$act_indice] = $nota; $act[$periodo->getId()] = $nota; //} //else { // sfContext::getInstance()->getLogger()->debug('faltan parametros para la formula'); //} } else { sfContext::getInstance()->getLogger()->debug('el periodo es calculable pero no tiene una formula cargada'); } } } return $notaAlumno; }
public function testDoSelect() { try { $c = new Criteria(); $c->add(BookPeer::ID, 12, ' BAD SQL'); BookPeer::addSelectColumns($c); BasePeer::doSelect($c); } catch (PropelException $e) { $this->assertContains('[SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id FROM `book` WHERE book.id BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message'); } }
public function testDoSelect() { try { $c = new Criteria(); $c->add(BookPeer::ID, 12, ' BAD SQL'); BookPeer::addSelectColumns($c); BasePeer::doSelect($c); } catch (PropelException $e) { $this->assertContains('[SELECT book.ID, book.TITLE, book.ISBN, book.PRICE, book.PUBLISHER_ID, book.AUTHOR_ID FROM `book` WHERE book.ID BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message'); } }
protected function getStatement(QubitQuery $leaf) { // HACK Tell the caller whether we sorted according to the leaf $sorted = false; if (!isset($this->statement)) { foreach ($leaf->getOrderByNames() as $name) { $this->criteria->addAscendingOrderByColumn(constant($this->className . '::' . strtoupper($name))); } $sorted = true; $this->statement = BasePeer::doSelect($this->criteria); } // TODO Determine whether the sort order matches the previous sort order return array($this->statement, $sorted); }
/** * Selects a collection of ExamCommentDig 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 ExamCommentDig 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('BaseExamCommentDigPeer:doSelectJoinAll:doSelectJoinAll') as $callable) { call_user_func($callable, 'BaseExamCommentDigPeer', $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); } ExamCommentDigPeer::addSelectColumns($c); $startcol2 = ExamCommentDigPeer::NUM_COLUMNS - ExamCommentDigPeer::NUM_LAZY_LOAD_COLUMNS; ExamCommentPeer::addSelectColumns($c); $startcol3 = $startcol2 + (ExamCommentPeer::NUM_COLUMNS - ExamCommentPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(ExamCommentDigPeer::COMMENT_ID), array(ExamCommentPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = ExamCommentDigPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = ExamCommentDigPeer::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 = ExamCommentDigPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); ExamCommentDigPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined ExamComment rows $key2 = ExamCommentPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = ExamCommentPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = ExamCommentPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); ExamCommentPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (ExamCommentDig) to the collection in $obj2 (ExamComment) $obj2->addExamCommentDig($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * 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) { $con = MetadataProfilePeer::alternativeCon($con); $criteria = MetadataProfilePeer::prepareCriteriaForSelect($criteria); // BasePeer returns a PDOStatement return BasePeer::doSelect($criteria, $con); }
/** * Selects a collection of NagiosMainConfiguration objects pre-filled with all related objects except NagiosCommandRelatedByGlobalHostEventHandler. * * @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 NagiosMainConfiguration objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptNagiosCommandRelatedByGlobalHostEventHandler(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); } NagiosMainConfigurationPeer::addSelectColumns($c); $startcol2 = NagiosMainConfigurationPeer::NUM_COLUMNS - NagiosMainConfigurationPeer::NUM_LAZY_LOAD_COLUMNS; $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = NagiosMainConfigurationPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = NagiosMainConfigurationPeer::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 = NagiosMainConfigurationPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); NagiosMainConfigurationPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of PcBlogComment objects pre-filled with all related objects except PcUser. * * @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 PcBlogComment objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptPcUser(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); } PcBlogCommentPeer::addSelectColumns($criteria); $startcol2 = PcBlogCommentPeer::NUM_COLUMNS - PcBlogCommentPeer::NUM_LAZY_LOAD_COLUMNS; PcBlogPostPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + (PcBlogPostPeer::NUM_COLUMNS - PcBlogPostPeer::NUM_LAZY_LOAD_COLUMNS); $criteria->addJoin(PcBlogCommentPeer::POST_ID, PcBlogPostPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BasePcBlogCommentPeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = PcBlogCommentPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = PcBlogCommentPeer::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 { $cls = PcBlogCommentPeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); PcBlogCommentPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined PcBlogPost rows $key2 = PcBlogPostPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = PcBlogPostPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = PcBlogPostPeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); PcBlogPostPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (PcBlogComment) to the collection in $obj2 (PcBlogPost) $obj2->addPcBlogComment($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * 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(ProveedorPeer::DATABASE_NAME, Propel::CONNECTION_READ); } if (!$criteria->hasSelectClause()) { $criteria = clone $criteria; ProveedorPeer::addSelectColumns($criteria); } // Set the correct dbName $criteria->setDbName(self::DATABASE_NAME); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseProveedorPeer', $criteria, $con); } // BasePeer returns a PDOStatement return BasePeer::doSelect($criteria, $con); }
/** * 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(SurveyGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); } if (!$criteria->hasSelectClause()) { $criteria = clone $criteria; SurveyGroupPeer::addSelectColumns($criteria); } // Set the correct dbName $criteria->setDbName(self::DATABASE_NAME); // BasePeer returns a PDOStatement return BasePeer::doSelect($criteria, $con); }
/** * Selects a collection of EleveRegimeDoublant 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 EleveRegimeDoublant 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); } EleveRegimeDoublantPeer::addSelectColumns($criteria); $startcol2 = EleveRegimeDoublantPeer::NUM_HYDRATE_COLUMNS; ElevePeer::addSelectColumns($criteria); $startcol3 = $startcol2 + ElevePeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(EleveRegimeDoublantPeer::LOGIN, ElevePeer::LOGIN, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = EleveRegimeDoublantPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = EleveRegimeDoublantPeer::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 = EleveRegimeDoublantPeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); EleveRegimeDoublantPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Eleve rows $key2 = ElevePeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = ElevePeer::getInstanceFromPool($key2); if (!$obj2) { $cls = ElevePeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); ElevePeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (EleveRegimeDoublant) to the collection in $obj2 (Eleve) $obj1->setEleve($obj2); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * * @param boolean $deep (optional) Whether to also de-associated any related objects. * @param PropelPDO $con (optional) The PropelPDO connection to use. * @return void * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ public function reload($deep = false, PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); } if ($this->isNew()) { throw new PropelException("Cannot reload an unsaved object."); } if ($con === null) { $con = Propel::getConnection(ScheduledTaskProfilePeer::DATABASE_NAME, Propel::CONNECTION_READ); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. ScheduledTaskProfilePeer::setUseCriteriaFilter(false); $criteria = $this->buildPkeyCriteria(); entryPeer::addSelectColumns($criteria); $stmt = BasePeer::doSelect($criteria, $con); ScheduledTaskProfilePeer::setUseCriteriaFilter(true); $row = $stmt->fetch(PDO::FETCH_NUM); $stmt->closeCursor(); if (!$row) { throw new PropelException('Cannot find matching row in the database to reload object values.'); } $this->hydrate($row, 0, true); // rehydrate if ($deep) { // also de-associate any related objects? } // if (deep) }
/** * 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. * * Since this table was configured to reload rows on insert, the object will * be reloaded from the database if an INSERT operation is performed (unless * the $skipReload parameter is TRUE). * * @param PropelPDO $con * @param boolean $skipReload Whether to skip the reload for this object from database. * @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, $skipReload = false) { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(kshowPeer::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 || !$this->isModified()) { $con->commit(); return 0; } for ($retries = 1; $retries < KalturaPDO::SAVE_MAX_RETRIES; $retries++) { $affectedRows = $this->doSave($con); if ($affectedRows || !$this->isColumnModified(kshowPeer::CUSTOM_DATA)) { //ask if custom_data wasn't modified to avoid retry with atomic column break; } KalturaLog::debug("was unable to save! retrying for the {$retries} time"); $criteria = $this->buildPkeyCriteria(); $criteria->addSelectColumn(kshowPeer::CUSTOM_DATA); $stmt = BasePeer::doSelect($criteria, $con); $cutsomDataArr = $stmt->fetchAll(PDO::FETCH_COLUMN); $newCustomData = $cutsomDataArr[0]; $this->custom_data_md5 = is_null($newCustomData) ? null : md5($newCustomData); $valuesToChangeTo = $this->m_custom_data->toArray(); $this->m_custom_data = myCustomData::fromString($newCustomData); //set custom data column values we wanted to change to $validUpdate = true; $atomicCustomDataFields = kshowPeer::getAtomicCustomDataFields(); foreach ($this->oldCustomDataValues as $namespace => $namespaceValues) { foreach ($namespaceValues as $name => $oldValue) { $atomicField = false; if ($namespace) { $atomicField = array_key_exists($namespace, $atomicCustomDataFields) && in_array($name, $atomicCustomDataFields[$namespace]); } else { $atomicField = in_array($name, $atomicCustomDataFields); } if ($atomicField) { $dbValue = $this->m_custom_data->get($name, $namespace); if ($oldValue != $dbValue) { $validUpdate = false; break; } } $newValue = null; if ($namespace) { if (isset($valuesToChangeTo[$namespace][$name])) { $newValue = $valuesToChangeTo[$namespace][$name]; } } else { $newValue = $valuesToChangeTo[$name]; } if (is_null($newValue)) { $this->removeFromCustomData($name, $namespace); } else { $this->putInCustomData($name, $newValue, $namespace); } } } if (!$validUpdate) { break; } $this->setCustomData($this->m_custom_data->toString()); } if ($isInsert) { $this->postInsert($con); } else { $this->postUpdate($con); } $this->postSave($con); kshowPeer::addInstanceToPool($this); $con->commit(); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } }
public static function doSelectJoinAllExceptBankAccount(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VAcademicCostTaPeer::addSelectColumns($c); $startcol2 = VAcademicCostTaPeer::NUM_COLUMNS - VAcademicCostTaPeer::NUM_LAZY_LOAD_COLUMNS + 1; AcademicCalendarPeer::addSelectColumns($c); $startcol3 = $startcol2 + AcademicCalendarPeer::NUM_COLUMNS; AcademicCostComponentPeer::addSelectColumns($c); $startcol4 = $startcol3 + AcademicCostComponentPeer::NUM_COLUMNS; AcademicProcessPeer::addSelectColumns($c); $startcol5 = $startcol4 + AcademicProcessPeer::NUM_COLUMNS; $c->addJoin(VAcademicCostTaPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addJoin(VAcademicCostTaPeer::ACADEMIC_COST_COMPONENT_ID, AcademicCostComponentPeer::ID); $c->addJoin(VAcademicCostTaPeer::ACADEMIC_PROCESS_ID, AcademicProcessPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VAcademicCostTaPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = AcademicCalendarPeer::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->getAcademicCalendar(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addVAcademicCostTa($obj1); break; } } if ($newObject) { $obj2->initVAcademicCostTas(); $obj2->addVAcademicCostTa($obj1); } $omClass = AcademicCostComponentPeer::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->getAcademicCostComponent(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addVAcademicCostTa($obj1); break; } } if ($newObject) { $obj3->initVAcademicCostTas(); $obj3->addVAcademicCostTa($obj1); } $omClass = AcademicProcessPeer::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->getAcademicProcess(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addVAcademicCostTa($obj1); break; } } if ($newObject) { $obj4->initVAcademicCostTas(); $obj4->addVAcademicCostTa($obj1); } $results[] = $obj1; } return $results; }
/** * Selects a collection of NagiosEscalation objects pre-filled with all related objects except NagiosTimeperiod. * * @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 NagiosEscalation objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptNagiosTimeperiod(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); } NagiosEscalationPeer::addSelectColumns($c); $startcol2 = NagiosEscalationPeer::NUM_COLUMNS - NagiosEscalationPeer::NUM_LAZY_LOAD_COLUMNS; NagiosHostTemplatePeer::addSelectColumns($c); $startcol3 = $startcol2 + (NagiosHostTemplatePeer::NUM_COLUMNS - NagiosHostTemplatePeer::NUM_LAZY_LOAD_COLUMNS); NagiosHostPeer::addSelectColumns($c); $startcol4 = $startcol3 + (NagiosHostPeer::NUM_COLUMNS - NagiosHostPeer::NUM_LAZY_LOAD_COLUMNS); NagiosServiceTemplatePeer::addSelectColumns($c); $startcol5 = $startcol4 + (NagiosServiceTemplatePeer::NUM_COLUMNS - NagiosServiceTemplatePeer::NUM_LAZY_LOAD_COLUMNS); NagiosServicePeer::addSelectColumns($c); $startcol6 = $startcol5 + (NagiosServicePeer::NUM_COLUMNS - NagiosServicePeer::NUM_LAZY_LOAD_COLUMNS); NagiosHostgroupPeer::addSelectColumns($c); $startcol7 = $startcol6 + (NagiosHostgroupPeer::NUM_COLUMNS - NagiosHostgroupPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(NagiosEscalationPeer::HOST_TEMPLATE), array(NagiosHostTemplatePeer::ID), $join_behavior); $c->addJoin(array(NagiosEscalationPeer::HOST), array(NagiosHostPeer::ID), $join_behavior); $c->addJoin(array(NagiosEscalationPeer::SERVICE_TEMPLATE), array(NagiosServiceTemplatePeer::ID), $join_behavior); $c->addJoin(array(NagiosEscalationPeer::SERVICE), array(NagiosServicePeer::ID), $join_behavior); $c->addJoin(array(NagiosEscalationPeer::HOSTGROUP), array(NagiosHostgroupPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = NagiosEscalationPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = NagiosEscalationPeer::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 = NagiosEscalationPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); NagiosEscalationPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined NagiosHostTemplate rows $key2 = NagiosHostTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = NagiosHostTemplatePeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = NagiosHostTemplatePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); NagiosHostTemplatePeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (NagiosEscalation) to the collection in $obj2 (NagiosHostTemplate) $obj2->addNagiosEscalation($obj1); } // if joined row is not null // Add objects for joined NagiosHost rows $key3 = NagiosHostPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = NagiosHostPeer::getInstanceFromPool($key3); if (!$obj3) { $omClass = NagiosHostPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); NagiosHostPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (NagiosEscalation) to the collection in $obj3 (NagiosHost) $obj3->addNagiosEscalation($obj1); } // if joined row is not null // Add objects for joined NagiosServiceTemplate rows $key4 = NagiosServiceTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = NagiosServiceTemplatePeer::getInstanceFromPool($key4); if (!$obj4) { $omClass = NagiosServiceTemplatePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); NagiosServiceTemplatePeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (NagiosEscalation) to the collection in $obj4 (NagiosServiceTemplate) $obj4->addNagiosEscalation($obj1); } // if joined row is not null // Add objects for joined NagiosService rows $key5 = NagiosServicePeer::getPrimaryKeyHashFromRow($row, $startcol5); if ($key5 !== null) { $obj5 = NagiosServicePeer::getInstanceFromPool($key5); if (!$obj5) { $omClass = NagiosServicePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj5 = new $cls(); $obj5->hydrate($row, $startcol5); NagiosServicePeer::addInstanceToPool($obj5, $key5); } // if $obj5 already loaded // Add the $obj1 (NagiosEscalation) to the collection in $obj5 (NagiosService) $obj5->addNagiosEscalation($obj1); } // if joined row is not null // Add objects for joined NagiosHostgroup rows $key6 = NagiosHostgroupPeer::getPrimaryKeyHashFromRow($row, $startcol6); if ($key6 !== null) { $obj6 = NagiosHostgroupPeer::getInstanceFromPool($key6); if (!$obj6) { $omClass = NagiosHostgroupPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj6 = new $cls(); $obj6->hydrate($row, $startcol6); NagiosHostgroupPeer::addInstanceToPool($obj6, $key6); } // if $obj6 already loaded // Add the $obj1 (NagiosEscalation) to the collection in $obj6 (NagiosHostgroup) $obj6->addNagiosEscalation($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Selects a collection of Module objects pre-filled with all related objects except ModuleHook. * * @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 Module objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptModuleHook(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); } ModulePeer::addSelectColumns($c); $startcol2 = ModulePeer::NUM_COLUMNS - ModulePeer::NUM_LAZY_LOAD_COLUMNS; AddOnPeer::addSelectColumns($c); $startcol3 = $startcol2 + (AddOnPeer::NUM_COLUMNS - AddOnPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(ModulePeer::ADD_ON), array(AddOnPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = ModulePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = ModulePeer::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 = ModulePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); ModulePeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined AddOn rows $key2 = AddOnPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = AddOnPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = AddOnPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); AddOnPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Module) to the collection in $obj2 (AddOn) $obj2->addModule($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public static function doSelectJoinAllExceptDepartment(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } GradeComponentPeer::addSelectColumns($c); $startcol2 = GradeComponentPeer::NUM_COLUMNS - GradeComponentPeer::NUM_LAZY_LOAD_COLUMNS + 1; GradeSpecPeer::addSelectColumns($c); $startcol3 = $startcol2 + GradeSpecPeer::NUM_COLUMNS; $c->addJoin(GradeComponentPeer::GRADE_SPEC_ID, GradeSpecPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = GradeComponentPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = GradeSpecPeer::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->getGradeSpec(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addGradeComponent($obj1); break; } } if ($newObject) { $obj2->initGradeComponents(); $obj2->addGradeComponent($obj1); } $results[] = $obj1; } return $results; }
/** * Selects a collection of Job objects pre-filled with all related objects except Chart. * * @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 Job objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptChart(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(JobPeer::DATABASE_NAME); } JobPeer::addSelectColumns($criteria); $startcol2 = JobPeer::NUM_HYDRATE_COLUMNS; UserPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + UserPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(JobPeer::USER_ID, UserPeer::ID, $join_behavior); $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = JobPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = JobPeer::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 = JobPeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); JobPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined User rows $key2 = UserPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = UserPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = UserPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); UserPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Job) to the collection in $obj2 (User) $obj2->addJob($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public static function doSelectJoinAllExceptCampus(Criteria $c, $con = null) { foreach (sfMixer::getCallables('BaseProjectApplicationPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) { call_user_func($callable, 'BaseProjectApplicationPeer', $c, $con); } $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } ProjectApplicationPeer::addSelectColumns($c); $startcol2 = ProjectApplicationPeer::NUM_COLUMNS - ProjectApplicationPeer::NUM_LAZY_LOAD_COLUMNS + 1; sfGuardUserPeer::addSelectColumns($c); $startcol3 = $startcol2 + sfGuardUserPeer::NUM_COLUMNS; sfGuardUserPeer::addSelectColumns($c); $startcol4 = $startcol3 + sfGuardUserPeer::NUM_COLUMNS; DepartmentPeer::addSelectColumns($c); $startcol5 = $startcol4 + DepartmentPeer::NUM_COLUMNS; $c->addJoin(ProjectApplicationPeer::CREATED_BY, sfGuardUserPeer::ID); $c->addJoin(ProjectApplicationPeer::OWNER_ID, sfGuardUserPeer::ID); $c->addJoin(ProjectApplicationPeer::DEPARTMENT_ID, DepartmentPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = ProjectApplicationPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = sfGuardUserPeer::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->getsfGuardUserRelatedByCreatedBy(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addProjectApplicationRelatedByCreatedBy($obj1); break; } } if ($newObject) { $obj2->initProjectApplicationsRelatedByCreatedBy(); $obj2->addProjectApplicationRelatedByCreatedBy($obj1); } $omClass = sfGuardUserPeer::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->getsfGuardUserRelatedByOwnerId(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addProjectApplicationRelatedByOwnerId($obj1); break; } } if ($newObject) { $obj3->initProjectApplicationsRelatedByOwnerId(); $obj3->addProjectApplicationRelatedByOwnerId($obj1); } $omClass = DepartmentPeer::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->getDepartment(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addProjectApplication($obj1); break; } } if ($newObject) { $obj4->initProjectApplications(); $obj4->addProjectApplication($obj1); } $results[] = $obj1; } return $results; }
/** * Selects a collection of Subscriber objects pre-filled with all related objects except UserRelatedByUpdatedBy. * * @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 Subscriber objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptUserRelatedByUpdatedBy(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(SubscriberPeer::DATABASE_NAME); } SubscriberPeer::addSelectColumns($criteria); $startcol2 = SubscriberPeer::NUM_HYDRATE_COLUMNS; $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = SubscriberPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = SubscriberPeer::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 = SubscriberPeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); SubscriberPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * 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) { foreach (sfMixer::getCallables('BaseRolePeer:doSelectStmt:doSelectStmt') as $callable) { call_user_func($callable, 'BaseRolePeer', $criteria, $con); } if ($con === null) { $con = Propel::getConnection(RolePeer::DATABASE_NAME, Propel::CONNECTION_READ); } if (!$criteria->hasSelectClause()) { $criteria = clone $criteria; RolePeer::addSelectColumns($criteria); } // Set the correct dbName $criteria->setDbName(self::DATABASE_NAME); // BasePeer returns a PDOStatement return BasePeer::doSelect($criteria, $con); }
protected function rowOffsetGet($name, $offset, $options) { if (empty($options['clean']) && array_key_exists($name, $this->values)) { return $this->values[$name]; } if (array_key_exists($name, $this->keys)) { return $this->keys[$name]; } if (!array_key_exists($offset, $this->row)) { if ($this->new) { return; } if (!isset($options['connection'])) { $options['connection'] = Propel::getConnection(QubitOaiHarvest::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(QubitOaiHarvest::ID, $this->id); call_user_func(array(get_class($this), 'addSelectColumns'), $criteria); $statement = BasePeer::doSelect($criteria, $options['connection']); $this->row = $statement->fetch(); } return $this->row[$offset]; }
public static function doSelectJoinAll(Criteria $c, $con = null) { foreach (sfMixer::getCallables('BasenahoWikiPagePeer:doSelectJoinAll:doSelectJoinAll') as $callable) { call_user_func($callable, 'BasenahoWikiPagePeer', $c, $con); } $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } nahoWikiPagePeer::addSelectColumns($c); $startcol2 = nahoWikiPagePeer::NUM_COLUMNS - nahoWikiPagePeer::NUM_LAZY_LOAD_COLUMNS + 1; nahoWikiWikiPeer::addSelectColumns($c); $startcol3 = $startcol2 + nahoWikiWikiPeer::NUM_COLUMNS; $c->addJoin(nahoWikiPagePeer::WIKI_ID, nahoWikiWikiPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = nahoWikiPagePeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = nahoWikiWikiPeer::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->getnahoWikiWiki(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addnahoWikiPage($obj1); break; } } if ($newObject) { $obj2->initnahoWikiPages(); $obj2->addnahoWikiPage($obj1); } $results[] = $obj1; } return $results; }
/** * 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) { $con = PermissionPeer::alternativeCon($con); if ($criteria->hasSelectClause()) { $asColumns = $criteria->getAsColumns(); if (count($asColumns) == 1 && isset($asColumns['_score'])) { $criteria = clone $criteria; PermissionPeer::addSelectColumns($criteria); } } else { $criteria = clone $criteria; PermissionPeer::addSelectColumns($criteria); } // Set the correct dbName $criteria->setDbName(self::DATABASE_NAME); // attach default criteria PermissionPeer::attachCriteriaFilter($criteria); // BasePeer returns a PDOStatement return BasePeer::doSelect($criteria, $con); }
/** * Selects a collection of AbsenceEleveTraitement objects pre-filled with all related objects except ModifieParUtilisateur. * * @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 AbsenceEleveTraitement objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptModifieParUtilisateur(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); } AbsenceEleveTraitementPeer::addSelectColumns($criteria); $startcol2 = AbsenceEleveTraitementPeer::NUM_HYDRATE_COLUMNS; AbsenceEleveTypePeer::addSelectColumns($criteria); $startcol3 = $startcol2 + AbsenceEleveTypePeer::NUM_HYDRATE_COLUMNS; AbsenceEleveMotifPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + AbsenceEleveMotifPeer::NUM_HYDRATE_COLUMNS; AbsenceEleveJustificationPeer::addSelectColumns($criteria); $startcol5 = $startcol4 + AbsenceEleveJustificationPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(AbsenceEleveTraitementPeer::A_TYPE_ID, AbsenceEleveTypePeer::ID, $join_behavior); $criteria->addJoin(AbsenceEleveTraitementPeer::A_MOTIF_ID, AbsenceEleveMotifPeer::ID, $join_behavior); $criteria->addJoin(AbsenceEleveTraitementPeer::A_JUSTIFICATION_ID, AbsenceEleveJustificationPeer::ID, $join_behavior); // soft_delete behavior if (AbsenceEleveTraitementQuery::isSoftDeleteEnabled()) { $criteria->add(AbsenceEleveTraitementPeer::DELETED_AT, null, Criteria::ISNULL); } else { AbsenceEleveTraitementPeer::enableSoftDelete(); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = AbsenceEleveTraitementPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = AbsenceEleveTraitementPeer::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 = AbsenceEleveTraitementPeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); AbsenceEleveTraitementPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined AbsenceEleveType rows $key2 = AbsenceEleveTypePeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = AbsenceEleveTypePeer::getInstanceFromPool($key2); if (!$obj2) { $cls = AbsenceEleveTypePeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); AbsenceEleveTypePeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (AbsenceEleveTraitement) to the collection in $obj2 (AbsenceEleveType) $obj2->addAbsenceEleveTraitement($obj1); } // if joined row is not null // Add objects for joined AbsenceEleveMotif rows $key3 = AbsenceEleveMotifPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = AbsenceEleveMotifPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = AbsenceEleveMotifPeer::getOMClass(false); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); AbsenceEleveMotifPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (AbsenceEleveTraitement) to the collection in $obj3 (AbsenceEleveMotif) $obj3->addAbsenceEleveTraitement($obj1); } // if joined row is not null // Add objects for joined AbsenceEleveJustification rows $key4 = AbsenceEleveJustificationPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = AbsenceEleveJustificationPeer::getInstanceFromPool($key4); if (!$obj4) { $cls = AbsenceEleveJustificationPeer::getOMClass(false); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); AbsenceEleveJustificationPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (AbsenceEleveTraitement) to the collection in $obj4 (AbsenceEleveJustification) $obj4->addAbsenceEleveTraitement($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(TipodocentePeer::DATABASE_NAME, Propel::CONNECTION_READ); } if (!$criteria->hasSelectClause()) { $criteria = clone $criteria; TipodocentePeer::addSelectColumns($criteria); } $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doSelect($criteria, $con); }
/** * Prepares the Criteria object and uses the parent doSelect() * method to get a ResultSet. * * Use this method directly if you want to just get the resultset * (instead of an array of objects). * * @param Criteria $criteria The Criteria object used to build the SELECT statement. * @param Connection $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. * @return ResultSet The resultset object with numerically-indexed fields. * @see BasePeer::doSelect() */ public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } if (!$criteria->getSelectColumns()) { $criteria = clone $criteria; BpmnProjectPeer::addSelectColumns($criteria); } // Set the correct dbName $criteria->setDbName(self::DATABASE_NAME); // BasePeer returns a Creole ResultSet, set to return // rows indexed numerically. return BasePeer::doSelect($criteria, $con); }
public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } SmCheckPeer::addSelectColumns($c); $startcol2 = SmCheckPeer::NUM_COLUMNS - SmCheckPeer::NUM_LAZY_LOAD_COLUMNS + 1; SmTemplatePeer::addSelectColumns($c); $startcol3 = $startcol2 + SmTemplatePeer::NUM_COLUMNS; $c->addJoin(SmCheckPeer::SM_TEMPLATE_ID, SmTemplatePeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = SmCheckPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = SmTemplatePeer::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->getSmTemplate(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addSmCheck($obj1); break; } } if ($newObject) { $obj2->initSmChecks(); $obj2->addSmCheck($obj1); } $results[] = $obj1; } return $results; }
public static function doSelectRS(Criteria $criteria, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } if (!$criteria->getSelectColumns()) { $criteria = clone $criteria; LorfieldsPeer::addSelectColumns($criteria); } $criteria->setDbName(self::DATABASE_NAME); return BasePeer::doSelect($criteria, $con); }
/** * Selects a collection of Member objects pre-filled with all related objects except MemberRelatedByMasterMemberId. * * @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 Member objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptMemberRelatedByMasterMemberId(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); } MemberPeer::addSelectColumns($c); $startcol2 = MemberPeer::NUM_COLUMNS - MemberPeer::NUM_LAZY_LOAD_COLUMNS; PersonPeer::addSelectColumns($c); $startcol3 = $startcol2 + (PersonPeer::NUM_COLUMNS - PersonPeer::NUM_LAZY_LOAD_COLUMNS); WingPeer::addSelectColumns($c); $startcol4 = $startcol3 + (WingPeer::NUM_COLUMNS - WingPeer::NUM_LAZY_LOAD_COLUMNS); MemberClassPeer::addSelectColumns($c); $startcol5 = $startcol4 + (MemberClassPeer::NUM_COLUMNS - MemberClassPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(MemberPeer::PERSON_ID), array(PersonPeer::ID), $join_behavior); $c->addJoin(array(MemberPeer::WING_ID), array(WingPeer::ID), $join_behavior); $c->addJoin(array(MemberPeer::MEMBER_CLASS_ID), array(MemberClassPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = MemberPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = MemberPeer::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 = MemberPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); MemberPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Person rows $key2 = PersonPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = PersonPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = PersonPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); PersonPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Member) to the collection in $obj2 (Person) $obj2->addMember($obj1); } // if joined row is not null // Add objects for joined Wing rows $key3 = WingPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = WingPeer::getInstanceFromPool($key3); if (!$obj3) { $omClass = WingPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); WingPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Member) to the collection in $obj3 (Wing) $obj3->addMember($obj1); } // if joined row is not null // Add objects for joined MemberClass rows $key4 = MemberClassPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = MemberClassPeer::getInstanceFromPool($key4); if (!$obj4) { $omClass = MemberClassPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); MemberClassPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (Member) to the collection in $obj4 (MemberClass) $obj4->addMember($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }