3 namespace Drupal\workspaces\EntityQuery;
5 use Drupal\Core\Database\Connection;
6 use Drupal\Core\Entity\EntityTypeInterface;
7 use Drupal\Core\Entity\Query\QueryBase;
8 use Drupal\Core\Entity\Query\Sql\pgsql\QueryFactory as BaseQueryFactory;
9 use Drupal\workspaces\WorkspaceManagerInterface;
12 * Workspaces PostgreSQL-specific entity query implementation.
14 class PgsqlQueryFactory extends BaseQueryFactory {
17 * The workspace manager.
19 * @var \Drupal\workspaces\WorkspaceManagerInterface
21 protected $workspaceManager;
24 * Constructs a PgsqlQueryFactory object.
26 * @param \Drupal\Core\Database\Connection $connection
27 * The database connection used by the entity query.
28 * @param \Drupal\workspaces\WorkspaceManagerInterface $workspace_manager
29 * The workspace manager.
31 public function __construct(Connection $connection, WorkspaceManagerInterface $workspace_manager) {
32 $this->connection = $connection;
33 $this->workspaceManager = $workspace_manager;
34 $this->namespaces = QueryBase::getNamespaces($this);
40 public function get(EntityTypeInterface $entity_type, $conjunction) {
41 $class = QueryBase::getClass($this->namespaces, 'Query');
42 return new $class($entity_type, $conjunction, $this->connection, $this->namespaces, $this->workspaceManager);
48 public function getAggregate(EntityTypeInterface $entity_type, $conjunction) {
49 $class = QueryBase::getClass($this->namespaces, 'QueryAggregate');
50 return new $class($entity_type, $conjunction, $this->connection, $this->namespaces, $this->workspaceManager);