<?php

namespace AppBundle\Entity\Billing\Repository;
use AppBundle\Entity\AccessAndFunction\Access;
use AppBundle\Entity\Organization\Organization;
use Doctrine\ORM\EntityRepository;

/**
 * Class AdvancePaymentRepository
 */
class AdvancePaymentRepository extends EntityRepository
{

    public function findByAccessAndSchoolYear(Access $access, $schoolYear)
    {

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

        $qb
            ->andWhere('o.access =:access')
            ->andWhere('o.startSchoolYear = :schoolYear')
            ->andWhere('o.bill is null')
            //todo: PAS D'ACOMPTE NON PLUS !!!
            ->setParameter('access', $access)
            ->setParameter('schoolYear', $schoolYear)
        ;

        return $qb->getQuery()->getResult();

    }

}

?>
