1 | <?php |
||
21 | class DynamicEntity extends AbstractEntity |
||
22 | { |
||
23 | /** |
||
24 | * List of fields must be hidden from publicFields() method. |
||
25 | * |
||
26 | * @see publicFields() |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $hidden = []; |
||
31 | |||
32 | /** |
||
33 | * Set of fields allowed to be filled using setFields() method. |
||
34 | * |
||
35 | * @see setFields() |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $fillable = []; |
||
40 | |||
41 | /** |
||
42 | * List of fields not allowed to be filled by setFields() method. Replace with and empty array |
||
43 | * to allow all fields. |
||
44 | * |
||
45 | * By default all entity fields are settable! Opposite behaviour has to be described in entity |
||
46 | * child implementations. |
||
47 | * |
||
48 | * @see setFields() |
||
49 | * |
||
50 | * @var array|string |
||
51 | */ |
||
52 | protected $secured = []; |
||
53 | |||
54 | /** |
||
55 | * @see setField() |
||
56 | * |
||
57 | * @var array |
||
58 | */ |
||
59 | protected $setters = []; |
||
60 | |||
61 | /** |
||
62 | * @see getField() |
||
63 | * |
||
64 | * @var array |
||
65 | */ |
||
66 | protected $getters = []; |
||
67 | |||
68 | /** |
||
69 | * Accessor used to mock field data and filter every request thought itself. |
||
70 | * |
||
71 | * @see getField() |
||
72 | * @see setField() |
||
73 | * |
||
74 | * @var array |
||
75 | */ |
||
76 | protected $accessors = []; |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function isPublic(string $field): bool |
||
85 | |||
86 | /** |
||
87 | * Check if field can be set using setFields() method. |
||
88 | * |
||
89 | * @see setField() |
||
90 | * @see $fillable |
||
91 | * @see $secured |
||
92 | * |
||
93 | * @param string $field |
||
94 | * |
||
95 | * @return bool |
||
96 | */ |
||
97 | protected function isFillable(string $field): bool |
||
109 | |||
110 | /** |
||
111 | * Check and return name of mutator (getter, setter, accessor) associated with specific field. |
||
112 | * |
||
113 | * @param string $field |
||
114 | * @param string $mutator Mutator type (setter, getter, accessor). |
||
115 | * |
||
116 | * @return mixed|null |
||
117 | * |
||
118 | * @throws EntityException |
||
119 | */ |
||
120 | protected function getMutator(string $field, string $mutator) |
||
132 | } |