1 | <?php |
||
9 | abstract class Model |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected static $attributeMap = []; |
||
15 | |||
16 | /** |
||
17 | * Model primary key. Adding to collection with this key. |
||
18 | * @return string|int|null |
||
19 | */ |
||
20 | public function getPrimaryKey() |
||
24 | |||
25 | /** |
||
26 | * @param array $data |
||
27 | */ |
||
28 | public function setAttributes(array $data): void |
||
40 | |||
41 | /** |
||
42 | * @return array |
||
43 | */ |
||
44 | abstract protected function getAttributeMap(): array; |
||
45 | |||
46 | /** |
||
47 | * Converts the model into an array. |
||
48 | * @return array |
||
49 | */ |
||
50 | public function toArray(): array |
||
54 | |||
55 | /** |
||
56 | * PHP getter magic method. |
||
57 | * |
||
58 | * @param string $name property name |
||
59 | * @return mixed property value |
||
60 | */ |
||
61 | public function __get($name) |
||
69 | |||
70 | /** |
||
71 | * PHP setter magic method. |
||
72 | * |
||
73 | * @param string $name property name |
||
74 | * @param mixed $value property value |
||
75 | */ |
||
76 | public function __set($name, $value): void |
||
80 | |||
81 | /** |
||
82 | * @param string $name |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function __isset($name) |
||
89 | } |
||
90 |