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