本文整理汇总了PHP中QueryBuilder::getRefFKPhpNameAffix方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::getRefFKPhpNameAffix方法的具体用法?PHP QueryBuilder::getRefFKPhpNameAffix怎么用?PHP QueryBuilder::getRefFKPhpNameAffix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::getRefFKPhpNameAffix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: queryMethods
public function queryMethods(QueryBuilder $builder)
{
$foreignKey = $this->getI18nTable()->getBehavior('symfony_i18n_translation')->getForeignKey();
$join = in_array($this->getBuildProperty('propel.useLeftJoinsInDoJoinMethods'), array(true, null), true) ? 'LEFT' : 'INNER';
$localeColumn = $this->getI18nTable()->getBehavior('symfony_i18n_translation')->getCultureColumn()->getPhpName();
$queryClass = $builder->getStubQueryBuilder()->getClassname();
$i18nRelationName = $builder->getRefFKPhpNameAffix($foreignKey);
return <<<EOF
/**
* Adds a JOIN clause to the query using the i18n relation
*
* @param string \$culture Locale to use for the join condition, e.g. 'fr_FR'
* @param string \$relationAlias optional alias for the relation
* @param string \$joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return {$queryClass} The current query, for fluid interface
*/
public function joinI18n(\$culture = null, \$relationAlias = null, \$joinType = Criteria::{$join}_JOIN)
{
if (null === \$culture)
{
\$culture = sfPropel::getDefaultCulture();
}
\$relationName = \$relationAlias ? \$relationAlias : '{$i18nRelationName}';
return \$this
->join{$i18nRelationName}(\$relationAlias, \$joinType)
->addJoinCondition(\$relationName, \$relationName . '.{$localeColumn} = ?', \$culture);
}
/**
* Adds a JOIN clause to the query and hydrates the related I18n object.
* Shortcut for \$c->joinI18n(\$culture)->with()
*
* @param string \$culture Locale to use for the join condition, e.g. 'fr_FR'
* @param string \$joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return {$queryClass} The current query, for fluid interface
*/
public function joinWithI18n(\$culture = null, \$joinType = Criteria::{$join}_JOIN)
{
\$this
->joinI18n(\$culture, null, \$joinType)
->with('{$i18nRelationName}');
\$this->with['{$i18nRelationName}']->setIsWithOneToMany(false);
return \$this;
}
/**
* Use the I18n relation query object
*
* @see useQuery()
*
* @param string \$culture Locale to use for the join condition, e.g. 'fr_FR'
* @param string \$relationAlias optional alias for the relation
* @param string \$joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
*
* @return {$i18nRelationName}Query A secondary query class using the current class as primary query
*/
public function useI18nQuery(\$culture = null, \$relationAlias = null, \$joinType = Criteria::{$join}_JOIN)
{
return \$this
->joinI18n(\$culture, \$relationAlias, \$joinType)
->useQuery(\$relationAlias ? \$relationAlias : '{$i18nRelationName}', '{$i18nRelationName}Query');
}
EOF;
}
示例2: getUseI18nQueryMethod
/**
* Добавляем неймспейс к phpDoc-у
*
* @param \QueryBuilder $builder
*
* @return string
*/
protected function getUseI18nQueryMethod(\QueryBuilder $builder)
{
$currentTable = $this->getTable();
$db = $currentTable->getDatabase();
$i18nTableName = $currentTable->getName() . '_i18n';
$i18nTable = $db->getTable($i18nTableName);
if (!$i18nTable) {
$this->exceptionError('Table ' . $i18nTableName . ' not found');
}
foreach ($i18nTable->getForeignKeys() as $fk) {
if ($fk->getForeignTableName() == $currentTable->getName()) {
$foreignKey = $fk;
}
}
$script = '
/**
* Use the I18n relation query object
*
* @see useQuery()
*
* @param string $locale Locale to use for the join condition, e.g. \'fr_FR\'
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, \'left join\', \'right join\', \'inner join\'. Defaults to left join.
*
* @return \\' . $builder->getNewStubQueryBuilder($i18nTable)->getFullyQualifiedClassname() . ' A secondary query class using the current class as primary query
*/
public function useI18nQuery($locale = \'ru\', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinI18n($locale, $relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : \'' . $builder->getRefFKPhpNameAffix($foreignKey) . '\', \'\\' . $builder->getNewStubQueryBuilder($i18nTable)->getFullyQualifiedClassname() . '\');
}';
return $script;
}