Completed
Push — master ( 89a77f...e0a427 )
by Adrian
01:46
created
src/Relation/ManyToMany.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,28 +23,28 @@  discard block
 block discarded – undo
23 23
         $this->setOptionIfMissing(RelationConfig::THROUGH_COLUMNS_PREFIX, 'pivot_');
24 24
 
25 25
         $foreignKey = $this->foreignMapper->getPrimaryKey();
26
-        if (! isset($this->options[RelationConfig::FOREIGN_KEY])) {
26
+        if (!isset($this->options[RelationConfig::FOREIGN_KEY])) {
27 27
             $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey;
28 28
         }
29 29
 
30 30
         $nativeKey = $this->foreignMapper->getPrimaryKey();
31
-        if (! isset($this->options[RelationConfig::NATIVE_KEY])) {
31
+        if (!isset($this->options[RelationConfig::NATIVE_KEY])) {
32 32
             $this->options[RelationConfig::NATIVE_KEY] = $nativeKey;
33 33
         }
34 34
 
35
-        if (! isset($this->options[RelationConfig::THROUGH_TABLE])) {
35
+        if (!isset($this->options[RelationConfig::THROUGH_TABLE])) {
36 36
             $tables = [$this->foreignMapper->getTable(), $this->nativeMapper->getTable()];
37 37
             sort($tables);
38 38
             $this->options[RelationConfig::THROUGH_TABLE] = implode('_', $tables);
39 39
         }
40 40
 
41
-        if (! isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
41
+        if (!isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
42 42
             $prefix = Inflector::singularize($this->nativeMapper->getTableAlias(true));
43 43
 
44 44
             $this->options[RelationConfig::THROUGH_NATIVE_COLUMN] = $this->getKeyColumn($prefix, $nativeKey);
45 45
         }
46 46
 
47
-        if (! isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
47
+        if (!isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
48 48
             $prefix = Inflector::singularize($this->foreignMapper->getTableAlias(true));
49 49
 
50 50
             $this->options[RelationConfig::THROUGH_FOREIGN_COLUMN] = $this->getKeyColumn($prefix, $foreignKey);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $throughAlias = $this->getOption(RelationConfig::THROUGH_TABLE_ALIAS);
96 96
         $throughName  = $throughAlias ?? $through;
97 97
 
98
-        if (! empty($throughColumns)) {
98
+        if (!empty($throughColumns)) {
99 99
             $prefix = $this->getOption(RelationConfig::THROUGH_COLUMNS_PREFIX);
100 100
             foreach ($throughColumns as $col) {
101 101
                 $query->columns("{$throughName}.{$col} AS {$prefix}{$col}");
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             /** @var Collection $collection */
151 151
             $collection = $this->nativeMapper->getEntityAttribute($nativeEntity, $this->name);
152 152
             foreach ($found as $foreignEntity) {
153
-                if (! $collection->contains($foreignEntity)) {
153
+                if (!$collection->contains($foreignEntity)) {
154 154
                     $collection->add($foreignEntity);
155 155
                 }
156 156
             }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $remainingRelations = $this->getRemainingRelations($action->getOption('relations'));
199 199
 
200 200
         // no cascade delete? treat as save so we can process the changes
201
-        if (! $this->isCascade()) {
201
+        if (!$this->isCascade()) {
202 202
             $this->addActionOnSave($action);
203 203
         } else {
204 204
             // retrieve them again from the DB since the related collection might not have everything
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
         /** @var Collection $foreignEntities */
224 224
         $foreignEntities = $this->nativeMapper->getEntityAttribute($action->getEntity(), $this->name);
225
-        if (! $foreignEntities) {
225
+        if (!$foreignEntities) {
226 226
             return;
227 227
         }
228 228
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
         // save the entities still in the collection
232 232
         foreach ($foreignEntities as $foreignEntity) {
233
-            if (! empty($foreignEntity->getChanges())) {
233
+            if (!empty($foreignEntity->getChanges())) {
234 234
                 $saveAction = $this->foreignMapper
235 235
                     ->newSaveAction($foreignEntity, [
236 236
                         'relations' => $remainingRelations
Please login to merge, or discard this patch.