filterListQuery example


    public function getListQuery($orderId$filter = null, $orderBy = null, $limit = null, $offset = null)
    {
        $builder = $this->getEntityManager()->createQueryBuilder();
        $builder = $this->selectListQuery($builder);

        $builder = $this->filterListQuery($builder$filter);
        if (\is_array($orderBy)) {
            $this->addOrderBy($builder$orderBy);
        }

        $builder->andWhere('documents.orderId = :orderId')
            ->setParameter('orderId', $orderId);

        if ($limit !== null) {
            $builder->setFirstResult($offset)
                    ->setMaxResults($limit);
        }

        
->leftJoin('billing.attribute', 'billingAttribute')
            ->leftJoin('shipping.attribute', 'shippingAttribute')
            ->leftJoin('details.attribute', 'detailAttribute')
            ->leftJoin('documents.attribute', 'documentAttribute')
            ->leftJoin('orders.attribute', 'attribute')
            ->leftJoin('orders.languageSubShop', 'subShop')
            ->leftJoin('subShop.locale', 'locale')
            ->leftJoin('shipping.country', 'shippingCountry')
            ->leftJoin('shipping.state', 'shippingState');

        if (!empty($filters)) {
            $builder = $this->filterListQuery($builder$filters);
        }
        $builder->andWhere('orders.status != -1');
        $builder->andWhere('orders.number IS NOT NULL');

        if (!empty($orderBy)) {
            // Add order by path             $builder->addOrderBy($orderBy);
        }

        return $builder;
    }

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