private function getByMethodAndStatesFromDateQuery()
    {
        if (null !== $this->byMethodAndStatesFromDateQuery) {
            return $this->byMethodAndStatesFromDateQuery;
        }

        $qb = $this->createQueryBuilder('p');

        $query = $qb
            ->andWhere($qb->expr()->eq('p.method', ':method'))
            ->andWhere($qb->expr()->in('p.state', ':states'))
            ->andWhere($qb->expr()->gte('p.createdAt', ':date'))
            ->addOrderBy('p.createdAt', 'ASC')
            ->getQuery()
            ->useQueryCache(true);

        return $this->byMethodAndStatesFromDateQuery = $query;
    }
private function getByMethodAndStatesFromDateQuery()
    {
        if (null !== $this->byMethodAndStatesFromDateQuery) {
            return $this->byMethodAndStatesFromDateQuery;
        }

        $qb = $this->createQueryBuilder('p');

        $query = $qb
            ->andWhere($qb->expr()->eq('p.method', ':method'))
            ->andWhere($qb->expr()->in('p.state', ':states'))
            ->andWhere($qb->expr()->gte('p.createdAt', ':date'))
            ->addOrderBy('p.createdAt', 'ASC')
            ->getQuery()
            ->useQueryCache(true);

        return $this->byMethodAndStatesFromDateQuery = $query;
    }
Returns the "find by method and states from date" query.

@return \Doctrine\ORM\Query