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