diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2018-12-29 20:42:41 +0100 |
---|---|---|
committer | Kevin Decherf <kevin@kdecherf.com> | 2018-12-30 01:34:49 +0100 |
commit | 2a0e0a47d853937702d235bdb91df0ca0e3116b6 (patch) | |
tree | 74581804eab61b64733af6083f5e6c0d201a41cb /src/Wallabag/CoreBundle | |
parent | 0ee9848231d0a7a02fdc8e915d830ebaf6cc09c0 (diff) | |
download | wallabag-2a0e0a47d853937702d235bdb91df0ca0e3116b6.tar.gz wallabag-2a0e0a47d853937702d235bdb91df0ca0e3116b6.tar.zst wallabag-2a0e0a47d853937702d235bdb91df0ca0e3116b6.zip |
TagRestController: rewrite delete actions to only retrieve tags related to the user
Fixes #3815
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src/Wallabag/CoreBundle')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/TagRepository.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index bd2d9f97..8464a6a5 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php | |||
@@ -75,6 +75,23 @@ class TagRepository extends EntityRepository | |||
75 | ->getArrayResult(); | 75 | ->getArrayResult(); |
76 | } | 76 | } |
77 | 77 | ||
78 | public function findByLabelsAndUser($labels, $userId) | ||
79 | { | ||
80 | $qb = $this->getQueryBuilderByUser($userId) | ||
81 | ->select('t.id'); | ||
82 | |||
83 | $ids = $qb->andWhere($qb->expr()->in('t.label', $labels)) | ||
84 | ->getQuery() | ||
85 | ->getArrayResult(); | ||
86 | |||
87 | $tags = []; | ||
88 | foreach ($ids as $id) { | ||
89 | $tags[] = $this->find($id); | ||
90 | } | ||
91 | |||
92 | return $tags; | ||
93 | } | ||
94 | |||
78 | /** | 95 | /** |
79 | * Used only in test case to get a tag for our entry. | 96 | * Used only in test case to get a tag for our entry. |
80 | * | 97 | * |