aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-10-09 21:27:47 +0200
committerGitHub <noreply@github.com>2016-10-09 21:27:47 +0200
commit47508f004fe9a17a8012187f37032f4155d507f4 (patch)
tree69e089f1bafa49a553b28cf2aefc4f5c0192697d /src/Wallabag/CoreBundle/Repository/EntryRepository.php
parente39aec3e38144f1a2ddb0027ec724e3dfd6f53f1 (diff)
parente08477803079d0097885e026797256da7fd30f6c (diff)
downloadwallabag-47508f004fe9a17a8012187f37032f4155d507f4.tar.gz
wallabag-47508f004fe9a17a8012187f37032f4155d507f4.tar.zst
wallabag-47508f004fe9a17a8012187f37032f4155d507f4.zip
Merge pull request #2410 from wallabag/tag-optim
Optimize tag list display
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php20
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}