diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-10-09 21:27:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-09 21:27:47 +0200 |
commit | 47508f004fe9a17a8012187f37032f4155d507f4 (patch) | |
tree | 69e089f1bafa49a553b28cf2aefc4f5c0192697d /src/Wallabag/CoreBundle/Repository/TagRepository.php | |
parent | e39aec3e38144f1a2ddb0027ec724e3dfd6f53f1 (diff) | |
parent | e08477803079d0097885e026797256da7fd30f6c (diff) | |
download | wallabag-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/TagRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/TagRepository.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index 9d127da7..e76878d4 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php | |||
@@ -33,19 +33,23 @@ class TagRepository extends EntityRepository | |||
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Find all tags with associated entries per user. | 36 | * Find all tags per user. |
37 | * | 37 | * |
38 | * @param int $userId | 38 | * @param int $userId |
39 | * | 39 | * |
40 | * @return array | 40 | * @return array |
41 | */ | 41 | */ |
42 | public function findAllTagsWithEntries($userId) | 42 | public function findAllTags($userId) |
43 | { | 43 | { |
44 | return $this->createQueryBuilder('t') | 44 | return $this->createQueryBuilder('t') |
45 | ->select('t.slug', 't.label', 't.id') | ||
45 | ->leftJoin('t.entries', 'e') | 46 | ->leftJoin('t.entries', 'e') |
46 | ->where('e.user = :userId')->setParameter('userId', $userId) | 47 | ->where('e.user = :userId')->setParameter('userId', $userId) |
48 | ->groupBy('t.slug') | ||
49 | ->addGroupBy('t.label') | ||
50 | ->addGroupBy('t.id') | ||
47 | ->getQuery() | 51 | ->getQuery() |
48 | ->getResult(); | 52 | ->getArrayResult(); |
49 | } | 53 | } |
50 | 54 | ||
51 | /** | 55 | /** |