本文整理汇总了PHP中sfPropel::getDefaultCulture方法的典型用法代码示例。如果您正苦于以下问题:PHP sfPropel::getDefaultCulture方法的具体用法?PHP sfPropel::getDefaultCulture怎么用?PHP sfPropel::getDefaultCulture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfPropel
的用法示例。
在下文中一共展示了sfPropel::getDefaultCulture方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentMovieI18n
/**
* Returns the current translation.
*
* @return MovieI18n
*/
public function getCurrentMovieI18n($culture = null)
{
if (null === $culture) {
$culture = null === $this->culture ? sfPropel::getDefaultCulture() : $this->culture;
}
if (!isset($this->current_i18n[$culture])) {
$object = $this->isNew() ? null : MovieI18nPeer::retrieveByPK($this->getPrimaryKey(), $culture);
if ($object) {
$this->setMovieI18nForCulture($object, $culture);
} else {
$this->setMovieI18nForCulture(new MovieI18n(), $culture);
$this->current_i18n[$culture]->setCulture($culture);
}
}
return $this->current_i18n[$culture];
}
示例2: doSelectWithI18n
/**
* Selects a collection of {@link Product} objects with a {@link ProductI18n} translation populated.
*
* @param Criteria $criteria
* @param string $culture
* @param PropelPDO $con
* @param string $join_behavior
*
* @return array
*/
public static function doSelectWithI18n(Criteria $criteria, $culture = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
if (null === $culture) {
$culture = sfPropel::getDefaultCulture();
}
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
ProductPeer::addSelectColumns($criteria);
$startcol = ProductPeer::NUM_COLUMNS - ProductPeer::NUM_LAZY_LOAD_COLUMNS;
ProductI18nPeer::addSelectColumns($criteria);
$criteria->addJoin(ProductPeer::ID, ProductI18nPeer::ID, $join_behavior);
$criteria->add(ProductI18nPeer::CULTURE, $culture);
foreach (sfMixer::getCallables('BaseProduct:doSelectJoin:doSelectJoin') as $sf_hook) {
call_user_func($sf_hook, 'Product', $criteria, $con);
}
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = ProductPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = ProductPeer::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 = ProductPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
ProductPeer::addInstanceToPool($obj1, $key1);
}
// if $obj1 already loaded
$key2 = ProductI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) {
$obj2 = ProductI18nPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = ProductI18nPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
ProductI18nPeer::addInstanceToPool($obj2, $key2);
}
// if obj2 already loaded
$obj1->setTranslationForCulture($obj2, $culture);
}
// if joined row was not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
示例3: insert
protected function insert($connection = null)
{
if (!isset($connection)) {
$connection = QubitTransactionFilter::getConnection(QubitOaiHarvest::DATABASE_NAME);
}
$offset = 0;
foreach ($this->tables as $table) {
$criteria = new Criteria();
foreach ($table->getColumns() as $column) {
if (!array_key_exists($column->getPhpName(), $this->values)) {
if ('createdAt' == $column->getPhpName() || 'updatedAt' == $column->getPhpName()) {
$this->values[$column->getPhpName()] = new DateTime();
}
if ('sourceCulture' == $column->getPhpName()) {
$this->values['sourceCulture'] = sfPropel::getDefaultCulture();
}
}
if (array_key_exists($column->getPhpName(), $this->values)) {
if (null !== ($param = $this->param($column))) {
$criteria->add($column->getFullyQualifiedName(), $param);
}
}
$offset++;
}
if (null !== ($id = BasePeer::doInsert($criteria, $connection))) {
// Guess that the first primary key of the first table is auto
// incremented
if ($this->tables[0] == $table) {
$columns = $table->getPrimaryKeyColumns();
$this->values[$columns[0]->getPhpName()] = $this->keys[$columns[0]->getPhpName()] = $id;
}
}
}
return $this;
}
示例4: getCurrentaccessionI18n
public function getCurrentaccessionI18n(array $options = array())
{
if (!empty($options['sourceCulture'])) {
$options['culture'] = $this->sourceCulture;
}
if (!isset($options['culture'])) {
$options['culture'] = sfPropel::getDefaultCulture();
}
$accessionI18ns = $this->accessionI18ns->indexBy('culture');
if (!isset($accessionI18ns[$options['culture']])) {
$accessionI18ns[$options['culture']] = new QubitAccessionI18n();
}
return $accessionI18ns[$options['culture']];
}
示例5: getCurrentphysicalObjectI18n
public function getCurrentphysicalObjectI18n(array $options = array())
{
if (!empty($options['sourceCulture'])) {
$options['culture'] = $this->sourceCulture;
}
if (!isset($options['culture'])) {
$options['culture'] = sfPropel::getDefaultCulture();
}
$physicalObjectI18ns = $this->physicalObjectI18ns->indexBy('culture');
if (!isset($physicalObjectI18ns[$options['culture']])) {
$physicalObjectI18ns[$options['culture']] = new QubitPhysicalObjectI18n();
}
return $physicalObjectI18ns[$options['culture']];
}
示例6: doSelectWithI18n
public static function doSelectWithI18n(Criteria $c, $culture = null, $con = null)
{
if ($culture === null) {
$culture = sfPropel::getDefaultCulture();
}
foreach (sfMixer::getCallables('BaseFakeForumPeer:doSelectJoin:doSelectJoin') as $callable) {
call_user_func($callable, 'BaseFakeForumPeer', $c, $con);
}
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
FakeForumPeer::addSelectColumns($c);
$startcol = FakeForumPeer::NUM_COLUMNS - FakeForumPeer::NUM_LAZY_LOAD_COLUMNS + 1;
FakeForumI18nPeer::addSelectColumns($c);
$c->addJoin(FakeForumPeer::ID, FakeForumI18nPeer::ID);
$c->add(FakeForumI18nPeer::CULTURE, $culture);
$rs = BasePeer::doSelect($c, $con);
$results = array();
while ($rs->next()) {
$omClass = FakeForumPeer::getOMClass();
$cls = Propel::import($omClass);
$obj1 = new $cls();
$obj1->hydrate($rs);
$obj1->setCulture($culture);
$omClass = FakeForumI18nPeer::getOMClass($rs, $startcol);
$cls = Propel::import($omClass);
$obj2 = new $cls();
$obj2->hydrate($rs, $startcol);
$obj1->setFakeForumI18nForCulture($obj2, $culture);
$obj2->setFakeForum($obj1);
$results[] = $obj1;
}
return $results;
}
示例7: getCurrentMovieI18n
public function getCurrentMovieI18n($culture = null)
{
if (is_null($culture)) {
$culture = is_null($this->culture) ? sfPropel::getDefaultCulture() : $this->culture;
}
if (!isset($this->current_i18n[$culture])) {
$obj = MovieI18nPeer::retrieveByPK($this->getId(), $culture);
if ($obj) {
$this->setMovieI18nForCulture($obj, $culture);
} else {
$this->setMovieI18nForCulture(new MovieI18n(), $culture);
$this->current_i18n[$culture]->setCulture($culture);
}
}
return $this->current_i18n[$culture];
}
示例8: doSelectWithI18n
public static function doSelectWithI18n(Criteria $c, $culture = null, PropelPDO $con = null)
{
$c = clone $c;
if ($culture === null) {
$culture = sfPropel::getDefaultCulture();
}
foreach (sfMixer::getCallables('BaseProductPeer:doSelectJoin:doSelectJoin') as $callable) {
call_user_func($callable, 'BaseProductPeer', $c, $con);
}
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
ProductPeer::addSelectColumns($c);
$startcol = ProductPeer::NUM_COLUMNS - ProductPeer::NUM_LAZY_LOAD_COLUMNS;
ProductI18nPeer::addSelectColumns($c);
$c->addJoin(ProductPeer::ID, ProductI18nPeer::ID);
$c->add(ProductI18nPeer::CULTURE, $culture);
$stmt = BasePeer::doSelect($c, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$omClass = ProductPeer::getOMClass();
$cls = Propel::importClass($omClass);
$obj1 = new $cls();
$obj1->hydrate($row);
$obj1->setCulture($culture);
$omClass = ProductI18nPeer::getOMClass();
$cls = Propel::importClass($omClass);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
$obj1->setProductI18nForCulture($obj2, $culture);
$obj2->setProduct($obj1);
$results[] = $obj1;
}
return $results;
}
示例9: getCurrentstaticPageI18n
public function getCurrentstaticPageI18n(array $options = array())
{
if (!empty($options['sourceCulture'])) {
$options['culture'] = $this->sourceCulture;
}
if (!isset($options['culture'])) {
$options['culture'] = sfPropel::getDefaultCulture();
}
$staticPageI18ns = $this->staticPageI18ns->indexBy('culture');
if (!isset($staticPageI18ns[$options['culture']])) {
$staticPageI18ns[$options['culture']] = new QubitStaticPageI18n();
}
return $staticPageI18ns[$options['culture']];
}
示例10: isExistent
/**
* Determine if a property matching passed values already exists.
*
* @param integer $objectId foreign key to QubitObject::ID
* @param string $name name of property
* @param string $value value of property
* @param string $options array of optional parameters
* @return boolean true if QubitProperty exists
*/
public static function isExistent($objectId, $name, $value, $options = array())
{
$propertyExists = false;
$criteria = new Criteria();
$criteria->addJoin(QubitProperty::ID, QubitPropertyI18n::ID);
$criteria->add(QubitProperty::OBJECT_ID, $objectId);
$criteria->add(QubitProperty::NAME, $name);
$criteria->add(QubitPropertyI18n::VALUE, $value);
if (isset($options['culture'])) {
$criteria->add(QubitPropertyI18n::CULTURE, $options['culture']);
} else {
if (isset($options['sourceCulture'])) {
$criteria->add(QubitPropertyI18n::CULTURE, QubitProperty::SOURCE_CULTURE . ' = ' . QubitPropertyI18n::CULTURE, Criteria::CUSTOM);
} else {
$criteria->add(QubitPropertyI18n::CULTURE, sfPropel::getDefaultCulture());
}
}
if (isset($options['scope'])) {
$criteria->add(QubitProperty::SCOPE, $options['scope']);
}
// See if search returns a hit.
if (($property = QubitProperty::getOne($criteria)) !== null) {
$propertyExists = true;
}
return $propertyExists;
}
示例11: doSelectWithI18n
public static function doSelectWithI18n(Criteria $c, $culture = null, $con = null)
{
if ($culture === null) {
$culture = sfPropel::getDefaultCulture();
}
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
MoviePeer::addSelectColumns($c);
$startcol = MoviePeer::NUM_COLUMNS - MoviePeer::NUM_LAZY_LOAD_COLUMNS + 1;
MovieI18nPeer::addSelectColumns($c);
$c->addJoin(MoviePeer::ID, MovieI18nPeer::ID);
$c->add(MovieI18nPeer::CULTURE, $culture);
$rs = BasePeer::doSelect($c, $con);
$results = array();
while ($rs->next()) {
$omClass = MoviePeer::getOMClass();
$cls = Propel::import($omClass);
$obj1 = new $cls();
$obj1->hydrate($rs);
$obj1->setCulture($culture);
$omClass = MovieI18nPeer::getOMClass($rs, $startcol);
$cls = Propel::import($omClass);
$obj2 = new $cls();
$obj2->hydrate($rs, $startcol);
$obj1->setMovieI18nForCulture($obj2, $culture);
$obj2->setMovie($obj1);
$results[] = $obj1;
}
return $results;
}
示例12: getCurrentrepositoryI18n
public function getCurrentrepositoryI18n(array $options = array())
{
if (!empty($options['sourceCulture'])) {
$options['culture'] = $this->sourceCulture;
}
if (!isset($options['culture'])) {
$options['culture'] = sfPropel::getDefaultCulture();
}
$repositoryI18ns = $this->repositoryI18ns->indexBy('culture');
if (!isset($repositoryI18ns[$options['culture']])) {
$repositoryI18ns[$options['culture']] = new QubitRepositoryI18n();
}
return $repositoryI18ns[$options['culture']];
}