]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Tag.php
Remove ability to change username
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Tag.php
index 1cdf4df027cc772dcbedf8f8923276ded593a77a..9ae5867c6981ceccb04fbff2c24e1ef2d5a1567e 100644 (file)
@@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
 use JMS\Serializer\Annotation\XmlRoot;
 use JMS\Serializer\Annotation\ExclusionPolicy;
 use JMS\Serializer\Annotation\Expose;
+use Doctrine\Common\Collections\ArrayCollection;
 
 /**
  * Tag
@@ -36,10 +37,20 @@ class Tag
     private $label;
 
     /**
-     * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist", "merge"})
+     * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"})
      */
     private $entries;
 
+    /**
+     * @ORM\ManyToOne(targetEntity="User", inversedBy="tags")
+     */
+    private $user;
+
+    public function __construct(User $user)
+    {
+        $this->user    = $user;
+        $this->entries = new ArrayCollection();
+    }
     /**
      * Get id
      *
@@ -72,4 +83,17 @@ class Tag
     {
         return $this->label;
     }
+
+    public function addEntry(Entry $entry)
+    {
+        $this->entries[] = $entry;
+    }
+
+    /**
+     * @return User
+     */
+    public function getUser()
+    {
+        return $this->user;
+    }
 }