@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | // @todo throw an exception when the data doesn't have the local key |
| 44 | 44 | $query = $this->getQuery(); |
| 45 | - if($this->queryPrepared) { |
|
| 45 | + if ($this->queryPrepared) { |
|
| 46 | 46 | $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]); |
| 47 | 47 | } else { |
| 48 | 48 | $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table']) |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function runSetup() |
| 56 | 56 | { |
| 57 | - if($this->options['foreign_key'] == null) { |
|
| 58 | - $this->options['foreign_key'] = Text::singularize($this->setupTable) . '_id'; |
|
| 57 | + if ($this->options['foreign_key'] == null) { |
|
| 58 | + $this->options['foreign_key'] = Text::singularize($this->setupTable).'_id'; |
|
| 59 | 59 | } |
| 60 | - if($this->options['local_key'] == null) { |
|
| 60 | + if ($this->options['local_key'] == null) { |
|
| 61 | 61 | $this->options['local_key'] = $this->setupPrimaryKey[0]; |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $filter = $junctionModel->fields($this->options['junction_foreign_key']) |
| 44 | 44 | ->filterBy($this->options['junction_local_key'], $data[$this->options['local_key']]) |
| 45 | 45 | ->fetch(); |
| 46 | - if($filter->count() == 0) { |
|
| 46 | + if ($filter->count() == 0) { |
|
| 47 | 47 | return null; |
| 48 | 48 | } |
| 49 | 49 | $foreignKeys = []; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // @todo throw an exception when the data doesn't have the local key |
| 55 | 55 | $query = $this->getQuery(); |
| 56 | - if($this->queryPrepared){ |
|
| 56 | + if ($this->queryPrepared) { |
|
| 57 | 57 | $query->setBoundData($this->options['foreign_key'], $foreignKeys); |
| 58 | 58 | } else { |
| 59 | 59 | $query = $this->getQuery() |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | if (!isset($this->options['junction_local_key'])) { |
| 89 | 89 | $this->options['junction_local_key'] = |
| 90 | - Text::singularize($this->setupTable) . '_id'; |
|
| 90 | + Text::singularize($this->setupTable).'_id'; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if (!isset($this->options['junction_foreign_key'])) { |
| 94 | 94 | $this->options['junction_foreign_key'] = |
| 95 | - Text::singularize($foreignModel->getDBStoreInformation()['table']) . '_id'; |
|
| 95 | + Text::singularize($foreignModel->getDBStoreInformation()['table']).'_id'; |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $relationships = $this->wrapper->getDescription()->getRelationships(); |
| 156 | 156 | |
| 157 | - foreach($relationships as $model => $relationship) { |
|
| 158 | - if(isset($record[$model])) { |
|
| 157 | + foreach ($relationships as $model => $relationship) { |
|
| 158 | + if (isset($record[$model])) { |
|
| 159 | 159 | $relationship->preSave($record, $record[$model]); |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | $this->runBehaviours('postSaveCallback', [$record, $keyValue]); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - foreach($relationships as $model => $relationship) { |
|
| 180 | - if(isset($record[$model])) { |
|
| 179 | + foreach ($relationships as $model => $relationship) { |
|
| 180 | + if (isset($record[$model])) { |
|
| 181 | 181 | $relationship->postSave($record, $record[$model]); |
| 182 | 182 | } |
| 183 | 183 | } |