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")
*/
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()
{
}
/**
- * Set label
+ * Set label.
+ *
+ * @param string $label
*
- * @param string $label
* @return Tag
*/
public function setLabel($label)
}
/**
- * Get label
+ * Get label.
*
* @return string
*/
{
$this->entries[] = $entry;
}
+
+ /**
+ * @return User
+ */
+ public function getUser()
+ {
+ return $this->user;
+ }
}