@@ -139,7 +139,7 @@ |
||
139 | 139 | public function describe($model, $relationships) |
140 | 140 | { |
141 | 141 | return new ModelDescription( |
142 | - $this->driver->describeTable($table)[$table], $relationships, function ($type) { |
|
142 | + $this->driver->describeTable($table)[$table], $relationships, function($type) { |
|
143 | 143 | return $this->mapDataTypes($type); |
144 | 144 | } |
145 | 145 | ); |
@@ -74,7 +74,7 @@ |
||
74 | 74 | |
75 | 75 | public function preSave(&$wrapper, $value) |
76 | 76 | { |
77 | - if(!$value->save()) { |
|
77 | + if (!$value->save()) { |
|
78 | 78 | $this->invalidFields = $value->getInvalidFields(); |
79 | 79 | } |
80 | 80 | $wrapper[$this->options['local_key']] = $value[$this->options['foreign_key']]; |
@@ -110,7 +110,7 @@ |
||
110 | 110 | $jointModelRecords = []; |
111 | 111 | foreach ($this->tempdata as $relatedRecord) { |
112 | 112 | if (!$relatedRecord->save()) { |
113 | - $this->invalidFields =$this->tempdata->getInvalidFields(); |
|
113 | + $this->invalidFields = $this->tempdata->getInvalidFields(); |
|
114 | 114 | } |
115 | 115 | $jointModelRecords[] = [ |
116 | 116 | $this->options['junction_local_key'] => $wrapper[$this->options['local_key']], |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | { |
40 | 40 | // @todo throw an exception when the data doesn't have the local key |
41 | 41 | $query = $this->createQuery(); |
42 | - if(!$this->queryPrepared) { |
|
42 | + if (!$this->queryPrepared) { |
|
43 | 43 | $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table']) |
44 | 44 | ->addFilter($this->options['foreign_key'], $data[$this->options['local_key']] ?? null); |
45 | 45 | $this->queryPrepared = true; |
46 | 46 | return $query; |
47 | 47 | } |
48 | - if(isset($data[$this->options['local_key']])) { |
|
48 | + if (isset($data[$this->options['local_key']])) { |
|
49 | 49 | $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]); |
50 | 50 | } |
51 | 51 | return $query; |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | public function postSave(&$wrapper) |
71 | 71 | { |
72 | 72 | $records = $this->tempData->getData(); |
73 | - foreach($records as $i => $relatedRecord) { |
|
73 | + foreach ($records as $i => $relatedRecord) { |
|
74 | 74 | $records[$i][$this->options['foreign_key']] = $wrapper[$this->options['local_key']]; |
75 | 75 | } |
76 | 76 | $this->tempData->setData($records); |
77 | - if(!$this->tempData->save()) { |
|
77 | + if (!$this->tempData->save()) { |
|
78 | 78 | $this->invalidFields = $this->tempData->getInvalidFields(); |
79 | 79 | } |
80 | 80 | $wrapper[$this->options['model']] = $this->tempData; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | foreach ($relationshipsWithData as $model => $relationship) { |
257 | 257 | $relationship->postSave($record); |
258 | 258 | $invalidRelatedFields = $relationship->getInvalidFields(); |
259 | - if(!empty($invalidRelatedFields)) { |
|
259 | + if (!empty($invalidRelatedFields)) { |
|
260 | 260 | $status['success'] = false; |
261 | 261 | $status['invalid_fields'][$model] = $invalidRelatedFields; |
262 | 262 | } |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | $mainValidatorErrors = $validator->getInvalidFields(); |
285 | 285 | } |
286 | 286 | |
287 | - if(!empty($this->wrapper->getValidationRules())) { |
|
287 | + if (!empty($this->wrapper->getValidationRules())) { |
|
288 | 288 | $modelValidator = new Validator(); |
289 | 289 | $modelValidator->setRules($this->wrapper->getValidationRules()); |
290 | - if(!$modelValidator->validate($data)) { |
|
290 | + if (!$modelValidator->validate($data)) { |
|
291 | 291 | $modelValidatorErrors = $modelValidator->getInvalidFields(); |
292 | 292 | } |
293 | 293 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return bool |
306 | 306 | */ |
307 | - private function isPrimaryKeySet(string|array $primaryKey, array $data) : bool |
|
307 | + private function isPrimaryKeySet(string | array $primaryKey, array $data) : bool |
|
308 | 308 | { |
309 | 309 | if (is_string($primaryKey) && ($data[$primaryKey] !== null || $data[$primaryKey] !== '')) { |
310 | 310 | return true; |
@@ -191,7 +191,7 @@ |
||
191 | 191 | * |
192 | 192 | * @return RecordWrapper |
193 | 193 | */ |
194 | - public function doFields(string|array ...$arguments) |
|
194 | + public function doFields(string | array ...$arguments) |
|
195 | 195 | { |
196 | 196 | $finalFields = []; |
197 | 197 | foreach ($arguments as $argument) { |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | $this->table = $table['table']; |
174 | 174 | $this->schema = $table['schema']; |
175 | 175 | } |
176 | - $this->quotedTable = ($this->schema ? "{$driver->quoteIdentifier($this->schema)}." : '') . $driver->quoteIdentifier($this->table); |
|
177 | - $this->unquotedTable = ($this->schema ? "{$this->schema}." : '') . $this->table; |
|
176 | + $this->quotedTable = ($this->schema ? "{$driver->quoteIdentifier($this->schema)}." : '').$driver->quoteIdentifier($this->table); |
|
177 | + $this->unquotedTable = ($this->schema ? "{$this->schema}." : '').$this->table; |
|
178 | 178 | $this->adapter->setModel($this, $this->quotedTable); |
179 | 179 | $this->initialized = true; |
180 | 180 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $this->initialize(); |
199 | 199 | |
200 | 200 | return $this->context->getCache()->read( |
201 | - "{$this->className}::desc", function () { |
|
201 | + "{$this->className}::desc", function() { |
|
202 | 202 | return $this->context->getModelDescription($this); |
203 | 203 | } |
204 | 204 | ); |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | public function map(callable $callback): array |
600 | 600 | { |
601 | 601 | $mapped = []; |
602 | - foreach($this as $item) { |
|
602 | + foreach ($this as $item) { |
|
603 | 603 | $mapped[] = $callback($item); |
604 | 604 | } |
605 | 605 | return $mapped; |