public function getCurrentProductCategoryI18n() { if (!isset($this->current_i18n[$this->culture])) { $obj = ProductCategoryI18nPeer::retrieveByPK($this->getId(), $this->culture); if ($obj) { $this->setProductCategoryI18nForCulture($obj, $this->culture); } else { $this->setProductCategoryI18nForCulture(new ProductCategoryI18n(), $this->culture); $this->current_i18n[$this->culture]->setCulture($this->culture); } } return $this->current_i18n[$this->culture]; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ProductCategoryI18nPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setName($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setDescription($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setCulture($arr[$keys[3]]); } }
public static function retrieveByPK($id, $culture, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(ProductCategoryI18nPeer::ID, $id); $criteria->add(ProductCategoryI18nPeer::CULTURE, $culture); $v = ProductCategoryI18nPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }
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; }