diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/TagRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/TagRepository.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index 9c409607..ac3145a1 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php | |||
@@ -24,4 +24,21 @@ class TagRepository extends EntityRepository | |||
24 | 24 | ||
25 | return new Pagerfanta($pagerAdapter); | 25 | return new Pagerfanta($pagerAdapter); |
26 | } | 26 | } |
27 | |||
28 | /** | ||
29 | * Find a tag by its label and its owner. | ||
30 | * | ||
31 | * @param string $label | ||
32 | * @param int $userId | ||
33 | * | ||
34 | * @return Tag|null | ||
35 | */ | ||
36 | public function findOneByLabelAndUserId($label, $userId) | ||
37 | { | ||
38 | return $this->createQueryBuilder('t') | ||
39 | ->where('t.label = :label')->setParameter('label', $label) | ||
40 | ->andWhere('t.user = :user_id')->setParameter('user_id', $userId) | ||
41 | ->getQuery() | ||
42 | ->getOneOrNullResult(); | ||
43 | } | ||
27 | } | 44 | } |