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 | * @return mixed |
||
49 | */ |
||
50 | public function getId() |
||
54 | |||
55 | /** |
||
56 | * Gets the underlying PHPCR node of this content. |
||
57 | * |
||
58 | * @return NodeInterface |
||
59 | */ |
||
60 | public function getNode() |
||
64 | |||
65 | /** |
||
66 | * Sets the parent document. |
||
67 | * |
||
68 | * @param object $parent the parent document |
||
69 | */ |
||
70 | public function setParentDocument($parent) |
||
76 | |||
77 | /** |
||
78 | * Gets the parent document. |
||
79 | * |
||
80 | * @return object |
||
81 | */ |
||
82 | public function getParentDocument() |
||
86 | |||
87 | /** |
||
88 | * Sets the document name. |
||
89 | * |
||
90 | * @param string $name |
||
91 | */ |
||
92 | public function setName($name) |
||
98 | |||
99 | /** |
||
100 | * Gets the document name. |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getName() |
||
108 | |||
109 | /** |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getTitle() |
||
116 | |||
117 | /** |
||
118 | * @param string $title |
||
119 | */ |
||
120 | public function setTitle($title) |
||
126 | |||
127 | /** |
||
128 | * @return string |
||
129 | */ |
||
130 | public function getBody() |
||
134 | |||
135 | /** |
||
136 | * @param string $body |
||
137 | */ |
||
138 | public function setBody($body) |
||
144 | } |
||
145 |
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: