3 namespace Wallabag\CoreBundle\Entity
;
5 use Doctrine\Common\Collections\ArrayCollection
;
6 use Doctrine\ORM\Mapping
as ORM
;
7 use JMS\Serializer\Annotation\ExclusionPolicy
;
8 use JMS\Serializer\Annotation\Expose
;
9 use Gedmo\Mapping\Annotation
as Gedmo
;
10 use JMS\Serializer\Annotation\XmlRoot
;
16 * @ORM\Table(name="`tag`")
17 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TagRepository")
18 * @ExclusionPolicy("all")
26 * @ORM\Column(name="id", type="integer")
28 * @ORM\GeneratedValue(strategy="AUTO")
36 * @ORM\Column(name="label", type="text")
42 * @Gedmo\Slug(fields={"label"})
43 * @ORM\Column(length=128, unique=true)
48 * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"})
52 public function __construct()
54 $this->entries
= new ArrayCollection();
57 public function __toString()
67 public function getId()
75 * @param string $label
79 public function setLabel($label)
81 $this->label
= $label;
91 public function getLabel()
96 public function getSlug()
101 public function addEntry(Entry
$entry)
103 $this->entries
[] = $entry;
106 public function hasEntry($entry)
108 return $this->entries
->contains($entry);