当前位置: 首页>>代码示例>>PHP>>正文


PHP QueryBuilder::getRefFKPhpNameAffix方法代码示例

本文整理汇总了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;
    }
开发者ID:propelorm,项目名称:sfPropelORMPlugin,代码行数:69,代码来源:SfPropelBehaviorI18n.php

示例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;
    }
开发者ID:it-blaster,项目名称:translation-bundle,代码行数:42,代码来源:TranslationBehavior.php


注:本文中的QueryBuilder::getRefFKPhpNameAffix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。