public static function doSelectWithI18n(Criteria $c, $culture = null, $con = null) { if ($culture === null) { $culture = sfContext::getInstance()->getUser()->getCulture(); } if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } JobPeer::addSelectColumns($c); $startcol = JobPeer::NUM_COLUMNS - JobPeer::NUM_LAZY_LOAD_COLUMNS + 1; JobI18nPeer::addSelectColumns($c); $c->addJoin(JobPeer::ID, JobI18nPeer::ID); $c->add(JobI18nPeer::CULTURE, $culture); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = JobPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $obj1->setCulture($culture); $omClass = JobI18nPeer::getOMClass($rs, $startcol); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol); $obj1->setJobI18nForCulture($obj2, $culture); $obj2->setJob($obj1); $results[] = $obj1; } return $results; }
public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } JobI18nPeer::addSelectColumns($c); $startcol2 = JobI18nPeer::NUM_COLUMNS - JobI18nPeer::NUM_LAZY_LOAD_COLUMNS + 1; JobPeer::addSelectColumns($c); $startcol3 = $startcol2 + JobPeer::NUM_COLUMNS; $c->addJoin(JobI18nPeer::ID, JobPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = JobI18nPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = JobPeer::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->getJob(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addJobI18n($obj1); break; } } if ($newObject) { $obj2->initJobI18ns(); $obj2->addJobI18n($obj1); } $results[] = $obj1; } return $results; }
public function getJobI18ns($criteria = null, $con = null) { include_once 'lib/model/om/BaseJobI18nPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collJobI18ns === null) { if ($this->isNew()) { $this->collJobI18ns = array(); } else { $criteria->add(JobI18nPeer::ID, $this->getId()); JobI18nPeer::addSelectColumns($criteria); $this->collJobI18ns = JobI18nPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(JobI18nPeer::ID, $this->getId()); JobI18nPeer::addSelectColumns($criteria); if (!isset($this->lastJobI18nCriteria) || !$this->lastJobI18nCriteria->equals($criteria)) { $this->collJobI18ns = JobI18nPeer::doSelect($criteria, $con); } } } $this->lastJobI18nCriteria = $criteria; return $this->collJobI18ns; }