protected function Tables::addNextBaseTable in Drupal 8
Same name in this branch
- 8 core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\Tables::addNextBaseTable()
- 8 core/lib/Drupal/Core/Entity/Query/Sql/Tables.php \Drupal\Core\Entity\Query\Sql\Tables::addNextBaseTable()
Same name and namespace in other branches
- 9 core/modules/workspaces/src/EntityQuery/Tables.php \Drupal\workspaces\EntityQuery\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.
Overrides Tables::addNextBaseTable
File
- core/
modules/ workspaces/ src/ EntityQuery/ Tables.php, line 115
Class
- Tables
- Alters entity queries to use a workspace revision instead of the default one.
Namespace
Drupal\workspaces\EntityQueryCode
protected function addNextBaseTable(EntityType $entity_type, $table, $sql_column, FieldStorageDefinitionInterface $field_storage) {
$next_base_table_alias = parent::addNextBaseTable($entity_type, $table, $sql_column, $field_storage);
$active_workspace_id = $this->sqlQuery
->getMetaData('active_workspace_id');
if ($active_workspace_id && $this->workspaceManager
->isEntityTypeSupported($entity_type)) {
$this
->addWorkspaceAssociationJoin($entity_type
->id(), $next_base_table_alias, $active_workspace_id);
}
return $next_base_table_alias;
}