3 namespace Drupal\Core\Entity\KeyValueStore\Query;
5 use Drupal\Core\Entity\EntityTypeInterface;
6 use Drupal\Core\Entity\Query\QueryException;
7 use Drupal\Core\Entity\Query\QueryFactoryInterface;
8 use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
11 * Provides a factory for creating the key value entity query.
13 class QueryFactory implements QueryFactoryInterface {
16 * The key value factory.
18 * @var \Drupal\Core\KeyValueStore\KeyValueFactoryInterface
20 protected $keyValueFactory;
23 * The namespace of this class, the parent class etc.
27 protected $namespaces;
30 * Constructs a QueryFactory object.
32 public function __construct(KeyValueFactoryInterface $key_value_factory) {
33 $this->keyValueFactory = $key_value_factory;
34 $this->namespaces = Query::getNamespaces($this);
40 public function get(EntityTypeInterface $entity_type, $conjunction) {
41 return new Query($entity_type, $conjunction, $this->namespaces, $this->keyValueFactory);
47 public function getAggregate(EntityTypeInterface $entity_type, $conjunction) {
48 throw new QueryException('Aggregation over key-value entity storage is not supported');