]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Entry.php
Comment work with annotator v2
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Entry.php
index bf8db5ab31b2c2468333dffa8629c853656f6590..5cf84f03d5ae0b5f779dc4248b63aa348d8e2cdb 100644 (file)
@@ -9,6 +9,7 @@ use JMS\Serializer\Annotation\Groups;
 use JMS\Serializer\Annotation\XmlRoot;
 use Symfony\Component\Validator\Constraints as Assert;
 use Wallabag\UserBundle\Entity\User;
+use Wallabag\CommentBundle\Entity\Comment;
 
 /**
  * Entry.
@@ -98,11 +99,10 @@ class Entry
     private $updatedAt;
 
     /**
-     * @var string
-     *
-     * @ORM\Column(name="comments", type="text", nullable=true)
+     * @ORM\OneToMany(targetEntity="Wallabag\CommentBundle\Entity\Comment", mappedBy="entry", cascade={"persist", "remove"})
+     * @ORM\JoinTable
      *
-     * @Groups({"export_all"})
+     * @Groups({"entries_for_user", "export_all"})
      */
     private $comments;
 
@@ -366,7 +366,7 @@ class Entry
     }
 
     /**
-     * @return string
+     * @return ArrayCollection<Comment>
      */
     public function getComments()
     {
@@ -374,11 +374,11 @@ class Entry
     }
 
     /**
-     * @param string $comments
+     * @param Comment $comment
      */
-    public function setComments($comments)
+    public function setComment(Comment $comment)
     {
-        $this->comments = $comments;
+        $this->comments[] = $comment;
     }
 
     /**