From b0458874c85060c992aa1cb78dec91ee85082b74 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 2 Oct 2016 16:06:42 +0200 Subject: Fix relations export for Entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tags & Annotations weren’t really well exported. This is now fixed (+ tests) --- src/Wallabag/CoreBundle/Entity/Entry.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity') diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index a4b0d7a8..f2da3f4d 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -196,8 +196,6 @@ class Entry * @ORM\JoinColumn(name="tag_id", referencedColumnName="id") * } * ) - * - * @Groups({"entries_for_user", "export_all"}) */ private $tags; @@ -541,6 +539,21 @@ class Entry return $this->tags; } + /** + * @VirtualProperty + * @SerializedName("tags") + * @Groups({"entries_for_user", "export_all"}) + */ + public function getSerializedTags() + { + $data = []; + foreach ($this->tags as $tag) { + $data[] = $tag->getLabel(); + } + + return $data; + } + /** * @param Tag $tag */ -- cgit v1.2.3