aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-03-14 06:15:46 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-03-14 06:15:46 +0100
commit17b3d026fd6262d48a038d90bacea44a9be339e0 (patch)
tree0a4a62b696d31f9932cba3ff3e957a4eb148338c
parent5cc9b5151ff754773dd492a2705f18c93c611ff9 (diff)
parent7d1fdab2bb918cb82b926c2079e15d779f42018c (diff)
downloadwallabag-17b3d026fd6262d48a038d90bacea44a9be339e0.tar.gz
wallabag-17b3d026fd6262d48a038d90bacea44a9be339e0.tar.zst
wallabag-17b3d026fd6262d48a038d90bacea44a9be339e0.zip
Merge pull request #1786 from wallabag/v2-restrict-user-infos
API shows just what needed for user
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index bd712a04..5e608f05 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -7,6 +7,9 @@ use Doctrine\ORM\Mapping as ORM;
7use Hateoas\Configuration\Annotation as Hateoas; 7use Hateoas\Configuration\Annotation as Hateoas;
8use JMS\Serializer\Annotation\Groups; 8use JMS\Serializer\Annotation\Groups;
9use JMS\Serializer\Annotation\XmlRoot; 9use JMS\Serializer\Annotation\XmlRoot;
10use JMS\Serializer\Annotation\Exclude;
11use JMS\Serializer\Annotation\VirtualProperty;
12use JMS\Serializer\Annotation\SerializedName;
10use Symfony\Component\Validator\Constraints as Assert; 13use Symfony\Component\Validator\Constraints as Assert;
11use Wallabag\UserBundle\Entity\User; 14use Wallabag\UserBundle\Entity\User;
12use Wallabag\AnnotationBundle\Entity\Annotation; 15use Wallabag\AnnotationBundle\Entity\Annotation;
@@ -161,6 +164,8 @@ class Entry
161 private $isPublic; 164 private $isPublic;
162 165
163 /** 166 /**
167 * @Exclude
168 *
164 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries") 169 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries")
165 * 170 *
166 * @Groups({"export_all"}) 171 * @Groups({"export_all"})
@@ -337,6 +342,33 @@ class Entry
337 } 342 }
338 343
339 /** 344 /**
345 * @VirtualProperty
346 * @SerializedName("user_name")
347 */
348 public function getUserName()
349 {
350 return $this->user->getUserName();
351 }
352
353 /**
354 * @VirtualProperty
355 * @SerializedName("user_email")
356 */
357 public function getUserEmail()
358 {
359 return $this->user->getEmail();
360 }
361
362 /**
363 * @VirtualProperty
364 * @SerializedName("user_id")
365 */
366 public function getUserId()
367 {
368 return $this->user->getId();
369 }
370
371 /**
340 * @return string 372 * @return string
341 */ 373 */
342 public function getCreatedAt() 374 public function getCreatedAt()