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


PHP SelectInterface::addJoin方法代码示例

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


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

示例1: addJoin

 protected function addJoin($type, $table, $join_condition, $langcode)
 {
     $arguments = array();
     if ($langcode) {
         $placeholder = ':langcode' . $this->sqlQuery->nextPlaceholder();
         $join_condition .= ' AND %alias.langcode = ' . $placeholder;
         $arguments[$placeholder] = $langcode;
     }
     return $this->sqlQuery->addJoin($type, $table, NULL, $join_condition, $arguments);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:10,代码来源:Tables.php

示例2: addJoin

 protected function addJoin($type, $table, $join_condition, $langcode)
 {
     $arguments = array();
     if ($langcode) {
         $entity_type_id = $this->sqlQuery->getMetaData('entity_type');
         $entity_type = $this->entityManager->getDefinition($entity_type_id);
         // Only the data table follows the entity language key, dedicated field
         // tables have an hard-coded 'langcode' column.
         $langcode_key = $entity_type->getDataTable() == $table ? $entity_type->getKey('langcode') : 'langcode';
         $placeholder = ':langcode' . $this->sqlQuery->nextPlaceholder();
         $join_condition .= ' AND %alias.' . $langcode_key . ' = ' . $placeholder;
         $arguments[$placeholder] = $langcode;
     }
     return $this->sqlQuery->addJoin($type, $table, NULL, $join_condition, $arguments);
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:15,代码来源:Tables.php

示例3: buildJoin

 /**
  * Builds the SQL for the join this object represents.
  *
  * @param \Drupal\Core\Database\Query\SelectInterface $select_query
  *   The select query object.
  * @param string $table
  *   The base table to join.
  * @param \Drupal\views\Plugin\views\query\QueryPluginBase $view_query
  *   The source views query.
  */
 public function buildJoin($select_query, $table, $view_query)
 {
     if (empty($this->configuration['table formula'])) {
         $right_table = "{" . $this->table . "}";
     } else {
         $right_table = $this->configuration['table formula'];
     }
     // Add our join condition, using a subquery on the left instead of a field.
     $condition = "({$this->left_query}) = {$table['alias']}.{$this->field}";
     $arguments = array();
     // Tack on the extra.
     // This is just copied verbatim from the parent class, which itself has a
     //   bug: https://www.drupal.org/node/1118100.
     if (isset($this->extra)) {
         if (is_array($this->extra)) {
             $extras = array();
             foreach ($this->extra as $info) {
                 // Figure out the table name. Remember, only use aliases provided
                 // if at all possible.
                 $join_table = '';
                 if (!array_key_exists('table', $info)) {
                     $join_table = $table['alias'] . '.';
                 } elseif (isset($info['table'])) {
                     $join_table = $info['table'] . '.';
                 }
                 $placeholder = ':views_join_condition_' . $select_query->nextPlaceholder();
                 if (is_array($info['value'])) {
                     $operator = !empty($info['operator']) ? $info['operator'] : 'IN';
                     // Transform from IN() notation to = notation if just one value.
                     if (count($info['value']) == 1) {
                         $info['value'] = array_shift($info['value']);
                         $operator = $operator == 'NOT IN' ? '!=' : '=';
                     }
                 } else {
                     $operator = !empty($info['operator']) ? $info['operator'] : '=';
                 }
                 $extras[] = "{$join_table}{$info['field']} {$operator} {$placeholder}";
                 $arguments[$placeholder] = $info['value'];
             }
             if ($extras) {
                 if (count($extras) == 1) {
                     $condition .= ' AND ' . array_shift($extras);
                 } else {
                     $condition .= ' AND (' . implode(' ' . $this->extraOperator . ' ', $extras) . ')';
                 }
             }
         } elseif ($this->extra && is_string($this->extra)) {
             $condition .= " AND ({$this->extra})";
         }
     }
     $select_query->addJoin($this->type, $right_table, $table['alias'], $condition, $arguments);
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:62,代码来源:Subquery.php

示例4: addJoin

 public function addJoin($type, $table, $alias = NULL, $condition = NULL, $arguments = array())
 {
     return $this->query->addJoin($type, $table, $alias, $condition, $arguments);
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:4,代码来源:SelectExtender.php


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