1 | <?php |
||
11 | class Mapper |
||
12 | { |
||
13 | |||
14 | const FIELDMAP_FIELD = 'fieldname'; |
||
15 | const FIELDMAP_UPDATEMASK = 'updatemask'; |
||
16 | const FIELDMAP_SELECTMASK = 'selectmask'; |
||
17 | |||
18 | private $entity; |
||
19 | private $table; |
||
20 | private $primaryKey; |
||
21 | private $keygenFunction = null; |
||
22 | private $fieldMap = []; |
||
23 | private $fieldAlias = []; |
||
24 | private $preserveCasename = false; |
||
25 | |||
26 | /** |
||
27 | * Mapper constructor. |
||
28 | * |
||
29 | * @param string $entity |
||
30 | * @param string $table |
||
31 | * @param string $primaryKey |
||
32 | * @param \Closure $keygenFunction |
||
33 | * @param bool $preserveCasename |
||
34 | * @throws \Exception |
||
35 | */ |
||
36 | 21 | public function __construct($entity, $table, $primaryKey, \Closure $keygenFunction = null, $preserveCasename = false) |
|
47 | |||
48 | 21 | public function prepareField($field) |
|
64 | |||
65 | /** |
||
66 | * @param string $property |
||
67 | * @param string $fieldName |
||
68 | * @param \Closure|null|bool $updateMask |
||
69 | * @param \Closure $selectMask |
||
70 | * @return $this |
||
71 | */ |
||
72 | 21 | public function addFieldMap($property, $fieldName, $updateMask = false, \Closure $selectMask = null) |
|
94 | |||
95 | /** |
||
96 | * @param $fieldName |
||
97 | * @param $alias |
||
98 | */ |
||
99 | 4 | public function addFieldAlias($fieldName, $alias) |
|
103 | |||
104 | /** |
||
105 | * @return string |
||
106 | */ |
||
107 | 21 | public function getEntity() |
|
112 | |||
113 | /** |
||
114 | * @return string |
||
115 | */ |
||
116 | 20 | public function getTable() |
|
120 | |||
121 | /** |
||
122 | * @return string |
||
123 | */ |
||
124 | 14 | public function getPrimaryKey() |
|
128 | |||
129 | /** |
||
130 | * @return bool |
||
131 | */ |
||
132 | public function isPreserveCasename() |
||
136 | |||
137 | /** |
||
138 | * @param string|null $property |
||
139 | * @param string|null $key |
||
140 | * @return array |
||
141 | */ |
||
142 | 21 | public function getFieldMap($property = null, $key = null) |
|
162 | |||
163 | 21 | public function getFieldAlias($fieldName = null) |
|
175 | |||
176 | /** |
||
177 | * @return mixed|null |
||
178 | */ |
||
179 | 5 | public function generateKey() |
|
189 | |||
190 | public static function defaultClosure() |
||
196 | } |
||
197 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.