|
@@ -21,7 +21,7 @@ class IpAddressMiddleware extends Middleware
|
21
|
21
|
$this->utils = new RequestUtils($reflection);
|
22
|
22
|
}
|
23
|
23
|
|
24
|
|
- private function callHandler($handler, $record, String $operation, ReflectedTable $table) /*: object */
|
|
24
|
+ private function callHandler($record, String $operation, ReflectedTable $table) /*: object */
|
25
|
25
|
{
|
26
|
26
|
$context = (array) $record;
|
27
|
27
|
$columnName = $this->getProperty('column', '');
|
|
@@ -43,18 +43,15 @@ class IpAddressMiddleware extends Middleware
|
43
|
43
|
if ($this->reflection->hasTable($tableName)) {
|
44
|
44
|
$record = $request->getBody();
|
45
|
45
|
if ($record !== null) {
|
46
|
|
- $handler = $this->getProperty('handler', '');
|
47
|
|
- if ($handler !== '') {
|
48
|
|
- $table = $this->reflection->getTable($tableName);
|
49
|
|
- if (is_array($record)) {
|
50
|
|
- foreach ($record as &$r) {
|
51
|
|
- $r = $this->callHandler($handler, $r, $operation, $table);
|
52
|
|
- }
|
53
|
|
- } else {
|
54
|
|
- $record = $this->callHandler($handler, $record, $operation, $table);
|
|
46
|
+ $table = $this->reflection->getTable($tableName);
|
|
47
|
+ if (is_array($record)) {
|
|
48
|
+ foreach ($record as &$r) {
|
|
49
|
+ $r = $this->callHandler($r, $operation, $table);
|
55
|
50
|
}
|
56
|
|
- $request->setBody($record);
|
|
51
|
+ } else {
|
|
52
|
+ $record = $this->callHandler($record, $operation, $table);
|
57
|
53
|
}
|
|
54
|
+ $request->setBody($record);
|
58
|
55
|
}
|
59
|
56
|
}
|
60
|
57
|
}
|