1 | <?php |
||
20 | class Content |
||
21 | { |
||
22 | /** |
||
23 | * @PHPCRODM\Id |
||
24 | */ |
||
25 | protected $id; |
||
26 | |||
27 | /** |
||
28 | * @PHPCRODM\Node |
||
29 | */ |
||
30 | protected $node; |
||
31 | |||
32 | /** |
||
33 | * @PHPCRODM\ParentDocument |
||
34 | */ |
||
35 | protected $parentDocument; |
||
36 | |||
37 | /** |
||
38 | * @PHPCRODM\Nodename |
||
39 | */ |
||
40 | protected $name; |
||
41 | |||
42 | /** |
||
43 | * @PHPCRODM\Field(type="string") |
||
44 | */ |
||
45 | protected $title; |
||
46 | |||
47 | /** |
||
48 | * @PHPCRODM\Child() |
||
49 | */ |
||
50 | protected $child; |
||
51 | |||
52 | /** |
||
53 | * @return mixed |
||
54 | */ |
||
55 | public function getId() |
||
59 | |||
60 | /** |
||
61 | * Gets the underlying PHPCR node of this content. |
||
62 | * |
||
63 | * @return NodeInterface |
||
64 | */ |
||
65 | public function getNode() |
||
69 | |||
70 | /** |
||
71 | * Sets the parent document. |
||
72 | * |
||
73 | * @param object $parent the parent document |
||
74 | */ |
||
75 | public function setParentDocument($parent) |
||
81 | |||
82 | /** |
||
83 | * Gets the parent document. |
||
84 | * |
||
85 | * @return object |
||
86 | */ |
||
87 | public function getParentDocument() |
||
91 | |||
92 | /** |
||
93 | * Sets the document name. |
||
94 | * |
||
95 | * @param string $name |
||
96 | */ |
||
97 | public function setName($name) |
||
103 | |||
104 | /** |
||
105 | * Gets the document name. |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getName() |
||
113 | |||
114 | /** |
||
115 | * @return string |
||
116 | */ |
||
117 | public function getTitle() |
||
121 | |||
122 | /** |
||
123 | * @param string $title |
||
124 | */ |
||
125 | public function setTitle($title) |
||
131 | |||
132 | /** |
||
133 | * @return string |
||
134 | */ |
||
135 | public function getBody() |
||
139 | |||
140 | /** |
||
141 | * @param string $body |
||
142 | */ |
||
143 | public function setBody($body) |
||
149 | } |
||
150 |
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: