public function findBillingAgreements(PricingContextInterface $context, $limit = null, $page = 1)
    {
        $offset = ($page - 1) * $limit;
        if (isset($context['endDate'])) {
            $endDate = new \DateTime($context['endDate']);
        } else {
            $endDate = new \DateTime();
        }
        $params = array(1 => $endDate);

        /** @var \Molino\Doctrine\ORM\SelectQuery $query  */
        $query = $this->gateway->createQuery('select', $this->billingAgreementClass);

        $qb = $query->getQueryBuilder();
        $qb->join('m.paymentProfile', 'pp');

        $qb->andWhere('m.generateRequestOn <= ?1');

        if (isset($context['partner'])) {
            $qb->andWhere('m.partner = ?3');
            $params[3] = $context['partner'];
        }

        $qb->andWhere('m.active = ?4');
        $params[4] = 1;

        if ($limit) {
            $qb
                ->setMaxResults($limit)
                ->setFirstResult($offset)
            ;
        }

        return $qb
            ->setParameters($params)
            ->getQuery()
            ->getResult()
        ;
    }
public function findBillingAgreements(PricingContextInterface $context, $limit = null, $page = 1)
    {
        $offset = ($page - 1) * $limit;
        if (isset($context['endDate'])) {
            $endDate = new \DateTime($context['endDate']);
        } else {
            $endDate = new \DateTime();
        }
        $params = array(1 => $endDate);

        /** @var \Molino\Doctrine\ORM\SelectQuery $query  */
        $query = $this->gateway->createQuery('select', $this->billingAgreementClass);

        $qb = $query->getQueryBuilder();
        $qb->join('m.paymentProfile', 'pp');

        $qb->andWhere('m.generateRequestOn <= ?1');

        if (isset($context['partner'])) {
            $qb->andWhere('m.partner = ?3');
            $params[3] = $context['partner'];
        }

        $qb->andWhere('m.active = ?4');
        $params[4] = 1;

        if ($limit) {
            $qb
                ->setMaxResults($limit)
                ->setFirstResult($offset)
            ;
        }

        return $qb
            ->setParameters($params)
            ->getQuery()
            ->getResult()
        ;
    }
public function findBillingAgreements ( PricingContextInterface $ context , $ limit = null , $ page = 1 ) { $ offset = ( $ page - 1 ) * $ limit ; if ( isset ( $ context [ 'endDate' ] ) ) { $ endDate = new \ DateTime ( $ context [ 'endDate' ] ) ; } else { $ endDate = new \ DateTime ( ) ; } $ params = array ( 1 => $ endDate ) ; /** @var \Molino\Doctrine\ORM\SelectQuery $query  */ $ query = $ this -> gateway -> createQuery ( 'select' , $ this -> billingAgreementClass ) ; $ qb = $ query -> getQueryBuilder ( ) ; $ qb -> join ( 'm.paymentProfile' , 'pp' ) ; $ qb -> andWhere ( 'm.generateRequestOn <= ?1' ) ; if ( isset ( $ context [ 'partner' ] ) ) { $ qb -> andWhere ( 'm.partner = ?3' ) ; $ params [ 3 ] = $ context [ 'partner' ] ; } $ qb -> andWhere ( 'm.active = ?4' ) ; $ params [ 4 ] = 1 ; if ( $ limit ) { $ qb -> setMaxResults ( $ limit ) -> setFirstResult ( $ offset ) ; } return $ qb -> setParameters ( $ params ) -> getQuery ( ) -> getResult ( ) ; }
Finds billing agreements that are due

@param $context
@param $limit
@param int $page
@return array
Finds billing agreements that are due