diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-11 21:01:30 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-11 21:01:30 +0200 |
commit | e4cf672ccf61689ba28c2e89fc55f83167800b18 (patch) | |
tree | 5dc22c97797bdcdd0a3d2a7e182410f04a748c1e /src/Wallabag/CoreBundle/Repository/EntryRepository.php | |
parent | e57df5611fe82ce61a71d51c762ee9296f18c3ac (diff) | |
parent | dbe94e73a9eaf3acb250812913b0303b35d01a2e (diff) | |
download | wallabag-e4cf672ccf61689ba28c2e89fc55f83167800b18.tar.gz wallabag-e4cf672ccf61689ba28c2e89fc55f83167800b18.tar.zst wallabag-e4cf672ccf61689ba28c2e89fc55f83167800b18.zip |
Merge remote-tracking branch 'origin/master' into 2.2
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 75127b7d..cd2b47b9 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -309,4 +309,24 @@ class EntryRepository extends EntityRepository | |||
309 | 309 | ||
310 | return $qb->getQuery()->getSingleScalarResult(); | 310 | return $qb->getQuery()->getSingleScalarResult(); |
311 | } | 311 | } |
312 | |||
313 | /** | ||
314 | * Count all entries for a tag and a user. | ||
315 | * | ||
316 | * @param int $userId | ||
317 | * @param int $tagId | ||
318 | * | ||
319 | * @return int | ||
320 | */ | ||
321 | public function countAllEntriesByUserIdAndTagId($userId, $tagId) | ||
322 | { | ||
323 | $qb = $this->createQueryBuilder('e') | ||
324 | ->select('count(e.id)') | ||
325 | ->leftJoin('e.tags', 't') | ||
326 | ->where('e.user=:userId')->setParameter('userId', $userId) | ||
327 | ->andWhere('t.id=:tagId')->setParameter('tagId', $tagId) | ||
328 | ; | ||
329 | |||
330 | return $qb->getQuery()->getSingleScalarResult(); | ||
331 | } | ||
312 | } | 332 | } |