]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Entity/Tag.php
POST entries/tags with test
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Tag.php
CommitLineData
9d50517c
NL
1<?php
2
ad4d1caa 3namespace Wallabag\CoreBundle\Entity;
9d50517c
NL
4
5use Doctrine\ORM\Mapping as ORM;
6d37a7e6 6use JMS\Serializer\Annotation\XmlRoot;
0a018fe0
NL
7use JMS\Serializer\Annotation\ExclusionPolicy;
8use JMS\Serializer\Annotation\Expose;
46bbd8d3 9use Doctrine\Common\Collections\ArrayCollection;
9d50517c
NL
10
11/**
653e8be4 12 * Tag
9d50517c 13 *
6d37a7e6 14 * @XmlRoot("tag")
653e8be4 15 * @ORM\Table(name="tag")
6d37a7e6 16 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TagRepository")
0a018fe0 17 * @ExclusionPolicy("all")
9d50517c 18 */
653e8be4 19class Tag
9d50517c
NL
20{
21 /**
22 * @var integer
23 *
0a018fe0 24 * @Expose
653e8be4 25 * @ORM\Column(name="id", type="integer")
9d50517c 26 * @ORM\Id
653e8be4 27 * @ORM\GeneratedValue(strategy="AUTO")
9d50517c
NL
28 */
29 private $id;
30
31 /**
32 * @var string
33 *
0a018fe0 34 * @Expose
653e8be4 35 * @ORM\Column(name="label", type="text")
9d50517c 36 */
653e8be4 37 private $label;
9d50517c 38
0a018fe0 39 /**
46bbd8d3 40 * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"})
0a018fe0
NL
41 */
42 private $entries;
43
46bbd8d3
NL
44 public function __construct()
45 {
46 $this->entries = new ArrayCollection();
47 }
9d50517c
NL
48 /**
49 * Get id
50 *
7df80cb3 51 * @return integer
9d50517c
NL
52 */
53 public function getId()
54 {
55 return $this->id;
56 }
57
58 /**
653e8be4 59 * Set label
9d50517c 60 *
653e8be4
NL
61 * @param string $label
62 * @return Tag
9d50517c 63 */
653e8be4 64 public function setLabel($label)
9d50517c 65 {
653e8be4 66 $this->label = $label;
9d50517c
NL
67
68 return $this;
69 }
70
71 /**
653e8be4 72 * Get label
9d50517c 73 *
7df80cb3 74 * @return string
9d50517c 75 */
653e8be4 76 public function getLabel()
9d50517c 77 {
2691cf04 78 return $this->label;
9d50517c 79 }
46bbd8d3
NL
80
81 public function addEntry(Entry $entry)
82 {
83 $this->entries[] = $entry;
84 }
9d50517c 85}