addIdCondition example

/** @var StorageAware $field */
        foreach ($fields as $field) {
            $query->addSelect(
                EntityDefinitionQueryHelper::escape($table) . '.' . EntityDefinitionQueryHelper::escape($field->getStorageName())
            );
        }

        $query = $this->criteriaQueryBuilder->build($query$definition$criteria$context);

        if (!empty($criteria->getIds())) {
            $this->queryHelper->addIdCondition($criteria$definition$query);
        }

        $this->addGroupBy($definition$criteria$context$query$table);

        // add pagination         if ($criteria->getOffset() !== null) {
            $query->setFirstResult($criteria->getOffset());
        }
        if ($criteria->getLimit() !== null) {
            $query->setMaxResults($criteria->getLimit());
        }

        
$query = $this->criteriaQueryBuilder->build(
            new QueryBuilder($this->connection),
            $definition,
            $criteria,
            $context
        );

        $this->joinBasic($definition$context$table$query$fields$criteria$partial);

        if (!empty($criteria->getIds())) {
            $this->queryHelper->addIdCondition($criteria$definition$query);
        }

        if ($criteria->getTitle()) {
            $query->setTitle($criteria->getTitle() . '::read');
        }

        return $query->executeQuery()->fetchAllAssociative();
    }

    /** * @param EntityCollection<Entity> $collection * @param array<string, mixed> $partial */
$query->addSelect($accessor);

            $accessor = str_replace(array_keys($vars)array_values($vars), '#root#.#field#');
            $query->andWhere($accessor . ' IS NOT NULL');
        }

        if ($root->isVersionAware()) {
            $query->andWhere(EntityDefinitionQueryHelper::escape($root->getEntityName()) . '.`version_id` = :version');
            $query->setParameter('version', Uuid::fromHexToBytes($context->getVersionId()));
        }

        $this->queryHelper->addIdCondition(new Criteria($ids)$root$query);

        $affected = $query->executeQuery()->fetchAllAssociative();

        if (empty($affected)) {
            return [];
        }

        // create flat list for single primary key entities         if ($primaryKeys->count() === 1) {
            /** @var Field $pk */
            $pk = $primaryKeys->first();
            
        // 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');

        if ($criteria->getTitle()) {
            $query->setTitle($criteria->getTitle() . '::aggregation::' . $aggregation->getName());
        }

        $this->queryHelper->addIdCondition($criteria$definition$query);

        $table = $definition->getEntityName();

        if (\count($scoreCriteria->getQueries()) > 0) {
            $escapedTable = EntityDefinitionQueryHelper::escape($table);
            $scoreQuery = new QueryBuilder($this->connection);

            $scoreQuery = $this->criteriaQueryBuilder->build($scoreQuery$definition$scoreCriteria$context$paths);
            $pks = $definition->getFields()->filterByFlag(PrimaryKey::class)->map(fn (StorageAware $f) => $f->getStorageName());

            $join = '';
            
Home | Imprint | This part of the site doesn't use cookies.