1 | <?php |
||
23 | class Content |
||
24 | { |
||
25 | /** |
||
26 | * @PHPCRODM\Id |
||
27 | */ |
||
28 | protected $id; |
||
29 | |||
30 | /** |
||
31 | * @PHPCRODM\Node |
||
32 | */ |
||
33 | protected $node; |
||
34 | |||
35 | /** |
||
36 | * @PHPCRODM\ParentDocument |
||
37 | */ |
||
38 | protected $parentDocument; |
||
39 | |||
40 | /** |
||
41 | * @PHPCRODM\Nodename |
||
42 | */ |
||
43 | protected $name; |
||
44 | |||
45 | /** |
||
46 | * @PHPCRODM\Field(type="string") |
||
47 | */ |
||
48 | protected $title; |
||
49 | |||
50 | /** |
||
51 | * @PHPCRODM\Child() |
||
52 | * |
||
53 | * @var Content |
||
54 | */ |
||
55 | protected $child; |
||
56 | |||
57 | /** |
||
58 | * @PHPCRODM\Children() |
||
59 | * |
||
60 | * @var ArrayCollection|Content[] |
||
61 | */ |
||
62 | protected $children; |
||
63 | |||
64 | /** |
||
65 | * @PHPCRODM\ReferenceOne(targetDocument="Sonata\DoctrinePHPCRAdminBundle\Tests\Fixtures\App\Document\Content") |
||
66 | * |
||
67 | * @var Content |
||
68 | */ |
||
69 | protected $singleRoute; |
||
70 | |||
71 | /** |
||
72 | * @PHPCRODM\ReferenceMany(targetDocument="Sonata\DoctrinePHPCRAdminBundle\Tests\Fixtures\App\Document\Content") |
||
73 | * |
||
74 | * @var ArrayCollection|Content[] |
||
75 | */ |
||
76 | protected $routes; |
||
77 | |||
78 | public function __construct() |
||
83 | |||
84 | /** |
||
85 | * @return mixed |
||
86 | */ |
||
87 | public function getId() |
||
91 | |||
92 | /** |
||
93 | * Gets the underlying PHPCR node of this content. |
||
94 | * |
||
95 | * @return NodeInterface |
||
96 | */ |
||
97 | public function getNode() |
||
101 | |||
102 | /** |
||
103 | * Sets the parent document. |
||
104 | * |
||
105 | * @param object $parent the parent document |
||
106 | */ |
||
107 | public function setParentDocument($parent) |
||
113 | |||
114 | /** |
||
115 | * Gets the parent document. |
||
116 | * |
||
117 | * @return object |
||
118 | */ |
||
119 | public function getParentDocument() |
||
123 | |||
124 | /** |
||
125 | * Sets the document name. |
||
126 | * |
||
127 | * @param string $name |
||
128 | */ |
||
129 | public function setName($name) |
||
135 | |||
136 | /** |
||
137 | * Gets the document name. |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getName() |
||
145 | |||
146 | /** |
||
147 | * @return string |
||
148 | */ |
||
149 | public function getTitle() |
||
153 | |||
154 | /** |
||
155 | * @param string $title |
||
156 | */ |
||
157 | public function setTitle($title) |
||
163 | |||
164 | /** |
||
165 | * @return string |
||
166 | */ |
||
167 | public function getBody() |
||
171 | |||
172 | /** |
||
173 | * @param string $body |
||
174 | * |
||
175 | * @return Content |
||
176 | */ |
||
177 | public function setBody($body) |
||
183 | |||
184 | /** |
||
185 | * @return Content |
||
186 | */ |
||
187 | public function getChild() |
||
191 | |||
192 | /** |
||
193 | * @param mixed $child |
||
194 | */ |
||
195 | public function setChild($child) |
||
201 | |||
202 | /** |
||
203 | * @return mixed |
||
204 | */ |
||
205 | public function getChildren() |
||
209 | |||
210 | /** |
||
211 | * @param mixed $children |
||
212 | */ |
||
213 | public function setChildren($children) |
||
219 | |||
220 | /** |
||
221 | * @return mixed |
||
222 | */ |
||
223 | public function getSingleRoute() |
||
227 | |||
228 | /** |
||
229 | * @param mixed $singleRoute |
||
230 | */ |
||
231 | public function setSingleRoute($singleRoute) |
||
237 | |||
238 | /** |
||
239 | * @return ArrayCollection|Content[] |
||
240 | */ |
||
241 | public function getRoutes() |
||
245 | |||
246 | /** |
||
247 | * @param ArrayCollection|Content[] $routes |
||
248 | */ |
||
249 | public function setRoutes($routes) |
||
255 | |||
256 | /** |
||
257 | * @param $route |
||
258 | */ |
||
259 | public function addRoute($route): void |
||
263 | |||
264 | /** |
||
265 | * @param $route |
||
266 | */ |
||
267 | public function removeRoute($route): void |
||
271 | |||
272 | /** |
||
273 | * @param $child |
||
274 | */ |
||
275 | public function addChild($child): void |
||
279 | |||
280 | /** |
||
281 | * @param $child |
||
282 | */ |
||
283 | public function removeChild($child): void |
||
287 | } |
||
288 |
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: