]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Entry.php
changed french translation from commentaire to annotation
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Entry.php
index 2813c94420c8a55d9523c18e5f2b0f3715f7cb4f..5cf84f03d5ae0b5f779dc4248b63aa348d8e2cdb 100644 (file)
@@ -4,11 +4,12 @@ namespace Wallabag\CoreBundle\Entity;
 
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\ORM\Mapping as ORM;
-use Symfony\Component\Validator\Constraints as Assert;
 use Hateoas\Configuration\Annotation as Hateoas;
 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;
 
@@ -168,7 +168,7 @@ class Entry
     private $user;
 
     /**
-     * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist"})
+     * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist", "remove"})
      * @ORM\JoinTable
      *
      * @Groups({"entries_for_user", "export_all"})
@@ -245,7 +245,7 @@ class Entry
     /**
      * Set isArchived.
      *
-     * @param string $isArchived
+     * @param bool $isArchived
      *
      * @return Entry
      */
@@ -259,7 +259,7 @@ class Entry
     /**
      * Get isArchived.
      *
-     * @return string
+     * @return bool
      */
     public function isArchived()
     {
@@ -276,7 +276,7 @@ class Entry
     /**
      * Set isStarred.
      *
-     * @param string $isStarred
+     * @param bool $isStarred
      *
      * @return Entry
      */
@@ -290,7 +290,7 @@ class Entry
     /**
      * Get isStarred.
      *
-     * @return string
+     * @return bool
      */
     public function isStarred()
     {
@@ -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;
     }
 
     /**
@@ -465,7 +465,7 @@ class Entry
         // check if tag already exist but has not yet be persisted
         // it seems that the previous condition with `contains()` doesn't check that case
         foreach ($this->tags as $existingTag) {
-            if ($existingTag->getUser() !== $tag->getUser() || $existingTag->getLabel() === $tag->getLabel()) {
+            if ($existingTag->getLabel() === $tag->getLabel()) {
                 return;
             }
         }