@@ -10,7 +10,7 @@ |
||
10 | 10 | public static function new(...$args) |
11 | 11 | { |
12 | 12 | if ($args[0] instanceof Connection) { |
13 | - return new ConnectionLocator(function () use ($args) { |
|
13 | + return new ConnectionLocator(function() use ($args) { |
|
14 | 14 | return $args[0]; |
15 | 15 | }); |
16 | 16 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | if (strpos($key, $separator)) { |
27 | 27 | $parents = static::getParents($key, $separator); |
28 | 28 | foreach ($parents as $parent) { |
29 | - if (! isset($arr[$parent])) { |
|
29 | + if (!isset($arr[$parent])) { |
|
30 | 30 | $arr[$parent] = null; |
31 | 31 | } |
32 | 32 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public static function reference($table, $tableAlias) |
9 | 9 | { |
10 | - if (! $tableAlias || $table == $tableAlias) { |
|
10 | + if (!$tableAlias || $table == $tableAlias) { |
|
11 | 11 | return $table; |
12 | 12 | } |
13 | 13 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | $insertSql = new \Sirius\Sql\Insert($connection); |
31 | 31 | $insertSql->into($this->mapper->getConfig()->getTable()) |
32 | - ->columns($columns); |
|
32 | + ->columns($columns); |
|
33 | 33 | $insertSql->perform(); |
34 | 34 | |
35 | 35 | /** |
@@ -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 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | |
24 | 24 | $update = new \Sirius\Sql\Update($this->mapper->getWriteConnection()); |
25 | 25 | $update->table($this->mapper->getConfig()->getTable()) |
26 | - ->columns([ |
|
27 | - $this->getOption('deleted_at_column') => $this->now |
|
28 | - ]) |
|
29 | - ->where('id', $entityId); |
|
26 | + ->columns([ |
|
27 | + $this->getOption('deleted_at_column') => $this->now |
|
28 | + ]) |
|
29 | + ->where('id', $entityId); |
|
30 | 30 | $update->perform(); |
31 | 31 | } |
32 | 32 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | protected function execute() |
16 | 16 | { |
17 | 17 | $entityId = $this->entityHydrator->getPk($this->entity); |
18 | - if (! $entityId) { |
|
18 | + if (!$entityId) { |
|
19 | 19 | return; |
20 | 20 | } |
21 | 21 |
@@ -54,8 +54,8 @@ |
||
54 | 54 | if (count($columns) > 0) { |
55 | 55 | $updateSql = new \Sirius\Sql\Update($connection); |
56 | 56 | $updateSql->table($this->mapper->getConfig()->getTable()) |
57 | - ->columns($columns) |
|
58 | - ->whereAll($conditions, false); |
|
57 | + ->columns($columns) |
|
58 | + ->whereAll($conditions, false); |
|
59 | 59 | $updateSql->perform(); |
60 | 60 | } |
61 | 61 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | public function joinSubselect(Query $query, string $reference) |
49 | 49 | { |
50 | 50 | $subselect = $query->subSelectForJoinWith($this->foreignMapper) |
51 | - ->as($reference); |
|
51 | + ->as($reference); |
|
52 | 52 | |
53 | 53 | $subselect = $this->applyQueryCallback($subselect); |
54 | 54 |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | protected function applyDefaults(): void |
19 | 19 | { |
20 | 20 | $nativeKey = $this->nativeMapper->getConfig()->getPrimaryKey(); |
21 | - if (! isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
21 | + if (!isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
22 | 22 | $this->options[RelationConfig::NATIVE_KEY] = $nativeKey; |
23 | 23 | } |
24 | 24 | |
25 | - if (! isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
25 | + if (!isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
26 | 26 | $prefix = Inflector::singularize($this->nativeMapper->getConfig()->getTable()); |
27 | 27 | $this->options[RelationConfig::FOREIGN_KEY] = $this->getKeyColumn($prefix, $nativeKey); |
28 | 28 | } |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | |
94 | 94 | protected function addActionOnDelete(BaseAction $action) |
95 | 95 | { |
96 | - $relations = $action->getOption('relations'); |
|
96 | + $relations = $action->getOption('relations'); |
|
97 | 97 | |
98 | 98 | // no cascade delete? treat as save so we can process the changes |
99 | - if (! $this->isCascade()) { |
|
99 | + if (!$this->isCascade()) { |
|
100 | 100 | $this->addActionOnSave($action); |
101 | 101 | } elseif ($relations === true || in_array($this->name, (array)$relations)) { |
102 | 102 | $nativeEntity = $action->getEntity(); |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | |
119 | 119 | protected function addActionOnSave(BaseAction $action) |
120 | 120 | { |
121 | - if (! $this->relationWasChanged($action->getEntity())) { |
|
121 | + if (!$this->relationWasChanged($action->getEntity())) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
125 | - if (! $action->includesRelation($this->name)) { |
|
125 | + if (!$action->includesRelation($this->name)) { |
|
126 | 126 | return; |
127 | 127 | } |
128 | 128 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | // save the entities still in the collection |
137 | 137 | foreach ($foreignEntities as $foreignEntity) { |
138 | - if (! empty($foreignEntity->getChanges())) { |
|
138 | + if (!empty($foreignEntity->getChanges())) { |
|
139 | 139 | $saveAction = $this->foreignMapper |
140 | 140 | ->newSaveAction($foreignEntity, ['relations' => $remainingRelations]); |
141 | 141 | $saveAction->addColumns($this->getExtraColumnsForAction()); |
@@ -88,7 +88,7 @@ |
||
88 | 88 | |
89 | 89 | public function isLazyLoad() |
90 | 90 | { |
91 | - return ! isset($this->options[RelationConfig::LOAD_STRATEGY]) || |
|
91 | + return !isset($this->options[RelationConfig::LOAD_STRATEGY]) || |
|
92 | 92 | $this->options[RelationConfig::LOAD_STRATEGY] == RelationConfig::LOAD_LAZY; |
93 | 93 | } |
94 | 94 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | public function joinSubselect(Query $query, string $reference) |
49 | 49 | { |
50 | 50 | $subselect = $query->subSelectForJoinWith($this->foreignMapper) |
51 | - ->as($reference); |
|
51 | + ->as($reference); |
|
52 | 52 | |
53 | 53 | $subselect = $this->applyQueryCallback($subselect); |
54 | 54 |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | parent::applyDefaults(); |
16 | 16 | |
17 | 17 | $foreignKey = $this->foreignMapper->getConfig()->getPrimaryKey(); |
18 | - if (! isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
18 | + if (!isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
19 | 19 | $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey; |
20 | 20 | } |
21 | 21 | |
22 | - if (! isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
22 | + if (!isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
23 | 23 | $nativeKey = $this->getKeyColumn($this->name, $foreignKey); |
24 | 24 | $this->options[RelationConfig::NATIVE_KEY] = $nativeKey; |
25 | 25 | } |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | |
95 | 95 | protected function addActionOnSave(BaseAction $action) |
96 | 96 | { |
97 | - if (! $this->relationWasChanged($action->getEntity())) { |
|
97 | + if (!$this->relationWasChanged($action->getEntity())) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | |
101 | - if (! $action->includesRelation($this->name)) { |
|
101 | + if (!$action->includesRelation($this->name)) { |
|
102 | 102 | return; |
103 | 103 | } |
104 | 104 |