Inheritance: implements Neos\Flow\Persistence\QueryInterface
 /**
  * Returns the number of objects in the result
  *
  * @return integer The number of matching objects
  * @api
  */
 public function count()
 {
     if ($this->numberOfRows === null) {
         if (is_array($this->rows)) {
             $this->numberOfRows = count($this->rows);
         } else {
             $this->numberOfRows = $this->query->count();
         }
     }
     return $this->numberOfRows;
 }
 protected function assertQueryEquals(Query $expected, Query $actual)
 {
     $this->assertEquals($expected->getConstraint(), $actual->getConstraint());
     $this->assertEquals($expected->getOrderings(), $actual->getOrderings());
     $this->assertEquals($expected->getOffset(), $actual->getOffset());
     $this->assertEquals($expected->getLimit(), $actual->getLimit());
 }
 /**
  * @test
  */
 public function countCallsCountOnTheQueryOnlyOnce()
 {
     $this->query->expects($this->once())->method('count')->will($this->returnValue(321));
     $this->queryResult->count();
     $this->assertEquals(321, $this->queryResult->count());
 }
 /**
  * Returns a query for objects of this repository
  *
  * @return Query
  * @api
  */
 public function createQuery()
 {
     $query = new Query($this->objectType);
     if ($this->defaultOrderings) {
         $query->setOrderings($this->defaultOrderings);
     }
     return $query;
 }
 /**
  * @param ClassMetadata $targetEntity
  * @param string $targetEntityPropertyName
  * @return Query
  */
 protected function getSubselectQuery(ClassMetadata $targetEntity, $targetEntityPropertyName)
 {
     $subselectQuery = new Query($targetEntity->getAssociationTargetClass($targetEntityPropertyName));
     $propertyName = str_replace($targetEntityPropertyName . '.', '', $this->path);
     switch ($this->operator) {
         case '==':
             $subselectConstraint = $subselectQuery->equals($propertyName, $this->operand);
             break;
         case '!=':
             $subselectConstraint = $subselectQuery->logicalNot($subselectQuery->equals($propertyName, $this->operand));
             break;
         case '<':
             $subselectConstraint = $subselectQuery->lessThan($propertyName, $this->operand);
             break;
         case '>':
             $subselectConstraint = $subselectQuery->greaterThan($propertyName, $this->operand);
             break;
         case '<=':
             $subselectConstraint = $subselectQuery->lessThanOrEqual($propertyName, $this->operand);
             break;
         case '>=':
             $subselectConstraint = $subselectQuery->greaterThanOrEqual($propertyName, $this->operand);
             break;
         case 'like':
             $subselectConstraint = $subselectQuery->like($propertyName, $this->operand);
             break;
         case 'in':
             $subselectConstraint = $subselectQuery->in($propertyName, $this->operand);
             break;
     }
     $subselectQuery->matching($subselectConstraint);
     return $subselectQuery;
 }
 /**
  * @var Query $query
  * @return QueryInterface
  */
 protected function addImageVariantFilterClause(Query $query)
 {
     $queryBuilder = $query->getQueryBuilder();
     $queryBuilder->andWhere('e NOT INSTANCE OF Neos\\Media\\Domain\\Model\\ImageVariant');
     return $query;
 }