aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/TagRepository.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-08-19 11:46:21 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-08-22 12:40:48 +0200
commit7244d6cb61912b80341595c56cc22d9bb56e6251 (patch)
treefdb958dd7a798ec52c013edd75df9e4233c08934 /src/Wallabag/CoreBundle/Repository/TagRepository.php
parent109d67dbb16478f927c3d6a46ab61ea9994aafae (diff)
downloadwallabag-7244d6cb61912b80341595c56cc22d9bb56e6251.tar.gz
wallabag-7244d6cb61912b80341595c56cc22d9bb56e6251.tar.zst
wallabag-7244d6cb61912b80341595c56cc22d9bb56e6251.zip
assign tags to an entry
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/TagRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/TagRepository.php17
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}