@@ -38,7 +38,7 @@ |
||
38 | 38 | * For example, on one-to-many relations when persisting the "parent", |
39 | 39 | * the actions that persist the "children" have to know about the parent's ID |
40 | 40 | */ |
41 | - $this->entityHydrator->setPk($this->entity, (int) $connection->lastInsertId()); |
|
41 | + $this->entityHydrator->setPk($this->entity, (int)$connection->lastInsertId()); |
|
42 | 42 | $this->entity->setState(StateEnum::SYNCHRONIZED); |
43 | 43 | } |
44 | 44 | } |
@@ -22,28 +22,28 @@ discard block |
||
22 | 22 | parent::applyDefaults(); |
23 | 23 | |
24 | 24 | $foreignKey = $this->foreignMapper->getConfig()->getPrimaryKey(); |
25 | - if (! isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
25 | + if (!isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
26 | 26 | $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey; |
27 | 27 | } |
28 | 28 | |
29 | 29 | $nativeKey = $this->foreignMapper->getConfig()->getPrimaryKey(); |
30 | - if (! isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
30 | + if (!isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
31 | 31 | $this->options[RelationConfig::NATIVE_KEY] = $nativeKey; |
32 | 32 | } |
33 | 33 | |
34 | - if (! isset($this->options[RelationConfig::THROUGH_TABLE])) { |
|
34 | + if (!isset($this->options[RelationConfig::THROUGH_TABLE])) { |
|
35 | 35 | $tables = [$this->foreignMapper->getConfig()->getTable(), $this->nativeMapper->getConfig()->getTable()]; |
36 | 36 | sort($tables); |
37 | 37 | $this->options[RelationConfig::THROUGH_TABLE] = implode('_', $tables); |
38 | 38 | } |
39 | 39 | |
40 | - if (! isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) { |
|
40 | + if (!isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) { |
|
41 | 41 | $prefix = Inflector::singularize($this->nativeMapper->getConfig()->getTableAlias(true)); |
42 | 42 | |
43 | 43 | $this->options[RelationConfig::THROUGH_NATIVE_COLUMN] = $this->getKeyColumn($prefix, $nativeKey); |
44 | 44 | } |
45 | 45 | |
46 | - if (! isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) { |
|
46 | + if (!isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) { |
|
47 | 47 | $prefix = Inflector::singularize($this->foreignMapper->getConfig()->getTableAlias(true)); |
48 | 48 | |
49 | 49 | $this->options[RelationConfig::THROUGH_FOREIGN_COLUMN] = $this->getKeyColumn($prefix, $foreignKey); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $throughAlias = $this->getOption(RelationConfig::THROUGH_TABLE_ALIAS); |
97 | 97 | $throughName = $throughAlias ?? $through; |
98 | 98 | |
99 | - if (! empty($throughColumns)) { |
|
99 | + if (!empty($throughColumns)) { |
|
100 | 100 | foreach ($throughColumns as $col => $alias) { |
101 | 101 | $query->columns("{$throughName}.{$col} AS {$alias}"); |
102 | 102 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | protected function addActionOnDelete(BaseAction $action) |
179 | 179 | { |
180 | - $nativeEntity = $action->getEntity(); |
|
180 | + $nativeEntity = $action->getEntity(); |
|
181 | 181 | |
182 | 182 | // retrieve them again from the DB since the related collection might not have everything |
183 | 183 | // for example due to a relation query callback |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | |
193 | 193 | protected function addActionOnSave(BaseAction $action) |
194 | 194 | { |
195 | - if (! $this->relationWasChanged($action->getEntity())) { |
|
195 | + if (!$this->relationWasChanged($action->getEntity())) { |
|
196 | 196 | return; |
197 | 197 | } |
198 | 198 | |
199 | - if (! $action->includesRelation($this->name)) { |
|
199 | + if (!$action->includesRelation($this->name)) { |
|
200 | 200 | return; |
201 | 201 | } |
202 | 202 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | /** @var Collection $foreignEntities */ |
206 | 206 | $foreignEntities = $this->nativeEntityHydrator->get($action->getEntity(), $this->name); |
207 | - if (! $foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) { |
|
207 | + if (!$foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) { |
|
208 | 208 | return; |
209 | 209 | } |
210 | 210 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | // save the entities still in the collection |
214 | 214 | foreach ($foreignEntities as $foreignEntity) { |
215 | - if (! empty($foreignEntity->getChanges())) { |
|
215 | + if (!empty($foreignEntity->getChanges())) { |
|
216 | 216 | $saveAction = $this->foreignMapper |
217 | 217 | ->newSaveAction($foreignEntity, [ |
218 | 218 | 'relations' => $remainingRelations |