You are here

class QueryFactory in MongoDB 8

Hierarchy

Expanded class hierarchy of QueryFactory

1 string reference to 'QueryFactory'
mongodb.services.yml in ./mongodb.services.yml
mongodb.services.yml
1 service uses QueryFactory
entity.query.mongodb in ./mongodb.services.yml
Drupal\mongodb\Entity\QueryFactory

File

src/Entity/QueryFactory.php, line 15
Contains Drupal\mongodb\Entity\ContentEntityStorage.

Namespace

Drupal\mongodb\Entity
View source
class QueryFactory implements QueryFactoryInterface {
  public function __construct(MongoCollectionFactory $mongo) {
    $this->mongo = $mongo;
    $this->namespaces = QueryBase::getNamespaces($this);
  }

  /**
   * Instantiates an entity query for a given entity type.
   *
   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   *   The entity type definition.
   * @param string $conjunction
   *   The operator to use to combine conditions: 'AND' or 'OR'.
   *
   * @return \Drupal\Core\Entity\Query\QueryInterface
   *   An entity query for a specific configuration entity type.
   */
  public function get(EntityTypeInterface $entity_type, $conjunction) {
    return new Query($this->mongo, $entity_type, $conjunction, $this->namespaces);
  }

  /**
   * Returns a aggregation query object for a given entity type.
   *
   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   *   The entity type definition.
   * @param string $conjunction
   *   - AND: all of the conditions on the query need to match.
   *   - OR: at least one of the conditions on the query need to match.
   *
   * @throws \Drupal\Core\Entity\Query\QueryException
   * @return \Drupal\Core\Entity\Query\QueryAggregateInterface
   *   The query object that can query the given entity type.
   */
  public function getAggregate(EntityTypeInterface $entity_type, $conjunction) {

    // TODO: Implement getAggregate() method.
    return new QueryAggregate($this->mongo, $entity_type, $conjunction, $this->namespaces);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
QueryFactory::get public function Instantiates an entity query for a given entity type. Overrides QueryFactoryInterface::get
QueryFactory::getAggregate public function Returns a aggregation query object for a given entity type. Overrides QueryFactoryInterface::getAggregate
QueryFactory::__construct public function