diff options
author | Nicolas Hart <contact@nclshart.net> | 2017-08-06 21:58:14 +0200 |
---|---|---|
committer | Nicolas Hart <contact@nclshart.net> | 2017-08-06 23:02:32 +0200 |
commit | 935e9fffb4083f83e86c4e97a32bc2d9bccd677f (patch) | |
tree | f4607a17b6d6bf27bcc3e7f232ac692b1e3dece7 /src/Wallabag/CoreBundle/Repository/EntryRepository.php | |
parent | f11a3cf21ca77f16b5dff3a6d015f2043317c596 (diff) | |
download | wallabag-935e9fffb4083f83e86c4e97a32bc2d9bccd677f.tar.gz wallabag-935e9fffb4083f83e86c4e97a32bc2d9bccd677f.tar.zst wallabag-935e9fffb4083f83e86c4e97a32bc2d9bccd677f.zip |
Reduce number of queries on tag list
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 7f35bb9a..d70d6ca6 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -330,26 +330,6 @@ class EntryRepository extends EntityRepository | |||
330 | } | 330 | } |
331 | 331 | ||
332 | /** | 332 | /** |
333 | * Count all entries for a tag and a user. | ||
334 | * | ||
335 | * @param int $userId | ||
336 | * @param int $tagId | ||
337 | * | ||
338 | * @return int | ||
339 | */ | ||
340 | public function countAllEntriesByUserIdAndTagId($userId, $tagId) | ||
341 | { | ||
342 | $qb = $this->createQueryBuilder('e') | ||
343 | ->select('count(e.id)') | ||
344 | ->leftJoin('e.tags', 't') | ||
345 | ->where('e.user=:userId')->setParameter('userId', $userId) | ||
346 | ->andWhere('t.id=:tagId')->setParameter('tagId', $tagId) | ||
347 | ; | ||
348 | |||
349 | return (int) $qb->getQuery()->getSingleScalarResult(); | ||
350 | } | ||
351 | |||
352 | /** | ||
353 | * Remove all entries for a user id. | 333 | * Remove all entries for a user id. |
354 | * Used when a user want to reset all informations. | 334 | * Used when a user want to reset all informations. |
355 | * | 335 | * |