You are here

public function Tables::__construct in Workspace 8.2

Parameters

\Drupal\Core\Database\Query\SelectInterface $sql_query:

Overrides Tables::__construct

File

src/EntityQuery/Tables.php, line 42

Class

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

Namespace

Drupal\workspace\EntityQuery

Code

public function __construct(SelectInterface $sql_query) {
  parent::__construct($sql_query);
  $this->workspaceManager = \Drupal::service('workspace.manager');

  // The join between the first 'workspace_association' table and base table
  // of the query is done \Drupal\workspace\EntityQuery\QueryTrait::prepare(),
  // so we need to initialize its entry manually.
  if ($this->sqlQuery
    ->getMetaData('active_workspace_id')) {
    $this->contentWorkspaceTables['base_table'] = 'workspace_association';
    $this->baseTablesEntityType['base_table'] = $this->sqlQuery
      ->getMetaData('entity_type');
  }
}