sortListQuery example


        $em = $this->getEntityManager();
        $builder = $em->createQueryBuilder()
            ->select(['orders.id'])
            ->from(Order::class, 'orders')
            ->leftJoin('orders.attribute', 'attribute')
            ->andWhere('orders.number IS NOT NULL')
            ->andWhere('orders.status != :cancelStatus')
            ->setParameter(':cancelStatus', -1);

        $builder = $this->filterListQuery($builder$filters);
        $builder = $this->sortListQuery($builder$sortings);

        if ($offset !== null) {
            $builder->setFirstResult($offset);
        }
        if ($limit !== null) {
            $builder->setMaxResults($limit);
        }
        /** @var Query<array{id: int}> $query */
        $query = $builder->getQuery();
        $query->setHydrationMode(AbstractQuery::HYDRATE_ARRAY);
        $paginator = $em->createPaginator($query);

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