@@ -113,7 +113,7 @@ |
||
| 113 | 113 | public function describe($model, $relationships) |
| 114 | 114 | { |
| 115 | 115 | return new ModelDescription( |
| 116 | - $this->driver->describeTable($table)[$table], $relationships, function ($type) { |
|
| 116 | + $this->driver->describeTable($table)[$table], $relationships, function($type) { |
|
| 117 | 117 | return $this->mapDataTypes($type); |
| 118 | 118 | } |
| 119 | 119 | ); |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function prepareQuery($data) |
| 45 | 45 | { |
| 46 | - if(!array_key_exists($this->options['local_key'], $data)) { |
|
| 46 | + if (!array_key_exists($this->options['local_key'], $data)) { |
|
| 47 | 47 | throw new FieldNotFoundException("Field {$this->options['local_key']} not found for belongs to relationship query."); |
| 48 | 48 | } |
| 49 | - if(!isset($data[$this->options['local_key']])) { |
|
| 49 | + if (!isset($data[$this->options['local_key']])) { |
|
| 50 | 50 | return null; |
| 51 | 51 | } |
| 52 | 52 | $query = $this->getQuery(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->options['foreign_key'] = $model->getDescription()->getPrimaryKey()[0]; |
| 70 | 70 | } |
| 71 | 71 | if ($this->options['local_key'] == null) { |
| 72 | - $this->options['local_key'] = Text::singularize($table) . '_id'; |
|
| 72 | + $this->options['local_key'] = Text::singularize($table).'_id'; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | public function doFilter() |
| 241 | 241 | { |
| 242 | 242 | $arguments = func_get_args(); |
| 243 | - if(count($arguments) == 1 && is_array($arguments[0])) { |
|
| 244 | - foreach($arguments[0] as $field => $value) { |
|
| 243 | + if (count($arguments) == 1 && is_array($arguments[0])) { |
|
| 244 | + foreach ($arguments[0] as $field => $value) { |
|
| 245 | 245 | $this->getQueryParameters()->addFilter($field, $value); |
| 246 | 246 | } |
| 247 | 247 | } else { |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | public function doWith($model) |
| 351 | 351 | { |
| 352 | - if(!isset($this->wrapper->getDescription()->getRelationships()[$model])) { |
|
| 352 | + if (!isset($this->wrapper->getDescription()->getRelationships()[$model])) { |
|
| 353 | 353 | throw new ModelNotFoundException("Could not find related model [$model]"); |
| 354 | 354 | } |
| 355 | 355 | $relationship = $this->wrapper->getDescription()->getRelationships()[$model]; |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | $this->table = $table['table']; |
| 120 | 120 | $this->schema = $table['schema']; |
| 121 | 121 | } |
| 122 | - $this->quotedTable = ($this->schema ? "{$driver->quoteIdentifier($this->schema)}." : "") . $driver->quoteIdentifier($this->table); |
|
| 123 | - $this->unquotedTable = ($this->schema ? "{$this->schema}." : "") . $this->table; |
|
| 122 | + $this->quotedTable = ($this->schema ? "{$driver->quoteIdentifier($this->schema)}." : "").$driver->quoteIdentifier($this->table); |
|
| 123 | + $this->unquotedTable = ($this->schema ? "{$this->schema}." : "").$this->table; |
|
| 124 | 124 | $this->adapter->setModel($this, $this->quotedTable); |
| 125 | 125 | $this->initialized = true; |
| 126 | 126 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $this->initialize(); |
| 141 | 141 | return $this->context->getCache()->read( |
| 142 | - "{$this->className}::desc", function () { |
|
| 142 | + "{$this->className}::desc", function() { |
|
| 143 | 143 | return $this->context->getModelDescription($this); |
| 144 | 144 | } |
| 145 | 145 | ); |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | private function expandArrayValue($array, $relationships, $depth, $expandOnly = [], $index = null) |
| 411 | 411 | { |
| 412 | - if(empty($expandOnly)){ |
|
| 412 | + if (empty($expandOnly)) { |
|
| 413 | 413 | foreach ($relationships as $name => $relationship) { |
| 414 | 414 | $array[$name] = $this->fetchRelatedFields($relationship, $index)->toArray($depth); |
| 415 | 415 | } |