本文整理汇总了PHP中BasePeer::doSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP BasePeer::doSelect方法的具体用法?PHP BasePeer::doSelect怎么用?PHP BasePeer::doSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasePeer
的用法示例。
在下文中一共展示了BasePeer::doSelect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNotas
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;
}
示例2: testDoSelect
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');
}
}
示例3: getStatement
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);
}
示例4: doSelectJoinAll
/**
* 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;
}
示例5: doSelectStmt
/**
* 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);
}
示例6: doSelectJoinAllExceptNagiosCommandRelatedByGlobalHostEventHandler
/**
* 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;
}
示例7: doSelectJoinAllExceptPcUser
/**
* 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;
}
示例8: doSelectStmt
/**
* 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);
}
示例9: doSelectStmt
/**
* 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);
}
示例10: doSelectJoinAll
/**
* 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;
}
示例11: reload
/**
* 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)
}
示例12: save
/**
* 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();
//.........这里部分代码省略.........
示例13: doSelectJoinAllExceptBankAccount
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;
}
示例14: doSelectJoinAllExceptNagiosTimeperiod
/**
* 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
//.........这里部分代码省略.........
示例15: doSelectJoinAllExceptModuleHook
/**
* 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;
}