@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | * Callback for when a new record has been created. |
| 498 | 498 | * This callback can be most useful for obtaining the primary key of a newly created record. |
| 499 | 499 | * |
| 500 | - * @param $id |
|
| 500 | + * @param string $id |
|
| 501 | 501 | */ |
| 502 | 502 | public function postCreateCallback($id) |
| 503 | 503 | { |
@@ -538,6 +538,10 @@ discard block |
||
| 538 | 538 | return $this->adapter; |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | + /** |
|
| 542 | + * @param Relationship[] $relationships |
|
| 543 | + * @param integer $depth |
|
| 544 | + */ |
|
| 541 | 545 | private function expandArrayValue($array, $relationships, $depth, $expandableModels = [], $index = null) |
| 542 | 546 | { |
| 543 | 547 | $expandableModels = empty($expandableModels) ? array_keys($relationships) : $expandableModels; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $this->initialize(); |
| 212 | 212 | |
| 213 | 213 | return $this->context->getCache()->read( |
| 214 | - "{$this->className}::desc", function () { |
|
| 214 | + "{$this->className}::desc", function() { |
|
| 215 | 215 | return $this->context->getModelDescription($this); |
| 216 | 216 | } |
| 217 | 217 | ); |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | { |
| 444 | 444 | $data = $index ? $this->modelData[$index] : $this->modelData; |
| 445 | 445 | $name = $relationship->getOptions()['name']; |
| 446 | - if(isset($data[$name])) |
|
| 446 | + if (isset($data[$name])) |
|
| 447 | 447 | { |
| 448 | 448 | return $data[$name]; |
| 449 | 449 | } |
@@ -26,7 +26,6 @@ |
||
| 26 | 26 | |
| 27 | 27 | namespace ntentan\nibii\relationships; |
| 28 | 28 | |
| 29 | -use ntentan\nibii\exceptions\NibiiException; |
|
| 30 | 29 | use ntentan\nibii\Relationship; |
| 31 | 30 | use ntentan\utils\Text; |
| 32 | 31 | |
@@ -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->getQuery(); |
| 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,7 +70,7 @@ 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); |