diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2015-12-28 13:37:13 +0100 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2015-12-28 13:37:13 +0100 |
commit | d25b8288216a09fa5cf7f40e614c133a6edd8a67 (patch) | |
tree | 1ef927c8180a9f9ff3cb54f774e72d87b166f0b2 /src/Wallabag/CoreBundle/Entity | |
parent | 82899c040258896bff540080602e93aa49a71ae8 (diff) | |
parent | e9fa8c40aaf1c4fc356057bc7b248ce80c0766b0 (diff) | |
download | wallabag-d25b8288216a09fa5cf7f40e614c133a6edd8a67.tar.gz wallabag-d25b8288216a09fa5cf7f40e614c133a6edd8a67.tar.zst wallabag-d25b8288216a09fa5cf7f40e614c133a6edd8a67.zip |
Merge pull request #1542 from wallabag/v2-avoid-duplicate-tag
v2 – Avoid multiple tag creation
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 608ed2f0..2813c944 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -462,6 +462,14 @@ class Entry | |||
462 | return; | 462 | return; |
463 | } | 463 | } |
464 | 464 | ||
465 | // check if tag already exist but has not yet be persisted | ||
466 | // it seems that the previous condition with `contains()` doesn't check that case | ||
467 | foreach ($this->tags as $existingTag) { | ||
468 | if ($existingTag->getUser() !== $tag->getUser() || $existingTag->getLabel() === $tag->getLabel()) { | ||
469 | return; | ||
470 | } | ||
471 | } | ||
472 | |||
465 | $this->tags[] = $tag; | 473 | $this->tags[] = $tag; |
466 | $tag->addEntry($this); | 474 | $tag->addEntry($this); |
467 | } | 475 | } |