Repository/BaseOrderRepository.php
public function findAllForPagination(string $state = null)
    {
        $qb = $this->createQueryBuilder('o');

        if($state)
        {
            $qb->where('o.state = :state');
            $qb->setParameter('state', $state);
        }

        $qb->orderBy('o.createdAt', 'desc');

        return $qb;
    }
public function findAllForPagination(string $state = null)
    {
        $qb = $this->createQueryBuilder('o');

        if($state)
        {
            $qb->where('o.state = :state');
            $qb->setParameter('state', $state);
        }

        $qb->orderBy('o.createdAt', 'desc');

        return $qb;
    }
@param string|null $state

@return \Doctrine\ORM\QueryBuilder