]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Tag.php
CS
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Tag.php
index 5aed1fa010008727e3550a6763f710d291ec212f..6f005314f69fd8e33a2e253a0d135bf74913171c 100644 (file)
@@ -9,17 +9,17 @@ use JMS\Serializer\Annotation\Expose;
 use Doctrine\Common\Collections\ArrayCollection;
 
 /**
- * Tag
+ * Tag.
  *
  * @XmlRoot("tag")
- * @ORM\Table(name="tag")
+ * @ORM\Table
  * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TagRepository")
  * @ExclusionPolicy("all")
  */
 class Tag
 {
     /**
-     * @var integer
+     * @var int
      *
      * @Expose
      * @ORM\Column(name="id", type="integer")
@@ -41,14 +41,26 @@ class Tag
      */
     private $entries;
 
-    public function __construct()
+    /**
+     * @ORM\ManyToOne(targetEntity="User", inversedBy="tags")
+     */
+    private $user;
+
+    public function __construct(User $user)
     {
+        $this->user = $user;
         $this->entries = new ArrayCollection();
     }
+
+    public function __toString()
+    {
+        return $this->label;
+    }
+
     /**
-     * Get id
+     * Get id.
      *
-     * @return integer
+     * @return int
      */
     public function getId()
     {
@@ -56,9 +68,10 @@ class Tag
     }
 
     /**
-     * Set label
+     * Set label.
+     *
+     * @param string $label
      *
-     * @param  string $label
      * @return Tag
      */
     public function setLabel($label)
@@ -69,7 +82,7 @@ class Tag
     }
 
     /**
-     * Get label
+     * Get label.
      *
      * @return string
      */
@@ -82,4 +95,12 @@ class Tag
     {
         $this->entries[] = $entry;
     }
+
+    /**
+     * @return User
+     */
+    public function getUser()
+    {
+        return $this->user;
+    }
 }