X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=inline;f=src%2FWallabag%2FCoreBundle%2FEntity%2FEntry.php;h=5e608f05d909a57d99ab0b8a4977721d510e5ae9;hb=17b3d026fd6262d48a038d90bacea44a9be339e0;hp=5cf84f03d5ae0b5f779dc4248b63aa348d8e2cdb;hpb=f38e03dc02c96344677fd2720912605b21c90b5d;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 5cf84f03..5e608f05 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -7,9 +7,12 @@ use Doctrine\ORM\Mapping as ORM; use Hateoas\Configuration\Annotation as Hateoas; use JMS\Serializer\Annotation\Groups; use JMS\Serializer\Annotation\XmlRoot; +use JMS\Serializer\Annotation\Exclude; +use JMS\Serializer\Annotation\VirtualProperty; +use JMS\Serializer\Annotation\SerializedName; use Symfony\Component\Validator\Constraints as Assert; use Wallabag\UserBundle\Entity\User; -use Wallabag\CommentBundle\Entity\Comment; +use Wallabag\AnnotationBundle\Entity\Annotation; /** * Entry. @@ -99,12 +102,12 @@ class Entry private $updatedAt; /** - * @ORM\OneToMany(targetEntity="Wallabag\CommentBundle\Entity\Comment", mappedBy="entry", cascade={"persist", "remove"}) + * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"}) * @ORM\JoinTable * * @Groups({"entries_for_user", "export_all"}) */ - private $comments; + private $annotations; /** * @var string @@ -161,6 +164,8 @@ class Entry private $isPublic; /** + * @Exclude + * * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries") * * @Groups({"export_all"}) @@ -336,6 +341,33 @@ class Entry return $this->user; } + /** + * @VirtualProperty + * @SerializedName("user_name") + */ + public function getUserName() + { + return $this->user->getUserName(); + } + + /** + * @VirtualProperty + * @SerializedName("user_email") + */ + public function getUserEmail() + { + return $this->user->getEmail(); + } + + /** + * @VirtualProperty + * @SerializedName("user_id") + */ + public function getUserId() + { + return $this->user->getId(); + } + /** * @return string */ @@ -366,19 +398,19 @@ class Entry } /** - * @return ArrayCollection + * @return ArrayCollection */ - public function getComments() + public function getAnnotations() { - return $this->comments; + return $this->annotations; } /** - * @param Comment $comment + * @param Annotation $annotation */ - public function setComment(Comment $comment) + public function setAnnotation(Annotation $annotation) { - $this->comments[] = $comment; + $this->annotations[] = $annotation; } /**