diff options
author | ArthurHoaro <arthur@hoa.ro> | 2021-01-20 14:45:59 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2021-01-20 15:01:29 +0100 |
commit | 9b8c0a4560fa1d87cab1529099b1b4677e92e265 (patch) | |
tree | 330a9b1a42ff7b7f24a76612b57fae63417ef483 /application/api/controllers/Tags.php | |
parent | 055d97f9a9e67d8ee8ae81bbf59a4b846a145d9f (diff) | |
download | Shaarli-9b8c0a4560fa1d87cab1529099b1b4677e92e265.tar.gz Shaarli-9b8c0a4560fa1d87cab1529099b1b4677e92e265.tar.zst Shaarli-9b8c0a4560fa1d87cab1529099b1b4677e92e265.zip |
Handle pagination through BookmarkService
Handle all search results through SearchResult object.
This is a required step toward implementing a BookmarkService based on SQL database.
Related to #953
Diffstat (limited to 'application/api/controllers/Tags.php')
-rw-r--r-- | application/api/controllers/Tags.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/application/api/controllers/Tags.php b/application/api/controllers/Tags.php index e60e00a7..5a23f6db 100644 --- a/application/api/controllers/Tags.php +++ b/application/api/controllers/Tags.php | |||
@@ -122,12 +122,12 @@ class Tags extends ApiController | |||
122 | throw new ApiBadParametersException('New tag name is required in the request body'); | 122 | throw new ApiBadParametersException('New tag name is required in the request body'); |
123 | } | 123 | } |
124 | 124 | ||
125 | $bookmarks = $this->bookmarkService->search( | 125 | $searchResult = $this->bookmarkService->search( |
126 | ['searchtags' => $args['tagName']], | 126 | ['searchtags' => $args['tagName']], |
127 | BookmarkFilter::$ALL, | 127 | BookmarkFilter::$ALL, |
128 | true | 128 | true |
129 | ); | 129 | ); |
130 | foreach ($bookmarks as $bookmark) { | 130 | foreach ($searchResult->getBookmarks() as $bookmark) { |
131 | $bookmark->renameTag($args['tagName'], $data['name']); | 131 | $bookmark->renameTag($args['tagName'], $data['name']); |
132 | $this->bookmarkService->set($bookmark, false); | 132 | $this->bookmarkService->set($bookmark, false); |
133 | $this->history->updateLink($bookmark); | 133 | $this->history->updateLink($bookmark); |
@@ -157,12 +157,12 @@ class Tags extends ApiController | |||
157 | throw new ApiTagNotFoundException(); | 157 | throw new ApiTagNotFoundException(); |
158 | } | 158 | } |
159 | 159 | ||
160 | $bookmarks = $this->bookmarkService->search( | 160 | $searchResult = $this->bookmarkService->search( |
161 | ['searchtags' => $args['tagName']], | 161 | ['searchtags' => $args['tagName']], |
162 | BookmarkFilter::$ALL, | 162 | BookmarkFilter::$ALL, |
163 | true | 163 | true |
164 | ); | 164 | ); |
165 | foreach ($bookmarks as $bookmark) { | 165 | foreach ($searchResult->getBookmarks() as $bookmark) { |
166 | $bookmark->deleteTag($args['tagName']); | 166 | $bookmark->deleteTag($args['tagName']); |
167 | $this->bookmarkService->set($bookmark, false); | 167 | $this->bookmarkService->set($bookmark, false); |
168 | $this->history->updateLink($bookmark); | 168 | $this->history->updateLink($bookmark); |