|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Mykees\TagBundle\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Tag |
|
9
|
|
|
* |
|
10
|
|
|
* @ORM\Table() |
|
11
|
|
|
* @ORM\Entity(repositoryClass="Mykees\TagBundle\Repository\TagRepository") |
|
12
|
|
|
*/ |
|
13
|
|
|
class Tag |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @var integer |
|
17
|
|
|
* |
|
18
|
|
|
* @ORM\Column(name="id", type="integer") |
|
19
|
|
|
* @ORM\Id |
|
20
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
|
21
|
|
|
*/ |
|
22
|
|
|
private $id; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
* |
|
27
|
|
|
* @ORM\Column(name="name", type="string", length=255) |
|
28
|
|
|
*/ |
|
29
|
|
|
private $name; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
* |
|
34
|
|
|
* @ORM\Column(name="slug", type="string", length=255) |
|
35
|
|
|
*/ |
|
36
|
|
|
private $slug; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @ORM\OneToMany(targetEntity="Mykees\TagBundle\Entity\TagRelation",mappedBy="tag", cascade={"persist", "merge", "remove"}, orphanRemoval=true) |
|
40
|
|
|
*/ |
|
41
|
|
|
private $tagRelation; |
|
42
|
|
|
|
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Get id |
|
46
|
|
|
* |
|
47
|
|
|
* @return integer |
|
48
|
|
|
*/ |
|
49
|
|
|
public function getId() |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->id; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Set name |
|
56
|
|
|
* |
|
57
|
|
|
* @param string $name |
|
58
|
|
|
* @return Tag |
|
59
|
|
|
*/ |
|
60
|
|
|
public function setName($name) |
|
61
|
|
|
{ |
|
62
|
|
|
$this->name = $name; |
|
63
|
|
|
|
|
64
|
|
|
return $this; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Get name |
|
69
|
|
|
* |
|
70
|
|
|
* @return string |
|
71
|
|
|
*/ |
|
72
|
|
|
public function getName() |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->name; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Set slug |
|
79
|
|
|
* |
|
80
|
|
|
* @param string $slug |
|
81
|
|
|
* @return Tag |
|
82
|
|
|
*/ |
|
83
|
|
|
public function setSlug($slug) |
|
84
|
|
|
{ |
|
85
|
|
|
$this->slug = $slug; |
|
86
|
|
|
|
|
87
|
|
|
return $this; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Get slug |
|
92
|
|
|
* |
|
93
|
|
|
* @return string |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getSlug() |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->slug; |
|
98
|
|
|
} |
|
99
|
|
|
/** |
|
100
|
|
|
* Constructor |
|
101
|
|
|
*/ |
|
102
|
|
|
public function __construct() |
|
103
|
|
|
{ |
|
104
|
|
|
$this->tagRelation = new \Doctrine\Common\Collections\ArrayCollection(); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* Add tagRelation |
|
109
|
|
|
* |
|
110
|
|
|
* @param \Mykees\TagBundle\Entity\TagRelation $tagRelation |
|
111
|
|
|
* @return Tag |
|
112
|
|
|
*/ |
|
113
|
|
|
public function addTagRelation(\Mykees\TagBundle\Entity\TagRelation $tagRelation) |
|
114
|
|
|
{ |
|
115
|
|
|
$this->tagRelation[] = $tagRelation; |
|
116
|
|
|
|
|
117
|
|
|
return $this; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Remove tagRelation |
|
122
|
|
|
* |
|
123
|
|
|
* @param \Mykees\TagBundle\Entity\TagRelation $tagRelation |
|
124
|
|
|
*/ |
|
125
|
|
|
public function removeTagRelation(\Mykees\TagBundle\Entity\TagRelation $tagRelation) |
|
126
|
|
|
{ |
|
127
|
|
|
$this->tagRelation->removeElement($tagRelation); |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* Get tagRelation |
|
132
|
|
|
* |
|
133
|
|
|
* @return \Doctrine\Common\Collections\Collection |
|
134
|
|
|
*/ |
|
135
|
|
|
public function getTagRelation() |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->tagRelation; |
|
138
|
|
|
} |
|
139
|
|
|
} |
|
140
|
|
|
|