You are here

public function SelectExtender::join in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Database/Query/SelectExtender.php \Drupal\Core\Database\Query\SelectExtender::join()

Default Join against another table in the database.

This method is a convenience method for innerJoin().

Parameters

$table: The table against which to join. May be a string or another SelectQuery object. If a query object is passed, it will be used as a subselect. Unless the table name starts with the database / schema name and a dot it will be prefixed.

$alias: The alias for the table. In most cases this should be the first letter of the table, or the first letter of each "word" in the table.

$condition: The condition on which to join this table. If the join requires values, this clause should use a named placeholder and the value or values to insert should be passed in the 4th parameter. For the first table joined on a query, this value is ignored as the first table is taken as the base table. The token %alias can be used in this string to be replaced with the actual alias. This is useful when $alias is modified by the database system, for example, when joining the same table more than once.

$arguments: An array of arguments to replace into the $condition of this join.

Return value

The unique alias that was assigned for this table.

Overrides SelectInterface::join

2 calls to SelectExtender::join()
SearchQuery::execute in core/modules/search/src/SearchQuery.php
Executes the search.
SearchQuery::prepareAndNormalize in core/modules/search/src/SearchQuery.php
Prepares the query and calculates the normalization factor.

File

core/lib/Drupal/Core/Database/Query/SelectExtender.php, line 357

Class

SelectExtender
The base extender class for Select queries.

Namespace

Drupal\Core\Database\Query

Code

public function join($table, $alias = NULL, $condition = NULL, $arguments = []) {
  return $this->query
    ->join($table, $alias, $condition, $arguments);
}