resetQueries example

$clone->resetGroupFields();

        // Early resolve terms to extract score queries         if ($clone->getTerm()) {
            $pattern = $this->interpreter->interpret((string) $criteria->getTerm());
            $queries = $this->scoreBuilder->buildScoreQueries($pattern$definition$definition->getEntityName()$context);
            $clone->addQuery(...$queries);
            $clone->setTerm(null);
        }

        $scoreCriteria = clone $clone;
        $clone->resetQueries();

        $query = new QueryBuilder($this->connection);

        // If an aggregation is to be created on a to many association that is already stored as a filter.         // The association is therefore referenced twice in the query and would have to be created as a sub-join in each case.         // But since only the filters are considered, the association is referenced only once.         // In this case we add the aggregation field as path to the criteria builder and the join group builder will consider this path for the sub-join logic         $paths = array_filter([$this->findToManyPath($aggregation$definition)]);

        $query = $this->criteriaQueryBuilder->build($query$definition$clone$context$paths);
        $query->resetQueryPart('orderBy');

        
 else {
            $term = (string) $search;
        }

        $term = mb_substr(trim($term), 0, $this->searchTermMaxLength);

        if (empty($term)) {
            throw RoutingException::missingRequestParameter('search');
        }

        // reset queries and set term to criteria.         $criteria->resetQueries();

        // elasticsearch will interpret this on demand         $criteria->setTerm($term);
    }
}
private readonly LoggerInterface $logger,
        private readonly CriteriaFieldsResolver $criteriaFieldsResolver
    ) {
    }

    /** * @return EntityCollection<Entity> */
    public function read(EntityDefinition $definition, Criteria $criteria, Context $context): EntityCollection
    {
        $criteria->resetSorting();
        $criteria->resetQueries();

        /** @var EntityCollection<Entity> $collectionClass */
        $collectionClass = $definition->getCollectionClass();

        $fields = $this->criteriaFieldsResolver->resolve($criteria$definition);

        return $this->_read(
            $criteria,
            $definition,
            $context,
            new $collectionClass(),
            
Home | Imprint | This part of the site doesn't use cookies.