]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Tag.php
relation between tags and entries
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Tag.php
index 1cdf4df027cc772dcbedf8f8923276ded593a77a..5aed1fa010008727e3550a6763f710d291ec212f 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,14 @@ class Tag
     private $label;
 
     /**
-     * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist", "merge"})
+     * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"})
      */
     private $entries;
 
+    public function __construct()
+    {
+        $this->entries = new ArrayCollection();
+    }
     /**
      * Get id
      *
@@ -72,4 +77,9 @@ class Tag
     {
         return $this->label;
     }
+
+    public function addEntry(Entry $entry)
+    {
+        $this->entries[] = $entry;
+    }
 }