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


PHP QueryBuilder::join方法代码示例

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


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

示例1: applyFilters

 /**
  * Apply where filters to the query
  *
  * @param  QueryBuilder $query
  * @param  array        $filters
  */
 public function applyFilters(&$query, $filters)
 {
     if ($filters && is_array($filters)) {
         foreach ($filters as $column => $value) {
             $valId = $column . '_val';
             // Special case: Lead list filter
             if ($column === 'leadlist_id') {
                 $query->join('t', MAUTIC_TABLE_PREFIX . 'lead_lists_leads', 'lll', 'lll.lead_id = ' . $value['list_column_name']);
                 $query->andWhere('lll.leadlist_id = :' . $valId);
                 $query->setParameter($valId, $value['value']);
             } elseif (isset($value['expression']) && method_exists($query->expr(), $value['expression'])) {
                 $query->andWhere($query->expr()->{$value['expression']}($column));
                 if (isset($value['value'])) {
                     $query->setParameter($valId, $value['value']);
                 }
             } else {
                 if (is_array($value)) {
                     $query->andWhere('t.' . $column . ' IN(:' . $valId . ')');
                     $query->setParameter($valId, implode(',', $value));
                 } else {
                     $query->andWhere('t.' . $column . ' = :' . $valId);
                     $query->setParameter($valId, $value);
                 }
             }
         }
     }
 }
开发者ID:Yame-,项目名称:mautic,代码行数:33,代码来源:ChartQuery.php

示例2: buildQuery

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

示例3: limitQueryToCreator

 /**
  * Joins the page table and limits created_by to currently logged in user
  *
  * @param QueryBuilder $q
  */
 public function limitQueryToCreator(QueryBuilder &$q)
 {
     $q->join('t', MAUTIC_TABLE_PREFIX . 'dynamic_content', 'd', 'd.id = t.dynamic_content_id')->andWhere('d.created_by = :userId')->setParameter('userId', $this->user->getId());
 }
开发者ID:Yame-,项目名称:mautic,代码行数:9,代码来源:DynamicContentModel.php

示例4: limitQueryToCreator

 /**
  * Joins the email table and limits created_by to currently logged in user
  *
  * @param QueryBuilder $q
  */
 public function limitQueryToCreator(QueryBuilder &$q)
 {
     $q->join('t', MAUTIC_TABLE_PREFIX . 'emails', 'e', 'e.id = t.email_id')->andWhere('e.created_by = :userId')->setParameter('userId', $this->user->getId());
 }
开发者ID:Yame-,项目名称:mautic,代码行数:9,代码来源:EmailModel.php

示例5: join

 /**
  * Creates and adds a join to the query.
  *
  * <code>
  *     $qb = $conn->getQueryBuilder()
  *         ->select('u.name')
  *         ->from('users', 'u')
  *         ->join('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 join($fromAlias, $join, $alias, $condition = null)
 {
     $this->queryBuilder->join($fromAlias, $this->getTableName($join), $alias, $condition);
     return $this;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:22,代码来源:QueryBuilder.php

示例6: limitQueryToCreator

 /**
  * Joins the page table and limits created_by to currently logged in user.
  *
  * @param QueryBuilder $q
  */
 public function limitQueryToCreator(QueryBuilder &$q)
 {
     $q->join('t', MAUTIC_TABLE_PREFIX . 'pages', 'p', 'p.id = t.page_id')->andWhere('p.created_by = :userId')->setParameter('userId', $this->userHelper->getUser()->getId());
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:9,代码来源:PageModel.php

示例7: join

 /**
  * Creates and adds a 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 join($fromAlias, $join, $alias, $condition = null)
 {
     $this->qb->join($fromAlias, $join, $alias, $condition);
     return $this;
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:SqlQueryBuilder.php

示例8: join

 /**
  * Creates and adds a join to the query.
  *
  * <code>
  *     $qb = $conn->getQueryBuilder()
  *         ->select('u.name')
  *         ->from('users', 'u')
  *         ->join('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 join($fromAlias, $join, $alias, $condition = null)
 {
     $this->queryBuilder->join($fromAlias, $this->helper->quoteColumnName($join), $alias, $condition);
     return $this;
 }
开发者ID:henkRW,项目名称:core,代码行数:22,代码来源:querybuilder.php

示例9: limitQueryToCreator

 /**
  * Joins the page table and limits created_by to currently logged in user.
  *
  * @param QueryBuilder $q
  */
 public function limitQueryToCreator(QueryBuilder &$q)
 {
     $q->join('t', MAUTIC_TABLE_PREFIX . 'sms_messages', 's', 's.id = t.sms_id')->andWhere('s.created_by = :userId')->setParameter('userId', $this->user->getId());
 }
开发者ID:Yame-,项目名称:mautic,代码行数:9,代码来源:SmsModel.php

示例10: limitQueryToCreator

 /**
  * Joins the email table and limits created_by to currently logged in user.
  *
  * @param QueryBuilder $q
  */
 public function limitQueryToCreator(QueryBuilder $q)
 {
     $q->join('t', MAUTIC_TABLE_PREFIX . 'focus', 'm', 'e.id = t.focus_id')->andWhere('m.created_by = :userId')->setParameter('userId', $this->userHelper->getUser()->getId());
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:9,代码来源:FocusModel.php


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