JuryRepository.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace Entity\Repository;
  3. use Doctrine\ORM\EntityRepository;
  4. use Doctrine\Common\Collections\Criteria;
  5. /**
  6. * JuryRepository
  7. *
  8. */
  9. class JuryRepository extends EntityRepository
  10. {
  11. /**
  12. * Get all users that are registered in the course. No matter the status
  13. *
  14. * @param \Entity\Course $course
  15. * @return \Doctrine\ORM\QueryBuilder
  16. */
  17. public function getJuryByPresidentId($userId)
  18. {
  19. $qb = $this->createQueryBuilder('a');
  20. //Selecting user info
  21. $qb->select('DISTINCT u');
  22. // Loading EntityUser
  23. $qb->from('Entity\Jury', 'u');
  24. // Selecting members
  25. $qb->innerJoin('u.members', 'c');
  26. // Inner join with the table c_quiz_question_rel_category.
  27. $qb->innerJoin('c.role', 'r');
  28. //@todo check app settings
  29. //$qb->add('orderBy', 'u.lastname ASC');
  30. $wherePart = $qb->expr()->andx();
  31. //Get only users subscribed to this course
  32. $wherePart->add($qb->expr()->eq('r.role', $qb->expr()->literal('ROLE_JURY_PRESIDENT')));
  33. $wherePart->add($qb->expr()->eq('c.userId', $userId));
  34. $qb->where($wherePart);
  35. $q = $qb->getQuery();
  36. return $q->getSingleResult();
  37. //return $qb;
  38. }
  39. public function getExerciseAttemptsByJury($juryId)
  40. {
  41. }
  42. }