function Tables::addJoin
Same name in this branch
- 8.9.x core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\Tables::addJoin()
Same name in other branches
- 9 core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\Tables::addJoin()
- 9 core/lib/Drupal/Core/Entity/Query/Sql/Tables.php \Drupal\Core\Entity\Query\Sql\Tables::addJoin()
- 10 core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\Tables::addJoin()
- 10 core/lib/Drupal/Core/Entity/Query/Sql/Tables.php \Drupal\Core\Entity\Query\Sql\Tables::addJoin()
- 11.x core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\Tables::addJoin()
- 11.x core/lib/Drupal/Core/Entity/Query/Sql/Tables.php \Drupal\Core\Entity\Query\Sql\Tables::addJoin()
Adds a join to a given table.
Parameters
string $type: The join type.
string $table: The table to join to.
string $join_condition: The condition on which to join to.
string $langcode: The langcode we use on the join.
string|null $delta: (optional) A delta which should be used as additional condition.
Return value
string Returns the alias of the joined table.
3 calls to Tables::addJoin()
- Tables::addJoin in core/
modules/ workspaces/ src/ EntityQuery/ Tables.php - Adds a join to a given table.
- Tables::ensureEntityTable in core/
lib/ Drupal/ Core/ Entity/ Query/ Sql/ Tables.php - Joins the entity table, if necessary, and returns the alias for it.
- Tables::ensureFieldTable in core/
lib/ Drupal/ Core/ Entity/ Query/ Sql/ Tables.php - Join field table if necessary.
1 method overrides Tables::addJoin()
- Tables::addJoin in core/
modules/ workspaces/ src/ EntityQuery/ Tables.php - Adds a join to a given table.
File
-
core/
lib/ Drupal/ Core/ Entity/ Query/ Sql/ Tables.php, line 413
Class
- Tables
- Adds tables and fields to the SQL entity query.
Namespace
Drupal\Core\Entity\Query\SqlCode
protected function addJoin($type, $table, $join_condition, $langcode, $delta = NULL) {
$arguments = [];
if ($langcode) {
$entity_type_id = $this->sqlQuery
->getMetaData('entity_type');
$entity_type = $this->entityTypeManager
->getActiveDefinition($entity_type_id);
// Only the data table follows the entity language key, dedicated field
// tables have an hard-coded 'langcode' column.
$langcode_key = $entity_type->getDataTable() == $table ? $entity_type->getKey('langcode') : 'langcode';
$placeholder = ':langcode' . $this->sqlQuery
->nextPlaceholder();
$join_condition .= ' AND %alias.' . $langcode_key . ' = ' . $placeholder;
$arguments[$placeholder] = $langcode;
}
if (isset($delta)) {
$placeholder = ':delta' . $this->sqlQuery
->nextPlaceholder();
$join_condition .= ' AND %alias.delta = ' . $placeholder;
$arguments[$placeholder] = $delta;
}
return $this->sqlQuery
->addJoin($type, $table, NULL, $join_condition, $arguments);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.