]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/front/controller/admin/ManageTagController.php
Merge pull request #1697 from ArthurHoaro/feature/pagination
[github/shaarli/Shaarli.git] / application / front / controller / admin / ManageTagController.php
index 8675a0c580bec714c4829948f24e04867f06acbe..1333cce72ef104a8c093aec164da71486b7e95f4 100644 (file)
@@ -57,9 +57,12 @@ class ManageTagController extends ShaarliAdminController
         }
 
         // TODO: move this to bookmark service
-        $count = 0;
-        $bookmarks = $this->container->bookmarkService->search(['searchtags' => $fromTag], BookmarkFilter::$ALL, true);
-        foreach ($bookmarks as $bookmark) {
+        $searchResult = $this->container->bookmarkService->search(
+            ['searchtags' => $fromTag],
+            BookmarkFilter::$ALL,
+            true
+        );
+        foreach ($searchResult->getBookmarks() as $bookmark) {
             if (false === $isDelete) {
                 $bookmark->renameTag($fromTag, $toTag);
             } else {
@@ -68,11 +71,11 @@ class ManageTagController extends ShaarliAdminController
 
             $this->container->bookmarkService->set($bookmark, false);
             $this->container->history->updateLink($bookmark);
-            $count++;
         }
 
         $this->container->bookmarkService->save();
 
+        $count = $searchResult->getResultCount();
         if (true === $isDelete) {
             $alert = sprintf(
                 t('The tag was removed from %d bookmark.', 'The tag was removed from %d bookmarks.', $count),