Skip to content
Snippets Groups Projects
Commit b4c49241 authored by Andrei Mateescu's avatar Andrei Mateescu
Browse files

Modernize the QueryFactory class overrides.

parent 5bf58620
No related branches found
No related tags found
No related merge requests found
Pipeline #108267 passed
Pipeline: drupal-3101671

#108289

    Pipeline: drupal-3101671

    #108288

      Pipeline: drupal-3101671

      #108276

        ...@@ -2,52 +2,11 @@ ...@@ -2,52 +2,11 @@
        namespace Drupal\workspaces\EntityQuery; namespace Drupal\workspaces\EntityQuery;
        use Drupal\Core\Database\Connection;
        use Drupal\Core\Entity\EntityTypeInterface;
        use Drupal\Core\Entity\Query\QueryBase;
        use Drupal\Core\Entity\Query\Sql\pgsql\QueryFactory as BaseQueryFactory;
        use Drupal\workspaces\WorkspaceManagerInterface;
        /** /**
        * Workspaces PostgreSQL-specific entity query implementation. * Workspaces PostgreSQL-specific entity query implementation.
        *
        * @internal
        */ */
        class PgsqlQueryFactory extends BaseQueryFactory { class PgsqlQueryFactory extends QueryFactory {
        /**
        * The workspace manager.
        *
        * @var \Drupal\workspaces\WorkspaceManagerInterface
        */
        protected $workspaceManager;
        /**
        * Constructs a PgsqlQueryFactory object.
        *
        * @param \Drupal\Core\Database\Connection $connection
        * The database connection used by the entity query.
        * @param \Drupal\workspaces\WorkspaceManagerInterface $workspace_manager
        * The workspace manager.
        */
        public function __construct(Connection $connection, WorkspaceManagerInterface $workspace_manager) {
        $this->connection = $connection;
        $this->workspaceManager = $workspace_manager;
        $this->namespaces = QueryBase::getNamespaces($this);
        }
        /**
        * {@inheritdoc}
        */
        public function get(EntityTypeInterface $entity_type, $conjunction) {
        $class = QueryBase::getClass($this->namespaces, 'Query');
        return new $class($entity_type, $conjunction, $this->connection, $this->namespaces, $this->workspaceManager);
        }
        /**
        * {@inheritdoc}
        */
        public function getAggregate(EntityTypeInterface $entity_type, $conjunction) {
        $class = QueryBase::getClass($this->namespaces, 'QueryAggregate');
        return new $class($entity_type, $conjunction, $this->connection, $this->namespaces, $this->workspaceManager);
        }
        } }
        ...@@ -16,37 +16,12 @@ ...@@ -16,37 +16,12 @@
        */ */
        class QueryFactory extends BaseQueryFactory { class QueryFactory extends BaseQueryFactory {
        /** public function __construct(
        * The workspace manager. Connection $connection,
        * protected readonly WorkspaceManagerInterface $workspaceManager,
        * @var \Drupal\workspaces\WorkspaceManagerInterface protected readonly WorkspaceInformationInterface $workspaceInfo
        */ ) {
        protected $workspaceManager;
        /**
        * The workspace information service.
        *
        * @var \Drupal\workspaces\WorkspaceInformationInterface
        */
        protected $workspaceInfo;
        /**
        * Constructs a QueryFactory object.
        *
        * Initializes the list of namespaces used to locate query
        * classes for different entity types.
        *
        * @param \Drupal\Core\Database\Connection $connection
        * The database connection used by the entity query.
        * @param \Drupal\workspaces\WorkspaceManagerInterface $workspace_manager
        * The workspace manager.
        * @param \Drupal\workspaces\WorkspaceInformationInterface $workspace_information
        * The workspace information service.
        */
        public function __construct(Connection $connection, WorkspaceManagerInterface $workspace_manager, protected WorkspaceInformationInterface $workspace_information) {
        $this->connection = $connection; $this->connection = $connection;
        $this->workspaceManager = $workspace_manager;
        $this->workspaceInfo = $workspace_information;
        $this->namespaces = QueryBase::getNamespaces($this); $this->namespaces = QueryBase::getNamespaces($this);
        } }
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment