public function countUserFinishedDayPapers(Exercise $exercise, User $user)
    {
        $today = new \DateTime();
        $today->setTime(0, 0);
        $tomorrow = clone $today;
        $tomorrow->add(new \DateInterval('P1D'));

        return (int) $this->getEntityManager()
          ->createQuery('
              SELECT COUNT(p)
              FROM UJM\ExoBundle\Entity\Attempt\Paper AS p
              WHERE p.user = :user
                AND p.exercise = :exercise
                AND p.end >= :today
                AND p.end <= :tomorrow
          ')
          ->setParameters([
              'user' => $user,
              'exercise' => $exercise,
              'today' => $today,
              'tomorrow' => $tomorrow,
          ])
          ->getSingleScalarResult();
    }
public function countUserFinishedDayPapers(Exercise $exercise, User $user)
    {
        $today = new \DateTime();
        $today->setTime(0, 0);
        $tomorrow = clone $today;
        $tomorrow->add(new \DateInterval('P1D'));

        return (int) $this->getEntityManager()
          ->createQuery('
              SELECT COUNT(p)
              FROM UJM\ExoBundle\Entity\Attempt\Paper AS p
              WHERE p.user = :user
                AND p.exercise = :exercise
                AND p.end >= :today
                AND p.end <= :tomorrow
          ')
          ->setParameters([
              'user' => $user,
              'exercise' => $exercise,
              'today' => $today,
              'tomorrow' => $tomorrow,
          ])
          ->getSingleScalarResult();
    }
public function countUserFinishedDayPapers ( Exercise $ exercise , User $ user ) { $ today = new \ DateTime ( ) ; $ today -> setTime ( 0 , 0 ) ; $ tomorrow = clone $ today ; $ tomorrow -> add ( new \ DateInterval ( 'P1D' ) ) ; return ( int ) $ this -> getEntityManager ( ) -> createQuery ( '
              SELECT COUNT(p)
              FROM UJM\ExoBundle\Entity\Attempt\Paper AS p
              WHERE p.user = :user
                AND p.exercise = :exercise
                AND p.end >= :today
                AND p.end <= :tomorrow
          ' ) -> setParameters ( [ 'user' => $ user , 'exercise' => $ exercise , 'today' => $ today , 'tomorrow' => $ tomorrow , ] ) -> getSingleScalarResult ( ) ; }
Returns the unfinished papers of a user for a given exercise for the current day, if any.

@param Exercise $exercise
@param User     $user

@return Paper[]
Returns the unfinished papers of a user for a given exercise for the current day if any .