1 | <?php |
||
14 | abstract class Entity extends Cache { |
||
15 | |||
16 | use Entity\Collection, Entity\Modify; |
||
17 | |||
18 | protected $definition = null, $dataset = null; |
||
19 | |||
20 | /** |
||
21 | * Select a basic entity from DB |
||
22 | * |
||
23 | * @return DB\Result|false : the selection result object or false on failure |
||
24 | */ |
||
25 | |||
26 | private function selectBasic(string $name, string $value) { |
||
32 | |||
33 | /** |
||
34 | * Select a nesting entity from DB |
||
35 | * |
||
36 | * @return DB\Result|false : the selection result object or false on failure |
||
37 | */ |
||
38 | |||
39 | private function selectNesting(string $name, string $value) { |
||
61 | |||
62 | /** |
||
63 | * Update the entity dataset with a selected data. Also updates every entity object having an identical id |
||
64 | * |
||
65 | * @return true : always true ;) |
||
66 | */ |
||
67 | |||
68 | protected function setData(array $data) : bool { |
||
91 | |||
92 | /** |
||
93 | * Constructor |
||
94 | */ |
||
95 | |||
96 | public function __construct() { |
||
106 | |||
107 | /** |
||
108 | * Initialize the entity by a unique param (default: id) |
||
109 | * |
||
110 | * @return bool : true on success or false on failure |
||
111 | */ |
||
112 | |||
113 | public function init($value, string $name = 'id') : bool { |
||
135 | |||
136 | /** |
||
137 | * Check whether another entity with a given unique param value exists. |
||
138 | * The method helps you to find out the possibility of changing the entity's unique param value to the given one |
||
139 | * |
||
140 | * @return int|false : the number of entities found (0 or 1) or false on error |
||
141 | */ |
||
142 | |||
143 | public function check($value, string $name) { |
||
165 | |||
166 | /** |
||
167 | * Get the entity definition |
||
168 | */ |
||
169 | |||
170 | public function getDefinition() : Entitizer\Utils\Definition { |
||
174 | |||
175 | /** |
||
176 | * Get a param value |
||
177 | * |
||
178 | * @return mixed|null : the value or null if the param does not exist |
||
179 | */ |
||
180 | |||
181 | public function get(string $name) { |
||
185 | |||
186 | /** |
||
187 | * Get the array of params and their values |
||
188 | */ |
||
189 | |||
190 | public function getData() : array { |
||
194 | |||
195 | /** |
||
196 | * An alias for the get method |
||
197 | */ |
||
198 | |||
199 | public function __get(string $name) { |
||
203 | |||
204 | /** |
||
205 | * Check if a param exists |
||
206 | */ |
||
207 | |||
208 | public function __isset(string $name) : bool { |
||
212 | } |
||
213 | } |
||
214 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.