<?php

namespace Msp\FrontendBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * UserAvailabilityRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class UserAvailabilityRepository extends EntityRepository
{
    public function getAllForUserByDateAndCours( $user, $lundi)
    {
        $qb =   $this->createQueryBuilder('a')
                ->where('a.user = :user')                
                ->setParameter('user', $user)                
                ->andWhere('a.date >= :date')
                ->setParameter('date', $lundi)
                ->orderBy('a.cours', 'ASC');
        
        return $qb->getQuery()->getResult();
    }
}
