@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | unset($this->lazyMappers[$name]); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if (! isset($this->mappers[$name]) || ! $this->mappers[$name]) { |
|
| 102 | + if (!isset($this->mappers[$name]) || !$this->mappers[$name]) { |
|
| 103 | 103 | throw new InvalidArgumentException(sprintf('Mapper named %s is not registered', $name)); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -130,13 +130,13 @@ discard block |
||
| 130 | 130 | $mapper = $this->mapperLocator->get($mapperConfigOrFactory); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if (! $mapper) { |
|
| 133 | + if (!$mapper) { |
|
| 134 | 134 | throw new InvalidArgumentException( |
| 135 | 135 | 'The mapper could not be generated/retrieved.' |
| 136 | 136 | ); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if (! $mapper instanceof Mapper) { |
|
| 139 | + if (!$mapper instanceof Mapper) { |
|
| 140 | 140 | throw new InvalidArgumentException( |
| 141 | 141 | 'The mapper generated from the factory is not a valid `Mapper` instance.' |
| 142 | 142 | ); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | protected function maybeUpdatePivotRow() |
| 70 | 70 | { |
| 71 | - if (! $this->relation instanceof ManyToMany) { |
|
| 71 | + if (!$this->relation instanceof ManyToMany) { |
|
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $delete->where($pivotForeignColumns[$k], $foreignKey[$k]); |
| 89 | 89 | } |
| 90 | 90 | foreach ((array)$this->relation->getOption(RelationConfig::PIVOT_GUARDS) as $col => $value) { |
| 91 | - if (! is_int($col)) { |
|
| 91 | + if (!is_int($col)) { |
|
| 92 | 92 | $delete->where($col, $value); |
| 93 | 93 | } else { |
| 94 | 94 | $delete->where($value); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | foreach ((array)$this->relation->getOption(RelationConfig::PIVOT_GUARDS) as $col => $value) { |
| 111 | - if (! is_int($col)) { |
|
| 111 | + if (!is_int($col)) { |
|
| 112 | 112 | $insertColumns[$col] = $value; |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $conditions = []; |
| 76 | 76 | |
| 77 | - $nativeEntityPk = (array)$this->nativeMapper->getConfig()->getPrimaryKey(); |
|
| 77 | + $nativeEntityPk = (array)$this->nativeMapper->getConfig()->getPrimaryKey(); |
|
| 78 | 78 | $pivotThroughCols = (array)$this->relation->getOption(RelationConfig::PIVOT_NATIVE_COLUMN); |
| 79 | 79 | foreach ($nativeEntityPk as $idx => $col) { |
| 80 | 80 | $val = $this->nativeEntityHydrator->get($this->nativeEntity, $col); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $entityPk = (array)$this->mapper->getConfig()->getPrimaryKey(); |
|
| 86 | + $entityPk = (array)$this->mapper->getConfig()->getPrimaryKey(); |
|
| 87 | 87 | $pivotColumns = (array)$this->relation->getOption(RelationConfig::PIVOT_FOREIGN_COLUMN); |
| 88 | 88 | foreach ($entityPk as $idx => $col) { |
| 89 | 89 | $val = $this->entityHydrator->get($this->entity, $col); |
@@ -13,14 +13,14 @@ |
||
| 13 | 13 | { |
| 14 | 14 | $foreignMapper = $options[RelationConfig::FOREIGN_MAPPER]; |
| 15 | 15 | if ($orm->has($foreignMapper)) { |
| 16 | - if (! $foreignMapper instanceof Mapper) { |
|
| 16 | + if (!$foreignMapper instanceof Mapper) { |
|
| 17 | 17 | $foreignMapper = $orm->get($foreignMapper); |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | $type = $options[RelationConfig::TYPE]; |
| 21 | 21 | $relationClass = 'Sirius\\Orm\\Relation\\' . Str::className($type); |
| 22 | 22 | |
| 23 | - if (! class_exists($relationClass)) { |
|
| 23 | + if (!class_exists($relationClass)) { |
|
| 24 | 24 | throw new InvalidArgumentException("{$relationClass} does not exist"); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -21,28 +21,28 @@ discard block |
||
| 21 | 21 | parent::applyDefaults(); |
| 22 | 22 | |
| 23 | 23 | $foreignKey = $this->foreignMapper->getConfig()->getPrimaryKey(); |
| 24 | - if (! isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
| 24 | + if (!isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
| 25 | 25 | $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $nativeKey = $this->foreignMapper->getConfig()->getPrimaryKey(); |
| 29 | - if (! isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
| 29 | + if (!isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
| 30 | 30 | $this->options[RelationConfig::NATIVE_KEY] = $nativeKey; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if (! isset($this->options[RelationConfig::PIVOT_TABLE])) { |
|
| 33 | + if (!isset($this->options[RelationConfig::PIVOT_TABLE])) { |
|
| 34 | 34 | $tables = [$this->foreignMapper->getConfig()->getTable(), $this->nativeMapper->getConfig()->getTable()]; |
| 35 | 35 | sort($tables); |
| 36 | 36 | $this->options[RelationConfig::PIVOT_TABLE] = implode('_', $tables); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if (! isset($this->options[RelationConfig::PIVOT_NATIVE_COLUMN])) { |
|
| 39 | + if (!isset($this->options[RelationConfig::PIVOT_NATIVE_COLUMN])) { |
|
| 40 | 40 | $prefix = Inflector::singularize($this->nativeMapper->getConfig()->getTableAlias(true)); |
| 41 | 41 | |
| 42 | 42 | $this->options[RelationConfig::PIVOT_NATIVE_COLUMN] = $this->getKeyColumn($prefix, $nativeKey); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if (! isset($this->options[RelationConfig::PIVOT_FOREIGN_COLUMN])) { |
|
| 45 | + if (!isset($this->options[RelationConfig::PIVOT_FOREIGN_COLUMN])) { |
|
| 46 | 46 | $prefix = Inflector::singularize($this->foreignMapper->getConfig()->getTableAlias(true)); |
| 47 | 47 | |
| 48 | 48 | $this->options[RelationConfig::PIVOT_FOREIGN_COLUMN] = $this->getKeyColumn($prefix, $foreignKey); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $pivotTableAlias = $this->getOption(RelationConfig::PIVOT_TABLE_ALIAS); |
| 99 | 99 | $pivotName = $pivotTableAlias ?? $pivotTable; |
| 100 | 100 | |
| 101 | - if (! empty($pivotColumns)) { |
|
| 101 | + if (!empty($pivotColumns)) { |
|
| 102 | 102 | foreach ($pivotColumns as $col => $alias) { |
| 103 | 103 | $query->columns("{$pivotName}.{$col} AS {$alias}"); |
| 104 | 104 | } |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | protected function addActionOnSave(BaseAction $action) |
| 196 | 196 | { |
| 197 | - if (! $this->relationWasChanged($action->getEntity())) { |
|
| 197 | + if (!$this->relationWasChanged($action->getEntity())) { |
|
| 198 | 198 | return; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - if (! $action->includesRelation($this->name)) { |
|
| 201 | + if (!$action->includesRelation($this->name)) { |
|
| 202 | 202 | return; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | /** @var Collection $foreignEntities */ |
| 208 | 208 | $foreignEntities = $this->nativeEntityHydrator->get($action->getEntity(), $this->name); |
| 209 | - if (! $foreignEntities || ! $foreignEntities instanceof Collection || $foreignEntities->isEmpty()) { |
|
| 209 | + if (!$foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) { |
|
| 210 | 210 | return; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | // save the entities still in the collection |
| 216 | 216 | foreach ($foreignEntities as $foreignEntity) { |
| 217 | - if (! empty($foreignEntity->getChanges())) { |
|
| 217 | + if (!empty($foreignEntity->getChanges())) { |
|
| 218 | 218 | $saveAction = $this->foreignMapper |
| 219 | 219 | ->newSaveAction($foreignEntity, [ |
| 220 | 220 | 'relations' => $remainingRelations |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | protected function maybeSetAdditionalProperties() |
| 60 | 60 | { |
| 61 | - if (! $this->mapper || ! $this->foreignMapper) { |
|
| 61 | + if (!$this->mapper || !$this->foreignMapper) { |
|
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if (! $this->pivotTable) { |
|
| 65 | + if (!$this->pivotTable) { |
|
| 66 | 66 | $tablePrefix = $this->mapper->getTableAlias() ? |
| 67 | 67 | str_replace($this->mapper->getTable(), '', $this->mapper->getTableAlias()) |
| 68 | 68 | : ''; |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if (! $this->pivotNativeColumn) { |
|
| 80 | + if (!$this->pivotNativeColumn) { |
|
| 81 | 81 | $this->pivotNativeColumn = Inflector::singularize($this->mapper->getName()) . '_id'; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (! $this->pivotForeignColumn) { |
|
| 84 | + if (!$this->pivotForeignColumn) { |
|
| 85 | 85 | $this->pivotForeignColumn = Inflector::singularize($this->foreignMapper) . '_id'; |
| 86 | 86 | } |
| 87 | 87 | } |