@@ -79,8 +79,7 @@ discard block |
||
| 79 | 79 | if (isset($this->definition->getRelations()[$method])) { |
| 80 | 80 | if (isset($this->fetched[$method])) { |
| 81 | 81 | return is_callable($this->fetched[$method]) ? |
| 82 | - $this->fetched[$method] = call_user_func($this->fetched[$method], $args[0] ?? null) : |
|
| 83 | - $this->fetched[$method]; |
|
| 82 | + $this->fetched[$method] = call_user_func($this->fetched[$method], $args[0] ?? null) : $this->fetched[$method]; |
|
| 84 | 83 | } |
| 85 | 84 | } |
| 86 | 85 | return null; |
@@ -164,7 +163,7 @@ discard block |
||
| 164 | 163 | public function collection(TableQueryIterator $iterator, Table $definition) : Collection |
| 165 | 164 | { |
| 166 | 165 | return Collection::from($iterator) |
| 167 | - ->map(function ($v) use ($definition) { |
|
| 166 | + ->map(function($v) use ($definition) { |
|
| 168 | 167 | return $this->entity($definition, $v); |
| 169 | 168 | }); |
| 170 | 169 | } |
@@ -239,7 +238,7 @@ discard block |
||
| 239 | 238 | $definition = $entity->definition(); |
| 240 | 239 | foreach ($definition->getColumns() as $column) { |
| 241 | 240 | if (!isset($data[$column])) { |
| 242 | - $entity->__lazyProperty($column, function () use ($entity, $definition, $primary, $column) { |
|
| 241 | + $entity->__lazyProperty($column, function() use ($entity, $definition, $primary, $column) { |
|
| 243 | 242 | $query = $this->db->table($definition->getName()); |
| 244 | 243 | foreach ($primary as $k => $v) { |
| 245 | 244 | $query->filter($k, $v); |
@@ -253,12 +252,12 @@ discard block |
||
| 253 | 252 | $name, |
| 254 | 253 | isset($data[$name]) ? |
| 255 | 254 | ($relation->many ? |
| 256 | - array_map(function ($v) use ($relation) { |
|
| 255 | + array_map(function($v) use ($relation) { |
|
| 257 | 256 | return $this->entity($relation->table, $v); |
| 258 | 257 | }, $data[$name]) : |
| 259 | 258 | $this->entity($relation->table, $data[$name]) |
| 260 | 259 | ) : |
| 261 | - function (array $columns = null) use ($entity, $definition, $primary, $relation, $data) { |
|
| 260 | + function(array $columns = null) use ($entity, $definition, $primary, $relation, $data) { |
|
| 262 | 261 | $query = $this->db->table($relation->table->getName(), true); |
| 263 | 262 | if ($columns !== null) { |
| 264 | 263 | $query->columns($columns); |
@@ -284,7 +283,7 @@ discard block |
||
| 284 | 283 | ); |
| 285 | 284 | } |
| 286 | 285 | foreach ($definition->getPrimaryKey() as $v) { |
| 287 | - $query->filter($nm . '.' . $v, $data[$v] ?? null); |
|
| 286 | + $query->filter($nm.'.'.$v, $data[$v] ?? null); |
|
| 288 | 287 | } |
| 289 | 288 | } else { |
| 290 | 289 | foreach ($relation->keymap as $k => $v) { |
@@ -292,8 +291,7 @@ discard block |
||
| 292 | 291 | } |
| 293 | 292 | } |
| 294 | 293 | return $relation->many ? |
| 295 | - $query->iterator() : |
|
| 296 | - $query[0]; |
|
| 294 | + $query->iterator() : $query[0]; |
|
| 297 | 295 | } |
| 298 | 296 | ); |
| 299 | 297 | } |