1 | <?php |
||
16 | class BadgeCompletionRepository extends EntityRepository implements |
||
17 | BadgeCompletionRepositoryInterface, |
||
18 | TagSearchableRepositoryInterface |
||
19 | { |
||
20 | /** |
||
21 | * {@inheritdoc} |
||
22 | */ |
||
23 | public function getCompletionBadgesByUser(UserInterface $user, $pending = null) |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function userHasBadge(UserInterface $user, BadgeInterface $badge) |
||
46 | { |
||
47 | $qb = $this->getEntityManager()->createQueryBuilder(); |
||
48 | $qb->select('COUNT(badge.id)') |
||
49 | ->from('GameBundle:BadgeCompletion', 'completion') |
||
50 | ->leftJoin('completion.badge', 'badge') |
||
51 | ->where('completion.user = :user') |
||
52 | ->andWhere('completion.badge = :badge') |
||
53 | ->andWhere('completion.pending = 0') |
||
54 | ->setParameter('user', $user) |
||
55 | ->setParameter('badge', $badge); |
||
56 | |||
57 | return (1 === intval($qb->getQuery()->getSingleScalarResult())); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * {@inheritdoc} |
||
62 | */ |
||
63 | public function findByTags(array $tags) |
||
80 | |||
81 | |||
82 | } |
||
83 |