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