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


PHP QueryBuilder::innerJoin方法代码示例

本文整理汇总了PHP中QueryBuilder::innerJoin方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::innerJoin方法的具体用法?PHP QueryBuilder::innerJoin怎么用?PHP QueryBuilder::innerJoin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryBuilder的用法示例。


在下文中一共展示了QueryBuilder::innerJoin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filterByTranslation

 /**
  * Create filters according to any translation criteria OR argument.
  *
  * @param array        $criteria
  * @param QueryBuilder $qb
  * @param Translation  $translation
  */
 protected function filterByTranslation(&$criteria, &$qb, &$translation = null)
 {
     if (isset($criteria['translation']) || isset($criteria['translation.locale']) || isset($criteria['translation.id'])) {
         $qb->innerJoin('d.documentTranslations', 'dt');
         $qb->innerJoin('dt.translation', 't');
     } else {
         if (null !== $translation) {
             /*
              * With a given translation
              */
             $qb->innerJoin('d.documentTranslations', 'dt', 'WITH', 'dt.translation = :translation');
         } else {
             /*
              * With a null translation, just take the default one.
              */
             $qb->innerJoin('d.documentTranslations', 'dt');
             $qb->innerJoin('dt.translation', 't', 'WITH', 't.defaultTranslation = true');
         }
     }
 }
开发者ID:justinpocta,项目名称:roadiz,代码行数:27,代码来源:DocumentRepository.php

示例2: filterByCriteria

 /**
  * Reimplementing findBy features… with extra things.
  *
  * * key => array('<=', $value)
  * * key => array('<', $value)
  * * key => array('>=', $value)
  * * key => array('>', $value)
  * * key => array('BETWEEN', $value, $value)
  * * key => array('LIKE', $value)
  * * key => array('NOT IN', $array)
  * * key => 'NOT NULL'
  *
  * You even can filter with node fields, examples:
  *
  * * `node.published => true`
  * * `node.nodeName => 'page1'`
  *
  * @param array        $criteria
  * @param QueryBuilder $qb
  * @param boolean $joinedNode
  * @param boolean $joinedNodeType
  */
 protected function filterByCriteria(&$criteria, &$qb, &$joinedNode = false, &$joinedNodeType = false)
 {
     /*
      * Reimplementing findBy features…
      */
     foreach ($criteria as $key => $value) {
         if ($key == "tags" || $key == "tagExclusive") {
             continue;
         }
         /*
          * compute prefix for
          * filtering node relation fields
          */
         $prefix = 'ns.';
         // Dots are forbidden in field definitions
         $baseKey = str_replace('.', '_', $key);
         if (false !== strpos($key, 'node.nodeType.')) {
             if (!$joinedNode) {
                 $qb->innerJoin('ns.node', 'n');
                 $joinedNode = true;
             }
             if (!$joinedNodeType) {
                 $qb->innerJoin('n.nodeType', 'nt');
                 $joinedNodeType = true;
             }
             $prefix = 'nt.';
             $key = str_replace('node.nodeType.', '', $key);
         }
         if (false !== strpos($key, 'node.')) {
             if (!$joinedNode) {
                 $qb->innerJoin('ns.node', 'n');
                 $joinedNode = true;
             }
             $prefix = 'n.';
             $key = str_replace('node.', '', $key);
         }
         $qb->andWhere($this->buildComparison($value, $prefix, $key, $baseKey, $qb));
     }
 }
开发者ID:vasezhen,项目名称:roadiz,代码行数:61,代码来源:NodesSourcesRepository.php

示例3: filterByTranslation

 /**
  * Create filters according to any translation criteria OR argument.
  *
  * @param array        $criteria
  * @param QueryBuilder $qb
  * @param Translation  $translation
  */
 protected function filterByTranslation(&$criteria, &$qb, &$translation = null)
 {
     if (isset($criteria['translation']) || isset($criteria['translation.locale']) || isset($criteria['translation.id']) || isset($criteria['translation.available'])) {
         $qb->innerJoin('n.nodeSources', 'ns');
         $qb->innerJoin('ns.translation', 't');
     } else {
         if (null !== $translation) {
             /*
              * With a given translation
              */
             $qb->innerJoin('n.nodeSources', 'ns', 'WITH', 'ns.translation = :translation');
         } else {
             /*
              * With a null translation, not filter by translation to enable
              * nodes with only one translation which is not the default one.
              */
             $qb->innerJoin('n.nodeSources', 'ns');
         }
     }
 }
开发者ID:QuangDang212,项目名称:roadiz,代码行数:27,代码来源:NodeRepository.php


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