public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } ProductCategoryI18nPeer::addSelectColumns($c); $startcol2 = ProductCategoryI18nPeer::NUM_COLUMNS - ProductCategoryI18nPeer::NUM_LAZY_LOAD_COLUMNS + 1; ProductCategoryPeer::addSelectColumns($c); $startcol3 = $startcol2 + ProductCategoryPeer::NUM_COLUMNS; $c->addJoin(ProductCategoryI18nPeer::ID, ProductCategoryPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = ProductCategoryI18nPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = ProductCategoryPeer::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->getProductCategory(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addProductCategoryI18n($obj1); break; } } if ($newObject) { $obj2->initProductCategoryI18ns(); $obj2->addProductCategoryI18n($obj1); } $results[] = $obj1; } return $results; }
public function getProductCategoryI18ns($criteria = null, $con = null) { include_once 'lib/model/om/BaseProductCategoryI18nPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collProductCategoryI18ns === null) { if ($this->isNew()) { $this->collProductCategoryI18ns = array(); } else { $criteria->add(ProductCategoryI18nPeer::ID, $this->getId()); ProductCategoryI18nPeer::addSelectColumns($criteria); $this->collProductCategoryI18ns = ProductCategoryI18nPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(ProductCategoryI18nPeer::ID, $this->getId()); ProductCategoryI18nPeer::addSelectColumns($criteria); if (!isset($this->lastProductCategoryI18nCriteria) || !$this->lastProductCategoryI18nCriteria->equals($criteria)) { $this->collProductCategoryI18ns = ProductCategoryI18nPeer::doSelect($criteria, $con); } } } $this->lastProductCategoryI18nCriteria = $criteria; return $this->collProductCategoryI18ns; }
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); } ProductCategoryPeer::addSelectColumns($c); $startcol = ProductCategoryPeer::NUM_COLUMNS - ProductCategoryPeer::NUM_LAZY_LOAD_COLUMNS + 1; ProductCategoryI18nPeer::addSelectColumns($c); $c->addJoin(ProductCategoryPeer::ID, ProductCategoryI18nPeer::ID); $c->add(ProductCategoryI18nPeer::CULTURE, $culture); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = ProductCategoryPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $obj1->setCulture($culture); $omClass = ProductCategoryI18nPeer::getOMClass($rs, $startcol); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol); $obj1->setProductCategoryI18nForCulture($obj2, $culture); $obj2->setProductCategory($obj1); $results[] = $obj1; } return $results; }