addConditions example

/** * {@inheritdoc} */
    public function generateCondition(
        ConditionInterface $condition,
        QueryBuilder $query,
        ShopContextInterface $context
    ) {
        $query->addState($condition->getName());

        $this->addConditions($condition$query$context);
    }

    private function addConditions(
        CombinedCondition $condition,
        QueryBuilder $query,
        ShopContextInterface $context
    ): void {
        foreach ($condition->getConditions() as $innerCondition) {
            $handler = $this->getConditionHandler($innerCondition);
            $handler->generateCondition($innerCondition$query$context);
        }
    }
$products,
            $data['hits']['total'],
            $facets,
            $result->getAttributes()
        );
    }

    private function buildSearch(Criteria $criteria, ShopContextInterface $context): EsSearch
    {
        $search = new EsSearch();

        $this->addConditions($criteria$context$search);
        $this->addCriteriaParts($criteria$context$search$criteria->getSortings());
        $this->addCriteriaParts($criteria$context$search$criteria->getFacets());

        if ($criteria->getOffset() !== null) {
            $search->setFrom($criteria->getOffset());
        }
        if ($criteria->getLimit() !== null) {
            $search->setSize($criteria->getLimit());
        }

        $search->addSort(new FieldSort('id', 'asc'));

        

            );
        }
        $query->innerJoin(
            'variant',
            's_articles_attributes',
            'productAttribute',
            'productAttribute.articledetailsID = variant.id'
        );

        $this->addConditions($criteria$query$context);

        return $query;
    }

    /** * {@inheritdoc} */
    public function createQueryBuilder()
    {
        return new QueryBuilder($this->connection);
    }

    
Home | Imprint | This part of the site doesn't use cookies.