aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
index 239d09ae..b490e209 100644
--- a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
+++ b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
@@ -55,6 +55,7 @@ class RuleBasedTagger
55 { 55 {
56 $rules = $this->getRulesForUser($user); 56 $rules = $this->getRulesForUser($user);
57 $entries = []; 57 $entries = [];
58 $tagsCache = [];
58 59
59 foreach ($rules as $rule) { 60 foreach ($rules as $rule) {
60 $qb = $this->entryRepository->getBuilderForAllByUser($user->getId()); 61 $qb = $this->entryRepository->getBuilderForAllByUser($user->getId());
@@ -62,7 +63,12 @@ class RuleBasedTagger
62 63
63 foreach ($entries as $entry) { 64 foreach ($entries as $entry) {
64 foreach ($rule->getTags() as $label) { 65 foreach ($rule->getTags() as $label) {
65 $tag = $this->getTag($label); 66 // avoid new tag duplicate by manually caching them
67 if (!isset($tagsCache[$label])) {
68 $tagsCache[$label] = $this->getTag($label);
69 }
70
71 $tag = $tagsCache[$label];
66 72
67 $entry->addTag($tag); 73 $entry->addTag($tag);
68 } 74 }