function Tables::addNextBaseTable
Same name in this branch
- 10 core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\Tables::addNextBaseTable()
Same name in other branches
- 9 core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\Tables::addNextBaseTable()
- 9 core/lib/Drupal/Core/Entity/Query/Sql/Tables.php \Drupal\Core\Entity\Query\Sql\Tables::addNextBaseTable()
- 8.9.x core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\Tables::addNextBaseTable()
- 8.9.x core/lib/Drupal/Core/Entity/Query/Sql/Tables.php \Drupal\Core\Entity\Query\Sql\Tables::addNextBaseTable()
- 11.x core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\Tables::addNextBaseTable()
- 11.x core/lib/Drupal/Core/Entity/Query/Sql/Tables.php \Drupal\Core\Entity\Query\Sql\Tables::addNextBaseTable()
Add the next entity base table.
For example, when building the SQL query for
condition('uid.entity.name', 'foo', 'CONTAINS');
this adds the users table.
Parameters
\Drupal\Core\Entity\EntityType $entity_type: The entity type being joined, in the above example, User.
string $table: This is the table being joined, in the above example, {users}.
string $sql_column: This is the SQL column in the existing table being joined to.
\Drupal\Core\Field\FieldStorageDefinitionInterface $field_storage: The field storage definition for the field referencing this column.
Return value
string The alias of the next entity table joined in.
2 calls to Tables::addNextBaseTable()
- Tables::addField in core/
lib/ Drupal/ Core/ Entity/ Query/ Sql/ Tables.php - Adds a field to a database query.
- Tables::addNextBaseTable in core/
modules/ workspaces/ src/ EntityQuery/ Tables.php - Add the next entity base table.
1 method overrides Tables::addNextBaseTable()
- Tables::addNextBaseTable in core/
modules/ workspaces/ src/ EntityQuery/ Tables.php - Add the next entity base table.
File
-
core/
lib/ Drupal/ Core/ Entity/ Query/ Sql/ Tables.php, line 498
Class
- Tables
- Adds tables and fields to the SQL entity query.
Namespace
Drupal\Core\Entity\Query\SqlCode
protected function addNextBaseTable(EntityType $entity_type, $table, $sql_column, FieldStorageDefinitionInterface $field_storage) {
$join_condition = '[%alias].[' . $entity_type->getKey('id') . "] = [{$table}].[{$sql_column}]";
return $this->sqlQuery
->leftJoin($entity_type->getBaseTable(), NULL, $join_condition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.