]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Tag.php
Remove user reference in tag
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Tag.php
index 7cc452fd7f97b860f4eabadeaf9523ec95e4e5bd..0689c7b31854fc0dbd58c40ca105d8a1c9c7cc68 100644 (file)
@@ -7,6 +7,7 @@ use JMS\Serializer\Annotation\XmlRoot;
 use JMS\Serializer\Annotation\ExclusionPolicy;
 use JMS\Serializer\Annotation\Expose;
 use Doctrine\Common\Collections\ArrayCollection;
+use Gedmo\Mapping\Annotation as Gedmo;
 
 /**
  * Tag.
@@ -37,18 +38,19 @@ class Tag
     private $label;
 
     /**
-     * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"})
+     * @Expose
+     * @Gedmo\Slug(fields={"label"})
+     * @ORM\Column(length=128, unique=true)
      */
-    private $entries;
+    private $slug;
 
     /**
-     * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="tags")
+     * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"})
      */
-    private $user;
+    private $entries;
 
-    public function __construct(\Wallabag\UserBundle\Entity\User $user)
+    public function __construct()
     {
-        $this->user = $user;
         $this->entries = new ArrayCollection();
     }
 
@@ -91,6 +93,11 @@ class Tag
         return $this->label;
     }
 
+    public function getSlug()
+    {
+        return $this->slug;
+    }
+
     public function addEntry(Entry $entry)
     {
         $this->entries[] = $entry;
@@ -100,12 +107,4 @@ class Tag
     {
         return $this->entries->contains($entry);
     }
-
-    /**
-     * @return User
-     */
-    public function getUser()
-    {
-        return $this->user;
-    }
 }