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


PHP QueryBuilder::leftJoin方法代码示例

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


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

示例1: apply

 /**
  * {@inheritdoc}
  */
 public function apply($fromAlias, $fromIdentifier, $resourcePrefix, array $requesterIdentifiers, $mask, array $orX = [])
 {
     $this->queryBuilder->leftJoin($fromAlias, $this->getAclSchema()->getPermissionsTableName(), 'acl_p', 'acl_p.resource = ' . $this->connection->getDatabasePlatform()->getConcatExpression(':acl_prefix', $fromAlias . '.' . $fromIdentifier));
     $orX[] = 'acl_p.requester IN (:acl_identifiers) AND :acl_mask = (acl_p.mask & :acl_mask)';
     $this->queryBuilder->andWhere(implode(' OR ', $orX));
     $this->queryBuilder->setParameter('acl_prefix', $resourcePrefix, \PDO::PARAM_STR)->setParameter('acl_identifiers', $requesterIdentifiers, Connection::PARAM_STR_ARRAY)->setParameter('acl_mask', $mask, \PDO::PARAM_INT);
     return $this->queryBuilder;
 }
开发者ID:alexdpy,项目名称:acl,代码行数:11,代码来源:DoctrineDbalAclFilter.php

示例2: leftJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder

 /**
  * @test
  */
 public function leftJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder()
 {
     $this->connection->quoteIdentifier('fromAlias')->shouldBeCalled()->willReturnArgument(0);
     $this->connection->quoteIdentifier('join')->shouldBeCalled()->willReturnArgument(0);
     $this->connection->quoteIdentifier('alias')->shouldBeCalled()->willReturnArgument(0);
     $this->concreteQueryBuilder->leftJoin('fromAlias', 'join', 'alias', null)->shouldBeCalled()->willReturn($this->subject);
     $this->subject->leftJoin('fromAlias', 'join', 'alias');
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:11,代码来源:QueryBuilderTest.php

示例3: buildQuery

 /**
  * {@inheritdoc}
  */
 public function buildQuery(QueryBuilder $queryBuilder, array $values = [])
 {
     if (!array_key_exists($this->getName(), $values) || 0 === count($values[$this->getName()])) {
         return;
     }
     $certifications = $values[$this->getName()]->toArray();
     $certifications = array_map(function (Certification $item) {
         return $item->getId();
     }, $certifications);
     $queryBuilder->leftJoin('response', 'response_certification', 'response_certification', 'response.id = response_certification.response_id')->andWhere($queryBuilder->expr()->in('response_certification.certification_id', $certifications));
 }
开发者ID:Volyz,项目名称:barometre,代码行数:14,代码来源:CertificationFilter.php

示例4: rightJoin

 /**
  * {@inheritdoc}
  * @return NativeQueryBuilder
  */
 public function rightJoin($fromAlias, $join, $alias, $condition = null)
 {
     if ($condition !== NULL) {
         list($condition) = array_values(Helpers::separateParameters($this, array_slice(func_get_args(), 3)));
     }
     return parent::leftJoin($fromAlias, $this->addTableResultMapping($join, $alias, $fromAlias), $alias, $condition);
 }
开发者ID:peterkrejci,项目名称:music-collection,代码行数:11,代码来源:NativeQueryBuilder.php

示例5: addJoin

 /**
  * @inheritdoc
  */
 protected function addJoin(QueryBuilder $queryBuilder)
 {
     $queryBuilder->leftJoin('main', $this->getTableName(CategoryRepository::TABLE_NAME), 'c', 'main.category_id = c.id');
 }
开发者ID:acp3,项目名称:module-news,代码行数:7,代码来源:DataGridRepository.php

示例6: leftJoin

 /**
  * Creates and adds a left join to the query.
  *
  * <code>
  *     $qb = $conn->getQueryBuilder()
  *         ->select('u.name')
  *         ->from('users', 'u')
  *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
  * </code>
  *
  * @param string $fromAlias The alias that points to a from clause.
  * @param string $join The table name to join.
  * @param string $alias The alias of the join table.
  * @param string $condition The condition for the join.
  *
  * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
  */
 public function leftJoin($fromAlias, $join, $alias, $condition = null)
 {
     $this->queryBuilder->leftJoin($fromAlias, $this->getTableName($join), $alias, $condition);
     return $this;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:22,代码来源:QueryBuilder.php

示例7: addIpAddressLeftJoin

 /**
  * Add IP left join
  *
  * @param QueryBuilder $queryBuilder
  * @param              $prefix
  * @param string       $ipPrefix
  */
 public function addIpAddressLeftJoin(QueryBuilder &$queryBuilder, $prefix, $ipPrefix = 'i')
 {
     $queryBuilder->leftJoin($prefix, MAUTIC_TABLE_PREFIX . 'ip_addresses', $ipPrefix, 'i.id = ' . $prefix . '.ip_id');
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:11,代码来源:ReportGeneratorEvent.php

示例8: addProductStreamTranslationWithSuffix

 /**
  * @param QueryBuilder $query
  * @param string $suffix
  */
 private function addProductStreamTranslationWithSuffix(QueryBuilder $query, $suffix = '')
 {
     $selectSuffix = !empty($suffix) ? '_' . strtolower($suffix) : '';
     $query->leftJoin('stream', 's_core_translations', 'streamTranslation' . $suffix, 'streamTranslation' . $suffix . '.objecttype = :streamType AND
          streamTranslation' . $suffix . '.objectkey = stream.id AND
          streamTranslation' . $suffix . '.objectlanguage = :language' . $suffix);
     $query->addSelect(['streamTranslation' . $suffix . '.objectdata as __stream_translation' . $selectSuffix])->setParameter(':streamType', 'productStream');
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:12,代码来源:FieldHelper.php

示例9: sortUnsortedByDefault

 /**
  * Sort products for current category by passed sort type
  *
  * @param QueryBuilder $builder
  * @param integer $orderBy
  */
 private function sortUnsortedByDefault($builder, $orderBy)
 {
     switch ($orderBy) {
         case 1:
             $builder->addOrderBy('product.datum', 'DESC')->addOrderBy('product.changetime', 'DESC');
             break;
         case 2:
             $builder->leftJoin('product', 's_articles_top_seller_ro', 'topSeller', 'topSeller.article_id = product.id')->addOrderBy('topSeller.sales', 'DESC')->addOrderBy('topSeller.article_id', 'DESC');
             break;
         case 3:
             $builder->addSelect('MIN(ROUND(defaultPrice.price * priceVariant.minpurchase * 1, 2)) as cheapest_price')->leftJoin('product', 's_articles_prices', 'defaultPrice', 'defaultPrice.articleID = product.id')->innerJoin('defaultPrice', 's_articles_details', 'priceVariant', 'priceVariant.id = defaultPrice.articledetailsID')->addOrderBy('cheapest_price', 'ASC')->addOrderBy('product.id', 'DESC');
             break;
         case 4:
             $builder->addSelect('MIN(ROUND(defaultPrice.price * priceVariant.minpurchase * 1, 2)) as cheapest_price')->leftJoin('product', 's_articles_prices', 'defaultPrice', 'defaultPrice.articleID = product.id')->innerJoin('defaultPrice', 's_articles_details', 'priceVariant', 'priceVariant.id = defaultPrice.articledetailsID')->addOrderBy('cheapest_price', 'DESC')->addOrderBy('product.id', 'DESC');
             break;
         case 5:
             $builder->addOrderBy('product.name', 'ASC');
             break;
         case 6:
             $builder->addOrderBy('product.name', 'DESC');
             break;
         case 7:
             $builder->addSelect('(SUM(vote.points) / COUNT(vote.id)) as votes')->leftJoin('product', 's_articles_vote', 'vote', 'product.id = vote.articleID')->addOrderBy('votes', 'DESC')->addOrderBy('product.id', 'DESC')->groupBy('product.id');
             break;
         case 9:
             $builder->innerJoin('product', 's_articles_details', 'variant', 'variant.id = product.main_detail_id')->addOrderBy('variant.instock', 'ASC')->addOrderBy('product.id', 'DESC');
             break;
         case 10:
             $builder->innerJoin('product', 's_articles_details', 'variant', 'variant.id = product.main_detail_id')->addOrderBy('variant.instock', 'DESC')->addOrderBy('product.id', 'DESC');
             break;
     }
 }
开发者ID:zirkeldesign,项目名称:SwagCustomSort,代码行数:38,代码来源:CustomSortRepository.php

示例10: leftJoin

 /**
  * Creates and adds a left join to the query.
  *
  * @param string $fromAlias The alias that points to a from clause.
  * @param string $join      The table name to join.
  * @param string $alias     The alias of the join table.
  * @param string $condition The condition for the join.
  *
  * @return self
  */
 public function leftJoin($fromAlias, $join, $alias, $condition = null)
 {
     $this->qb->leftJoin($fromAlias, $join, $alias, $condition);
     return $this;
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:SqlQueryBuilder.php

示例11: addJoin

 /**
  * @inheritdoc
  */
 protected function addJoin(QueryBuilder $queryBuilder)
 {
     $queryBuilder->leftJoin('main', $this->getTableName(ModulesRepository::TABLE_NAME), 'm', 'main.module_id = m.id');
 }
开发者ID:acp3,项目名称:module-categories,代码行数:7,代码来源:DataGridRepository.php

示例12: leftJoin

 /**
  * Creates and adds a left join to the query.
  *
  * <code>
  *     $qb = $conn->getQueryBuilder()
  *         ->select('u.name')
  *         ->from('users', 'u')
  *         ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
  * </code>
  *
  * @param string $fromAlias The alias that points to a from clause.
  * @param string $join The table name to join.
  * @param string $alias The alias of the join table.
  * @param string $condition The condition for the join.
  *
  * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
  */
 public function leftJoin($fromAlias, $join, $alias, $condition = null)
 {
     $this->queryBuilder->leftJoin($fromAlias, $this->helper->quoteColumnName($join), $alias, $condition);
     return $this;
 }
开发者ID:henkRW,项目名称:core,代码行数:22,代码来源:querybuilder.php

示例13: select

 /**
  * Generate select field for a given table and column.
  *
  * @staticvar integer $index
  *
  * @param \Doctrine\DBAL\Query\QueryBuilder $qb
  * @param \Lokhman\Silex\ARM\Repository     $repository
  * @param string                            $alias
  * @param string                            $column
  *
  * @return string
  */
 private function select(QueryBuilder $qb, Repository $repository, $alias, $column)
 {
     if (!$this->translate || !$repository->getMetadata()->isTrans($column)) {
         return $alias . '.' . $column . ' ' . $repository->getTable() . self::UNIQUE . $column;
     }
     static $index = 0;
     $table = $repository->getTable();
     $t = $this->app['arm.trans'] . $index++;
     $qb->leftJoin($alias, $this->app['arm.trans'], $t, $t . '._table = ' . $this->expr()->literal($table) . ' AND ' . $t . '._key = ' . $alias . '.' . $repository->getMetadata()->getPrimary() . ' AND ' . $t . '._column = ' . $this->expr()->literal($column) . ' AND ' . $t . '._locale = ' . $this->expr()->literal($this->locale));
     return 'COALESCE(' . $t . '._content, ' . $alias . '.' . $column . ') ' . $table . self::UNIQUE . $column;
 }
开发者ID:lokhman,项目名称:silex-arm,代码行数:23,代码来源:Repository.php

示例14: addJoin

 /**
  * @inheritdoc
  */
 protected function addJoin(QueryBuilder $queryBuilder)
 {
     $queryBuilder->leftJoin('main', $this->getTableName(PictureRepository::TABLE_NAME), 'p', 'main.id = p.gallery_id');
 }
开发者ID:acp3,项目名称:cms,代码行数:7,代码来源:GalleryDataGridRepository.php


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