orX example

$query = $this->connection->createQueryBuilder();

        $query->select($this->fieldHelper->getPriceFields());
        $query->addSelect('variants.ordernumber as number');
        $query->addSelect('GREATEST(price.from, variants.minpurchase) __price_from');

        $query->from('s_articles_prices', 'price')
            ->innerJoin('price', 's_articles_details', 'variants', 'variants.id = price.articledetailsID')
            ->leftJoin('price', 's_articles_prices_attributes', 'priceAttribute', 'priceAttribute.priceID = price.id')
            ->where('price.articledetailsID IN (:products)')
            ->andWhere('price.pricegroup = :customerGroup')
            ->andWhere($query->expr()->orX('price.to >= variants.minpurchase', 'price.to = "beliebig"'))
            ->orderBy('price.articledetailsID', 'ASC')
            ->addOrderBy('price.from', 'ASC')
            ->setParameter(':products', $ids, Connection::PARAM_INT_ARRAY)
            ->setParameter(':customerGroup', $customerGroup->getKey());

        $this->fieldHelper->addPriceTranslation($query$context);

        $data = $query->execute()->fetchAll(PDO::FETCH_ASSOC);

        $prices = [];
        foreach ($data as $row) {
            
'address',
            'customer',
            'newsletterGroup',
            'lastNewsletter',
        ]);
        $builder->from(Address::class, 'address')
            ->leftJoin('address.customer', 'customer', 'WITH', 'address.isCustomer = true')
            ->leftJoin('address.newsletterGroup', 'newsletterGroup')
            ->leftJoin('address.lastNewsletter', 'lastNewsletter');

        if ($filter !== null) {
            $builder->andWhere($builder->expr()->orX(
                'address.email LIKE :search',
                'newsletterGroup.name LIKE :search',
                'lastNewsletter.subject LIKE :search'
            ));
            $builder->setParameter('search', '%' . $filter[0]['value'] . '%');
        }
        if ($order !== null) {
            $builder->addOrderBy($order);
        }

        return $builder;
    }
// Don't search for configurator articles         $displayConfigurators = (bool) $this->Request()->getParam('configurator', true);
        if (!$displayConfigurators) {
            $builder->andWhere('articles.configuratorSetId IS NULL');
        }

        $filters = $this->Request()->getParam('filter', []);
        foreach ($filters as $filter) {
            if ($filter['property'] === 'free') {
                $builder->andWhere(
                    $builder->expr()->orX(
                        'detail.number LIKE :free',
                        'articles.name LIKE :free'
                    )
                );
                $builder->setParameter(':free', $filter['value']);
            } else {
                $repository->addFilter($builder[$filter]);
            }
        }

        $repository->addOrderBy($builder$this->prepareParam($this->Request()->getParam('sort', [])$fields));

        

    public function getConfiguratorListIdsQueryBuilder($articleId$filter = null, $sort = null)
    {
        /** @var QueryBuilder $builder */
        $builder = $this->getEntityManager()->createQueryBuilder();
        $builder->select('details.id')
                ->from(Detail::class, 'details')
                ->where('details.articleId = ?1')
                ->setParameter(1, $articleId);

        if ($filter !== null) {
            $builder->andWhere($builder->expr()->orX(
                'details.number LIKE ?2',
                'configuratorOptions.name LIKE ?2'
            ));
            $builder->setParameter(2, '%' . $filter[0]['value'] . '%');
            $builder->leftJoin('details.configuratorOptions', 'configuratorOptions');
        }

        if ($sort !== null && !empty($sort)) {
            $builder->addOrderBy($sort);
        } else {
            $builder->addOrderBy('details.id', 'ASC');
        }
$currentKey = $connection->fetchColumn('SELECT `key` FROM s_cms_static_groups WHERE id = ?', [
                    (int) $this->Request()->getParam('id'),
                ]);

                $qb = $connection->createQueryBuilder();

                $sites = $qb
                    ->addSelect('sites.id')
                    ->addSelect('sites.grouping')
                    ->from('s_cms_static', 'sites')
                    ->andWhere(
                        $qb->expr()->orX(
                            $qb->expr()->eq('sites.grouping', ':g1'),   // = bottom                             $qb->expr()->like('sites.grouping', ':g2'), // like 'bottom|%                             $qb->expr()->like('sites.grouping', ':g3'), // like '|bottom                             $qb->expr()->like('sites.grouping', ':g4')  // like '|bottom|                         )
                    )->setParameter('g1', $currentKey)
                    ->setParameter('g2', $currentKey . '|%')
                    ->setParameter('g3', '%|' . $currentKey)
                    ->setParameter('g4', '%|' . $currentKey . '|%')
                    ->execute()
                    ->fetchAll();

                
->setParameter('shopId', $shopId)
            ->execute()
            ->fetchAll(PDO::FETCH_COLUMN);

        $sites = [];
        foreach ($keys as $key) {
            $builder = $this->connection->createQueryBuilder();
            $current = $builder->from('s_cms_static', 'sites')
                ->select('*')
                ->where('sites.active = 1')
                ->andWhere(
                    $builder->expr()->orX(
                        $builder->expr()->eq('sites.grouping', ':g1'),   // = bottom                         $builder->expr()->like('sites.grouping', ':g2'), // like 'bottom|%                         $builder->expr()->like('sites.grouping', ':g3'), // like '|bottom                         $builder->expr()->like('sites.grouping', ':g4')  // like '|bottom|                     )
                )
                ->andWhere(
                    $builder->expr()->orX(
                        $builder->expr()->like('sites.shop_ids', ':shopId'),
                        $builder->expr()->isNull('sites.shop_ids')
                    )
                )


        if (!empty($filter)) {
            $builder->addFilter($filter);
        }
        if (!empty($sort)) {
            $builder->addOrderBy($sort);
        }

        $expr = $this->getManager()->getExpressionBuilder();
        $builder->andWhere(
            $expr->orX(
                $expr->eq($association['fieldName'] . '.id', ':id')
            )
        );
        $builder->setParameter('id', $id);

        $builder->setFirstResult($offset)
            ->setMaxResults($limit);

        $paginator = $this->getQueryPaginator($builder);

        $data = iterator_to_array($paginator);

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