function Sql::markTable

Same name in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::markTable()
  2. 10 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::markTable()
  3. 11.x 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 547

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.