1 | <?php |
||
21 | class Content |
||
22 | { |
||
23 | /** |
||
24 | * @PHPCRODM\Id |
||
25 | */ |
||
26 | protected $id; |
||
27 | |||
28 | /** |
||
29 | * @PHPCRODM\Node |
||
30 | */ |
||
31 | protected $node; |
||
32 | |||
33 | /** |
||
34 | * @PHPCRODM\ParentDocument |
||
35 | */ |
||
36 | protected $parentDocument; |
||
37 | |||
38 | /** |
||
39 | * @PHPCRODM\Nodename |
||
40 | */ |
||
41 | protected $name; |
||
42 | |||
43 | /** |
||
44 | * @PHPCRODM\Field(type="string") |
||
45 | */ |
||
46 | protected $title; |
||
47 | |||
48 | /** |
||
49 | * @PHPCRODM\Child() |
||
50 | * |
||
51 | * @var Content |
||
52 | */ |
||
53 | protected $child; |
||
54 | |||
55 | /** |
||
56 | * @PHPCRODM\Children() |
||
57 | * |
||
58 | * @var ArrayCollection|Content[] |
||
59 | */ |
||
60 | protected $children; |
||
61 | |||
62 | /** |
||
63 | * @PHPCRODM\ReferenceOne(targetDocument="Sonata\DoctrinePHPCRAdminBundle\Tests\Resources\Document\Content") |
||
64 | * |
||
65 | * @var Content |
||
66 | */ |
||
67 | protected $singleRoute; |
||
68 | |||
69 | /** |
||
70 | * @PHPCRODM\ReferenceMany(targetDocument="Sonata\DoctrinePHPCRAdminBundle\Tests\Resources\Document\Content") |
||
71 | * |
||
72 | * @var ArrayCollection|Content[] |
||
73 | */ |
||
74 | protected $routes; |
||
75 | |||
76 | public function __construct() |
||
81 | |||
82 | /** |
||
83 | * @return mixed |
||
84 | */ |
||
85 | public function getId() |
||
89 | |||
90 | /** |
||
91 | * Gets the underlying PHPCR node of this content. |
||
92 | * |
||
93 | * @return NodeInterface |
||
94 | */ |
||
95 | public function getNode() |
||
99 | |||
100 | /** |
||
101 | * Sets the parent document. |
||
102 | * |
||
103 | * @param object $parent the parent document |
||
104 | */ |
||
105 | public function setParentDocument($parent) |
||
111 | |||
112 | /** |
||
113 | * Gets the parent document. |
||
114 | * |
||
115 | * @return object |
||
116 | */ |
||
117 | public function getParentDocument() |
||
121 | |||
122 | /** |
||
123 | * Sets the document name. |
||
124 | * |
||
125 | * @param string $name |
||
126 | */ |
||
127 | public function setName($name) |
||
133 | |||
134 | /** |
||
135 | * Gets the document name. |
||
136 | * |
||
137 | * @return string |
||
138 | */ |
||
139 | public function getName() |
||
143 | |||
144 | /** |
||
145 | * @return string |
||
146 | */ |
||
147 | public function getTitle() |
||
151 | |||
152 | /** |
||
153 | * @param string $title |
||
154 | */ |
||
155 | public function setTitle($title) |
||
161 | |||
162 | /** |
||
163 | * @return string |
||
164 | */ |
||
165 | public function getBody() |
||
169 | |||
170 | /** |
||
171 | * @param string $body |
||
172 | * |
||
173 | * @return Content |
||
174 | */ |
||
175 | public function setBody($body) |
||
181 | |||
182 | /** |
||
183 | * @return Content |
||
184 | */ |
||
185 | public function getChild() |
||
189 | |||
190 | /** |
||
191 | * @param mixed $child |
||
192 | */ |
||
193 | public function setChild($child) |
||
197 | |||
198 | /** |
||
199 | * @return mixed |
||
200 | */ |
||
201 | public function getChildren() |
||
205 | |||
206 | /** |
||
207 | * @param mixed $children |
||
208 | */ |
||
209 | public function setChildren($children) |
||
213 | |||
214 | /** |
||
215 | * @return mixed |
||
216 | */ |
||
217 | public function getSingleRoute() |
||
221 | |||
222 | /** |
||
223 | * @param mixed $singleRoute |
||
224 | */ |
||
225 | public function setSingleRoute($singleRoute) |
||
229 | |||
230 | /** |
||
231 | * @return ArrayCollection|Content[] |
||
232 | */ |
||
233 | public function getRoutes() |
||
237 | |||
238 | /** |
||
239 | * @param ArrayCollection|Content[] $routes |
||
240 | */ |
||
241 | public function setRoutes($routes) |
||
245 | |||
246 | /** |
||
247 | * @param $route |
||
248 | */ |
||
249 | public function addRoute($route) |
||
253 | |||
254 | /** |
||
255 | * @param $route |
||
256 | */ |
||
257 | public function removeRoute($route) |
||
261 | |||
262 | /** |
||
263 | * @param $child |
||
264 | */ |
||
265 | public function addChild($child) |
||
269 | |||
270 | /** |
||
271 | * @param $child |
||
272 | */ |
||
273 | public function removeChild($child) |
||
277 | } |
||
278 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: