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


PHP SelectInterface::getTables方法代码示例

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


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

示例1: entityQueryAlter

 /**
  * {@inheritdoc}
  */
 public function entityQueryAlter(SelectInterface $query)
 {
     $tables = $query->getTables();
     $data_table = 'comment_field_data';
     if (!isset($tables['comment_field_data']['alias'])) {
         // If no conditions join against the comment data table, it should be
         // joined manually to allow node access processing.
         $query->innerJoin($data_table, NULL, "base_table.cid = {$data_table}.cid AND {$data_table}.default_langcode = 1");
     }
     // The Comment module doesn't implement any proper comment access,
     // and as a consequence doesn't make sure that comments cannot be viewed
     // when the user doesn't have access to the node.
     $node_alias = $query->innerJoin('node_field_data', 'n', '%alias.nid = ' . $data_table . '.entity_id AND ' . $data_table . ".entity_type = 'node'");
     // Pass the query to the node access control.
     $this->reAlterQuery($query, 'node_access', $node_alias);
     // Passing the query to node_query_node_access_alter() is sadly
     // insufficient for nodes.
     // @see SelectionEntityTypeNode::entityQueryAlter()
     if (!\Drupal::currentUser()->hasPermission('bypass node access') && !count(\Drupal::moduleHandler()->getImplementations('node_grants'))) {
         $query->condition($node_alias . '.status', 1);
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:25,代码来源:CommentSelection.php

示例2: getTableAlias

 /**
  * Joins a field's table into a database select query.
  *
  * @param array $field
  *   The field information array. The "table" key should contain the table
  *   name to which a join should be made.
  * @param \Drupal\Core\Database\Query\SelectInterface $db_query
  *   The database query used.
  * @param bool $new_join
  *   (optional) If TRUE, a join is done even if the table was already joined
  *   to in the query.
  * @param string $join
  *   (optional) The join method to use. Must be a method of the $db_query.
  *   Normally, "join", "innerJoin", "leftJoin" and "rightJoin" are supported.
  *
  * @return string
  *   The alias for the field's table.
  */
 protected function getTableAlias(array $field, SelectInterface $db_query, $new_join = FALSE, $join = 'leftJoin') {
   if (!$new_join) {
     foreach ($db_query->getTables() as $alias => $info) {
       $table = $info['table'];
       if (is_scalar($table) && $table == $field['table']) {
         return $alias;
       }
     }
   }
   return $db_query->$join($field['table'], 't', 't.item_id = %alias.item_id');
 }
开发者ID:jkyto,项目名称:agolf,代码行数:29,代码来源:Database.php

示例3:

 public function &getTables()
 {
     return $this->query->getTables();
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:4,代码来源:SelectExtender.php


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