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 | |||
25 | /** |
||
26 | * Mapper constructor. |
||
27 | * |
||
28 | * @param string $entity |
||
29 | * @param string $table |
||
30 | * @param string $primaryKey |
||
31 | * @param \Closure $keygenFunction |
||
32 | * @throws \Exception |
||
33 | */ |
||
34 | 21 | public function __construct($entity, $table, $primaryKey, \Closure $keygenFunction = null) |
|
44 | |||
45 | /** |
||
46 | * @param string $property |
||
47 | * @param string $fieldName |
||
48 | * @param \Closure|null|bool $updateMask |
||
49 | * @param \Closure $selectMask |
||
50 | * @return $this |
||
51 | */ |
||
52 | 21 | public function addFieldMap($property, $fieldName, $updateMask = false, \Closure $selectMask = null) |
|
74 | |||
75 | /** |
||
76 | * @param $fieldName |
||
77 | * @param $alias |
||
78 | */ |
||
79 | 4 | public function addFieldAlias($fieldName, $alias) |
|
83 | |||
84 | /** |
||
85 | * @return string |
||
86 | */ |
||
87 | 21 | public function getEntity() |
|
92 | |||
93 | /** |
||
94 | * @return string |
||
95 | */ |
||
96 | 20 | public function getTable() |
|
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | 14 | public function getPrimaryKey() |
|
108 | |||
109 | /** |
||
110 | * @param string|null $property |
||
111 | * @param string|null $key |
||
112 | * @return array |
||
113 | */ |
||
114 | 21 | public function getFieldMap($property = null, $key = null) |
|
132 | |||
133 | 21 | public function getFieldAlias($fieldName = null) |
|
145 | |||
146 | /** |
||
147 | * @return mixed|null |
||
148 | */ |
||
149 | 5 | public function generateKey() |
|
159 | |||
160 | public static function defaultClosure() |
||
166 | } |
||
167 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.