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


PHP HandlerBase::getTableJoin方法代码示例

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


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

示例1: addTable

 /**
  * Add a table to the query.
  *
  * This is an advanced concept; not only does it add a new instance of the table,
  * but it follows the relationship path all the way down to the relationship
  * link point and adds *that* as a new relationship and then adds the table to
  * the relationship, if necessary.
  */
 public function addTable($join = NULL, $alias = NULL)
 {
     // This is used for lookups in the many_to_one table.
     $field = $this->handler->relationship . '_' . $this->handler->table . '.' . $this->handler->field;
     if (empty($join)) {
         $join = $this->getJoin();
     }
     // See if there's a chain between us and the base relationship. If so, we need
     // to create a new relationship to use.
     $relationship = $this->handler->relationship;
     // Determine the primary table to seek
     if (empty($this->handler->query->relationships[$relationship])) {
         $base_table = $this->handler->view->storage->get('base_table');
     } else {
         $base_table = $this->handler->query->relationships[$relationship]['base'];
     }
     // Cycle through the joins. This isn't as error-safe as the normal
     // ensurePath logic. Perhaps it should be.
     $r_join = clone $join;
     while ($r_join->leftTable != $base_table) {
         $r_join = HandlerBase::getTableJoin($r_join->leftTable, $base_table);
     }
     // If we found that there are tables in between, add the relationship.
     if ($r_join->table != $join->table) {
         $relationship = $this->handler->query->addRelationship($this->handler->table . '_' . $r_join->table, $r_join, $r_join->table, $this->handler->relationship);
     }
     // And now add our table, using the new relationship if one was used.
     $alias = $this->handler->query->addTable($this->handler->table, $relationship, $join, $alias);
     // Store what values are used by this table chain so that other chains can
     // automatically discard those values.
     if (empty($this->handler->view->many_to_one_tables[$field])) {
         $this->handler->view->many_to_one_tables[$field] = $this->handler->value;
     } else {
         $this->handler->view->many_to_one_tables[$field] = array_merge($this->handler->view->many_to_one_tables[$field], $this->handler->value);
     }
     return $alias;
 }
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:45,代码来源:ManyToOneHelper.php

示例2: getJoinData

 /**
  * Retrieve join data from the larger join data cache.
  *
  * @param $table
  *   The table to get the join information for.
  * @param $base_table
  *   The path we're following to get this join.
  *
  * @return \Drupal\views\Plugin\views\join\JoinPluginBase
  *   A Join object or child object, if one exists.
  */
 public function getJoinData($table, $base_table) {
   // Check to see if we're linking to a known alias. If so, get the real
   // table's data instead.
   if (!empty($this->tableQueue[$table])) {
     $table = $this->tableQueue[$table]['table'];
   }
   return HandlerBase::getTableJoin($table, $base_table);
 }
开发者ID:jthoresen,项目名称:PladsenDrupal,代码行数:19,代码来源:Sql.php

示例3: summaryNameField

 /**
  * Add the name field, which is the field displayed in summary queries.
  * This is often used when the argument is numeric.
  */
 protected function summaryNameField()
 {
     // Add the 'name' field. For example, if this is a uid argument, the
     // name field would be 'name' (i.e, the username).
     if (isset($this->name_table)) {
         // if the alias is different then we're probably added, not ensured,
         // so look up the join and add it instead.
         if ($this->tableAlias != $this->name_table) {
             $j = HandlerBase::getTableJoin($this->name_table, $this->table);
             if ($j) {
                 $join = clone $j;
                 $join->leftTable = $this->tableAlias;
                 $this->name_table_alias = $this->query->addTable($this->name_table, $this->relationship, $join);
             }
         } else {
             $this->name_table_alias = $this->query->ensureTable($this->name_table, $this->relationship);
         }
     } else {
         $this->name_table_alias = $this->tableAlias;
     }
     if (isset($this->name_field)) {
         $this->name_alias = $this->query->addField($this->name_table_alias, $this->name_field);
     } else {
         $this->name_alias = $this->base_alias;
     }
 }
开发者ID:shumer,项目名称:blog,代码行数:30,代码来源:ArgumentPluginBase.php


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