Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Tables.php

function Tables::__construct

Same name in this branch
  1. 11.1.x core/lib/Drupal/Core/Entity/Query/Sql/Tables.php \Drupal\Core\Entity\Query\Sql\Tables::__construct()

Overrides Tables::__construct

File

core/modules/workspaces/src/EntityQuery/Tables.php, line 43

Class

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

Namespace

Drupal\workspaces\EntityQuery

Code

public function __construct(SelectInterface $sql_query) {
    parent::__construct($sql_query);
    $this->workspaceInfo = \Drupal::service('workspaces.information');
    // The join between the first 'workspace_association' table and base table
    // of the query is done in
    // \Drupal\workspaces\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');
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal