public function Sql::addTable in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::addTable()
Add a table to the query, ensuring the path exists.
This function will test to ensure that the path back to the primary table is valid and exists; if you do not wish for this testing to occur, use $query->queueTable() instead.
Parameters
$table: The name of the table to add. It needs to exist in the global table array.
$relationship: An alias of a table; if this is set, the path back to this table will be tested prior to adding the table, making sure that all intermediary tables exist and are properly aliased. If set to NULL the path to the primary table will be ensured. If the path cannot be made, the table will NOT be added.
\Drupal\views\Plugin\views\join\JoinPluginBase $join: In some join configurations this table may actually join back through a different method; this is most likely to be used when tracing a hierarchy path. (node->parent->parent2->parent3). This parameter will specify how this table joins if it is not the default.
$alias: A specific alias to use, rather than the default alias.
Return value
$alias The alias of the table; this alias can be used to access information about the table and should always be used to refer to the table when adding parts to the query. Or FALSE if the table was not able to be added.
File
- core/
modules/ views/ src/ Plugin/ views/ query/ Sql.php, line 351 - Contains \Drupal\views\Plugin\views\query\Sql.
Class
- Sql
- Views query plugin for an SQL query.
Namespace
Drupal\views\Plugin\views\queryCode
public function addTable($table, $relationship = NULL, JoinPluginBase $join = NULL, $alias = NULL) {
if (!$this
->ensurePath($table, $relationship, $join)) {
return FALSE;
}
if ($join && $relationship) {
$join = $this
->adjustJoin($join, $relationship);
}
return $this
->queueTable($table, $relationship, $join, $alias);
}