From a05b61159e147776f63baee731b5026796e5f7ae Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 30 Jun 2017 16:54:26 +0200 Subject: Fix PATCH method The PATCH method for the entry should only update what user sent to us and not the whole entry as it was before. Also, sending tags when patching an entry will now remove all current tags & assocatied new ones. --- src/Wallabag/CoreBundle/Entity/Entry.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Wallabag/CoreBundle/Entity') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 581e8906..cba72d31 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -593,6 +593,11 @@ class Entry $tag->addEntry($this); } + /** + * Remove the given tag from the entry (if the tag is associated). + * + * @param Tag $tag + */ public function removeTag(Tag $tag) { if (!$this->tags->contains($tag)) { @@ -603,6 +608,17 @@ class Entry $tag->removeEntry($this); } + /** + * Remove all assigned tags from the entry. + */ + public function removeAllTags() + { + foreach ($this->tags as $tag) { + $this->tags->removeElement($tag); + $tag->removeEntry($this); + } + } + /** * Set previewPicture. * -- cgit v1.2.3