You are here

protected function Sql::markTable in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::markTable()
1 call to Sql::markTable()
Sql::queueTable in core/modules/views/src/Plugin/views/query/Sql.php
Add a table to the query without ensuring the path.

File

core/modules/views/src/Plugin/views/query/Sql.php, line 538

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

protected function markTable($table, $relationship, $alias) {

  // Mark that this table has been added.
  if (empty($this->tables[$relationship][$table])) {
    if (!isset($alias)) {
      $alias = '';
      if ($relationship != $this->view->storage
        ->get('base_table')) {

        // double underscore will help prevent accidental name
        // space collisions.
        $alias = $relationship . '__';
      }
      $alias .= $table;
    }
    $this->tables[$relationship][$table] = [
      'count' => 1,
      'alias' => $alias,
    ];
  }
  else {
    $this->tables[$relationship][$table]['count']++;
  }
  return $alias;
}