1 | <?php |
||
11 | class Mapper |
||
12 | { |
||
13 | |||
14 | protected $entity; |
||
15 | protected $table; |
||
16 | protected $primaryKey; |
||
17 | protected $keygenFunction = null; |
||
18 | |||
19 | const FIELDMAP_FIELD = 'fieldname'; |
||
20 | const FIELDMAP_UPDATEMASK = 'updatemask'; |
||
21 | const FIELDMAP_SELECTMASK = 'selectmask'; |
||
22 | |||
23 | protected $fieldMap = []; |
||
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 | 19 | 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 | 19 | public function addFieldMap($property, $fieldName, $updateMask = false, \Closure $selectMask = null) |
|
74 | |||
75 | /** |
||
76 | * @return string |
||
77 | */ |
||
78 | 19 | public function getEntity() |
|
83 | |||
84 | /** |
||
85 | * @return string |
||
86 | */ |
||
87 | 19 | public function getTable() |
|
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | 14 | public function getPrimaryKey() |
|
99 | |||
100 | /** |
||
101 | * @param string|null $property |
||
102 | * @param string|null $key |
||
103 | * @return array |
||
104 | */ |
||
105 | 19 | public function getFieldMap($property = null, $key = null) |
|
119 | |||
120 | /** |
||
121 | * @return mixed|null |
||
122 | */ |
||
123 | 5 | public function generateKey() |
|
133 | |||
134 | public static function defaultClosure() |
||
140 | } |
||
141 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.