@@ -48,9 +48,9 @@ |
||
| 48 | 48 | public function joinSubselect(Query $query, string $reference) |
| 49 | 49 | { |
| 50 | 50 | $subselect = $query->subSelectForJoinWith() |
| 51 | - ->columns($this->foreignMapper->getTable() . '.*') |
|
| 52 | - ->from($this->foreignMapper->getTable()) |
|
| 53 | - ->as($reference); |
|
| 51 | + ->columns($this->foreignMapper->getTable() . '.*') |
|
| 52 | + ->from($this->foreignMapper->getTable()) |
|
| 53 | + ->as($reference); |
|
| 54 | 54 | |
| 55 | 55 | $subselect = $this->applyQueryCallback($subselect); |
| 56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | ->newQuery(); |
| 61 | 61 | |
| 62 | 62 | $query = $this->joinWithThroughTable($query) |
| 63 | - ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks); |
|
| 63 | + ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks); |
|
| 64 | 64 | |
| 65 | 65 | $query = $this->applyQueryCallback($query); |
| 66 | 66 | |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | public function joinSubselect(Query $query, string $reference) |
| 113 | 113 | { |
| 114 | 114 | $subselect = $query->subSelectForJoinWith() |
| 115 | - ->from($this->foreignMapper->getTable()) |
|
| 116 | - ->columns($this->foreignMapper->getTable() . '.*') |
|
| 117 | - ->as($reference); |
|
| 115 | + ->from($this->foreignMapper->getTable()) |
|
| 116 | + ->columns($this->foreignMapper->getTable() . '.*') |
|
| 117 | + ->as($reference); |
|
| 118 | 118 | |
| 119 | 119 | $subselect = $this->joinWithThroughTable($subselect); |
| 120 | 120 | |
@@ -23,28 +23,28 @@ discard block |
||
| 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 |
||
| 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}"); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | /** @var Collection $collection */ |
| 150 | 150 | $collection = $this->nativeMapper->getEntityAttribute($nativeEntity, $this->name); |
| 151 | 151 | foreach ($found as $foreignEntity) { |
| 152 | - if (! $collection->contains($foreignEntity)) { |
|
| 152 | + if (!$collection->contains($foreignEntity)) { |
|
| 153 | 153 | $collection->add($foreignEntity); |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $remainingRelations = $this->getRemainingRelations($action->getOption('relations')); |
| 197 | 197 | |
| 198 | 198 | // no cascade delete? treat as save so we can process the changes |
| 199 | - if (! $this->isCascade()) { |
|
| 199 | + if (!$this->isCascade()) { |
|
| 200 | 200 | $this->addActionOnSave($action); |
| 201 | 201 | } else { |
| 202 | 202 | // retrieve them again from the DB since the related collection might not have everything |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $remainingRelations = $this->getRemainingRelations($action->getOption('relations')); |
| 220 | 220 | |
| 221 | 221 | $foreignEntities = $this->nativeMapper->getEntityAttribute($action->getEntity(), $this->name); |
| 222 | - if (! $foreignEntities) { |
|
| 222 | + if (!$foreignEntities) { |
|
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | // save the entities still in the collection |
| 229 | 229 | foreach ($foreignEntities as $foreignEntity) { |
| 230 | - if (! empty($foreignEntity->getChanges())) { |
|
| 230 | + if (!empty($foreignEntity->getChanges())) { |
|
| 231 | 231 | $saveAction = $this->foreignMapper |
| 232 | 232 | ->newSaveAction($foreignEntity, [ |
| 233 | 233 | 'relations' => $remainingRelations |