aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/TagRepository.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-25 12:23:44 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-25 12:23:44 +0200
commit289875836a09944f5993d33753042abfef13809e (patch)
tree451f2c7ec7011f1f0ee8911fb1921b02f158e1dc /src/Wallabag/CoreBundle/Repository/TagRepository.php
parent82fc3290d4fec45ede270e2c1ad2079fe3020adc (diff)
downloadwallabag-289875836a09944f5993d33753042abfef13809e.tar.gz
wallabag-289875836a09944f5993d33753042abfef13809e.tar.zst
wallabag-289875836a09944f5993d33753042abfef13809e.zip
Fix tag count for PostgreSQL
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/TagRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/TagRepository.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php
index f5c4ea6a..9d127da7 100644
--- a/src/Wallabag/CoreBundle/Repository/TagRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php
@@ -7,17 +7,17 @@ use Doctrine\ORM\EntityRepository;
7class TagRepository extends EntityRepository 7class TagRepository extends EntityRepository
8{ 8{
9 /** 9 /**
10 * Find all tags per user. 10 * Count all tags per user.
11 * 11 *
12 * @param int $userId 12 * @param int $userId
13 * @param int $cacheLifeTime Duration of the cache for this query 13 * @param int $cacheLifeTime Duration of the cache for this query
14 * 14 *
15 * @return array 15 * @return int
16 */ 16 */
17 public function findAllTags($userId, $cacheLifeTime = null) 17 public function countAllTags($userId, $cacheLifeTime = null)
18 { 18 {
19 $query = $this->createQueryBuilder('t') 19 $query = $this->createQueryBuilder('t')
20 ->select('t') 20 ->select('t.slug')
21 ->leftJoin('t.entries', 'e') 21 ->leftJoin('t.entries', 'e')
22 ->where('e.user = :userId')->setParameter('userId', $userId) 22 ->where('e.user = :userId')->setParameter('userId', $userId)
23 ->groupBy('t.slug') 23 ->groupBy('t.slug')
@@ -29,7 +29,7 @@ class TagRepository extends EntityRepository
29 $query->setResultCacheLifetime($cacheLifeTime); 29 $query->setResultCacheLifetime($cacheLifeTime);
30 } 30 }
31 31
32 return $query->getArrayResult(); 32 return count($query->getArrayResult());
33 } 33 }
34 34
35 /** 35 /**