You are here

protected function Tables::addNextBaseTable in Workspace 8.2

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

src/EntityQuery/Tables.php, line 114

Class

Tables
Alters entity queries to use a workspace revision instead of the default one.

Namespace

Drupal\workspace\EntityQuery

Code

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;
}