diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-06-30 16:54:26 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-03 13:45:04 +0200 |
commit | a05b61159e147776f63baee731b5026796e5f7ae (patch) | |
tree | 80dae1ea169f3fb072a7aa2072f24507e10e91ed /src/Wallabag/CoreBundle/Entity | |
parent | 71e1cbc8eb5928d393b0772055d6b711e90a09b3 (diff) | |
download | wallabag-a05b61159e147776f63baee731b5026796e5f7ae.tar.gz wallabag-a05b61159e147776f63baee731b5026796e5f7ae.tar.zst wallabag-a05b61159e147776f63baee731b5026796e5f7ae.zip |
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.
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 16 |
1 files changed, 16 insertions, 0 deletions
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 | |||
593 | $tag->addEntry($this); | 593 | $tag->addEntry($this); |
594 | } | 594 | } |
595 | 595 | ||
596 | /** | ||
597 | * Remove the given tag from the entry (if the tag is associated). | ||
598 | * | ||
599 | * @param Tag $tag | ||
600 | */ | ||
596 | public function removeTag(Tag $tag) | 601 | public function removeTag(Tag $tag) |
597 | { | 602 | { |
598 | if (!$this->tags->contains($tag)) { | 603 | if (!$this->tags->contains($tag)) { |
@@ -604,6 +609,17 @@ class Entry | |||
604 | } | 609 | } |
605 | 610 | ||
606 | /** | 611 | /** |
612 | * Remove all assigned tags from the entry. | ||
613 | */ | ||
614 | public function removeAllTags() | ||
615 | { | ||
616 | foreach ($this->tags as $tag) { | ||
617 | $this->tags->removeElement($tag); | ||
618 | $tag->removeEntry($this); | ||
619 | } | ||
620 | } | ||
621 | |||
622 | /** | ||
607 | * Set previewPicture. | 623 | * Set previewPicture. |
608 | * | 624 | * |
609 | * @param string $previewPicture | 625 | * @param string $previewPicture |