diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-03-13 20:17:52 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2016-03-13 20:17:52 +0100 |
commit | 7d1fdab2bb918cb82b926c2079e15d779f42018c (patch) | |
tree | a52e62f18a024981864f879d7a0fffab273e28ee /src | |
parent | 6ab56c7b2c225b74b000e9ecedfe28aa0f8d1e18 (diff) | |
download | wallabag-7d1fdab2bb918cb82b926c2079e15d779f42018c.tar.gz wallabag-7d1fdab2bb918cb82b926c2079e15d779f42018c.tar.zst wallabag-7d1fdab2bb918cb82b926c2079e15d779f42018c.zip |
API shows just what needed for user
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 32 |
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; | |||
7 | use Hateoas\Configuration\Annotation as Hateoas; | 7 | use Hateoas\Configuration\Annotation as Hateoas; |
8 | use JMS\Serializer\Annotation\Groups; | 8 | use JMS\Serializer\Annotation\Groups; |
9 | use JMS\Serializer\Annotation\XmlRoot; | 9 | use JMS\Serializer\Annotation\XmlRoot; |
10 | use JMS\Serializer\Annotation\Exclude; | ||
11 | use JMS\Serializer\Annotation\VirtualProperty; | ||
12 | use JMS\Serializer\Annotation\SerializedName; | ||
10 | use Symfony\Component\Validator\Constraints as Assert; | 13 | use Symfony\Component\Validator\Constraints as Assert; |
11 | use Wallabag\UserBundle\Entity\User; | 14 | use Wallabag\UserBundle\Entity\User; |
12 | use Wallabag\AnnotationBundle\Entity\Annotation; | 15 | use 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() |