1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace MovingImage\Client\VMPro\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use JMS\Serializer\Annotation\Type; |
7
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class Channel. |
11
|
|
|
* |
12
|
|
|
* @author Ruben Knol <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
class Channel |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @Type("integer") |
18
|
|
|
*/ |
19
|
|
|
private $id; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @Type("string") |
23
|
|
|
*/ |
24
|
|
|
private $name; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @Type("ArrayCollection<MovingImage\Client\VMPro\Entity\Channel>") |
28
|
|
|
*/ |
29
|
|
|
private $children; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @Type("MovingImage\Client\VMPro\Entity\Channel") |
33
|
|
|
*/ |
34
|
|
|
private $parent = null; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @Type("integer") |
38
|
|
|
* @SerializedName("parentId") |
39
|
|
|
*/ |
40
|
|
|
private $parentId = null; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
|
|
public function getName() |
46
|
|
|
{ |
47
|
|
|
return $this->name; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param string $name |
52
|
|
|
* |
53
|
|
|
* @return Channel |
54
|
|
|
*/ |
55
|
|
|
public function setName($name) |
56
|
|
|
{ |
57
|
|
|
$this->name = $name; |
58
|
|
|
|
59
|
|
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return int |
64
|
|
|
*/ |
65
|
|
|
public function getId() |
66
|
|
|
{ |
67
|
|
|
return $this->id; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param int $id |
72
|
|
|
* |
73
|
|
|
* @return Channel |
74
|
|
|
*/ |
75
|
|
|
public function setId($id) |
76
|
|
|
{ |
77
|
|
|
$this->id = $id; |
78
|
|
|
|
79
|
|
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return Channel |
84
|
|
|
*/ |
85
|
|
|
public function getParent() |
86
|
|
|
{ |
87
|
|
|
return $this->parent; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param Channel $parent |
92
|
|
|
* |
93
|
|
|
* @return Channel |
94
|
|
|
*/ |
95
|
|
|
public function setParent(Channel $parent) |
96
|
|
|
{ |
97
|
|
|
$this->parent = $parent; |
98
|
|
|
$this->setParentId($parent->getId()); |
99
|
|
|
|
100
|
|
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function setParentOnChildren() |
104
|
|
|
{ |
105
|
|
|
/** @var Channel $child */ |
106
|
|
|
foreach ($this->getChildren() as $child) { |
107
|
|
|
$child->setParent($this); |
108
|
|
|
if (!$child->getChildren()->isEmpty()) { |
109
|
|
|
$child->setParentOnChildren(); |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return int |
116
|
|
|
*/ |
117
|
|
|
public function getParentId() |
118
|
|
|
{ |
119
|
|
|
return $this->parentId; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @param int $parentId |
124
|
|
|
* |
125
|
|
|
* @return Channel |
126
|
|
|
*/ |
127
|
|
|
public function setParentId($parentId) |
128
|
|
|
{ |
129
|
|
|
$this->parentId = $parentId; |
130
|
|
|
|
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return ArrayCollection<Channel> |
|
|
|
|
136
|
|
|
*/ |
137
|
|
|
public function getChildren() |
138
|
|
|
{ |
139
|
|
|
if (is_null($this->children)) { |
140
|
|
|
$this->children = new ArrayCollection(); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
return $this->children; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @param ArrayCollection $children |
148
|
|
|
* |
149
|
|
|
* @return $this |
150
|
|
|
*/ |
151
|
|
|
public function setChildren($children) |
152
|
|
|
{ |
153
|
|
|
$this->children = $children; |
154
|
|
|
|
155
|
|
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @param Channel $child |
160
|
|
|
* |
161
|
|
|
* @return Channel |
162
|
|
|
*/ |
163
|
|
|
public function addChild(Channel $child) |
164
|
|
|
{ |
165
|
|
|
$this->getChildren()->add($child); |
166
|
|
|
|
167
|
|
|
return $this; |
168
|
|
|
} |
169
|
|
|
} |
170
|
|
|
|
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.