diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-03-14 06:15:46 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-03-14 06:15:46 +0100 |
commit | 17b3d026fd6262d48a038d90bacea44a9be339e0 (patch) | |
tree | 0a4a62b696d31f9932cba3ff3e957a4eb148338c /src/Wallabag | |
parent | 5cc9b5151ff754773dd492a2705f18c93c611ff9 (diff) | |
parent | 7d1fdab2bb918cb82b926c2079e15d779f42018c (diff) | |
download | wallabag-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
Diffstat (limited to 'src/Wallabag')
-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() |