@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | unset($this->lazyMappers[$name]); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if (! isset($this->mappers[$name]) || ! $this->mappers[$name]) { |
|
| 108 | + if (!isset($this->mappers[$name]) || !$this->mappers[$name]) { |
|
| 109 | 109 | throw new InvalidArgumentException(sprintf('Mapper named %s is not registered', $name)); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $foreignMapper = $options[RelationConfig::FOREIGN_MAPPER]; |
| 140 | 140 | if ($this->has($foreignMapper)) { |
| 141 | - if (! $foreignMapper instanceof Mapper) { |
|
| 141 | + if (!$foreignMapper instanceof Mapper) { |
|
| 142 | 142 | $foreignMapper = $this->get($foreignMapper); |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | $type = $options[RelationConfig::TYPE]; |
| 146 | 146 | $relationClass = 'Sirius\\Orm\\Relation\\' . Str::className($type); |
| 147 | 147 | |
| 148 | - if (! class_exists($relationClass)) { |
|
| 148 | + if (!class_exists($relationClass)) { |
|
| 149 | 149 | throw new InvalidArgumentException("{$relationClass} does not exist"); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | $mapper = $this->mapperLocator->get($mapperConfigOrFactory); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if (! $mapper) { |
|
| 171 | + if (!$mapper) { |
|
| 172 | 172 | throw new InvalidArgumentException( |
| 173 | 173 | 'The mapper could not be generated/retrieved.' |
| 174 | 174 | ); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if (! $mapper instanceof Mapper) { |
|
| 177 | + if (!$mapper instanceof Mapper) { |
|
| 178 | 178 | throw new InvalidArgumentException( |
| 179 | 179 | 'The mapper generated from the factory is not a valid `Mapper` instance.' |
| 180 | 180 | ); |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $mapper->getHydrator()->set($action->getEntity(), $this->updateColumn, $now); |
| 46 | 46 | } |
| 47 | 47 | if ($action instanceof Update && $this->updateColumn) { |
| 48 | - if (! empty($action->getEntity()->getChanges())) { |
|
| 48 | + if (!empty($action->getEntity()->getChanges())) { |
|
| 49 | 49 | $action->addColumns([$this->updateColumn => $now]); |
| 50 | 50 | $mapper->getHydrator()->set($action->getEntity(), $this->updateColumn, $now); |
| 51 | 51 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $this->relations[$name] = $relation; |
| 65 | 65 | $this->relationCallback[$name] = $callback; |
| 66 | - if (! empty($nextLoad)) { |
|
| 66 | + if (!empty($nextLoad)) { |
|
| 67 | 67 | $this->relationNextLoad[$name] = $nextLoad; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | public function getResultsForRelation($name) |
| 77 | 77 | { |
| 78 | - if (! isset($this->relations[$name])) { |
|
| 78 | + if (!isset($this->relations[$name])) { |
|
| 79 | 79 | return []; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $result = []; |
| 113 | 113 | foreach ($this->rows as $row) { |
| 114 | 114 | $value = $this->getColumnsFromRow($row, $columns, $hydrator); |
| 115 | - if ($value && ! in_array($value, $result)) { |
|
| 115 | + if ($value && !in_array($value, $result)) { |
|
| 116 | 116 | $result[] = $value; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | public function getLazyAggregate(Aggregate $aggregate) |
| 144 | 144 | { |
| 145 | 145 | $name = $aggregate->getName(); |
| 146 | - if (! isset($this->lazyAggregates[$name])) { |
|
| 146 | + if (!isset($this->lazyAggregates[$name])) { |
|
| 147 | 147 | $this->lazyAggregates[$name] = new LazyAggregate($this, $aggregate); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | public function getLazyRelation(Relation $relation) |
| 154 | 154 | { |
| 155 | 155 | $name = $relation->getOption('name'); |
| 156 | - if (! isset($this->lazyRelations[$name])) { |
|
| 156 | + if (!isset($this->lazyRelations[$name])) { |
|
| 157 | 157 | $this->lazyRelations[$name] = new LazyRelation($this, $relation); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $queryNextLoad = $this->relationNextLoad[$name] ?? []; |
| 192 | - if ($queryNextLoad && ! empty($queryNextLoad)) { |
|
| 192 | + if ($queryNextLoad && !empty($queryNextLoad)) { |
|
| 193 | 193 | foreach ($queryNextLoad as $next => $callback) { |
| 194 | 194 | $query = $query->load([$next => $callback]); |
| 195 | 195 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | |
| 44 | 44 | unset($this->lazyLoaders[$attribute]); |
| 45 | 45 | $value = $this->castAttribute($attribute, $value); |
| 46 | - if (! isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
| 46 | + if (!isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
| 47 | 47 | $this->markChanged($attribute); |
| 48 | 48 | $this->state = StateEnum::CHANGED; |
| 49 | 49 | } |
@@ -63,9 +63,9 @@ |
||
| 63 | 63 | |
| 64 | 64 | unset($this->lazyLoaders[$attribute]); |
| 65 | 65 | $value = $this->castAttribute($attribute, $value); |
| 66 | - if (! isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
| 66 | + if (!isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
| 67 | 67 | $this->markChanged($attribute); |
| 68 | - $this->state = StateEnum::CHANGED; |
|
| 68 | + $this->state = StateEnum::CHANGED; |
|
| 69 | 69 | } |
| 70 | 70 | $this->attributes[$attribute] = $value; |
| 71 | 71 | } |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | $changes = $this->changed; |
| 99 | 99 | foreach ($this->attributes as $name => $value) { |
| 100 | 100 | if (is_object($value) && method_exists($value, 'getChanges')) { |
| 101 | - if (! empty($value->getChanges())) { |
|
| 101 | + if (!empty($value->getChanges())) { |
|
| 102 | 102 | $changes[$name] = true; |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | return $this->set($entity, $this->getMapperConfig()->getPrimaryKey(), $value); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function hydrateToArray(array $attributes= []): array |
|
| 77 | + public function hydrateToArray(array $attributes = []): array |
|
| 78 | 78 | { |
| 79 | 79 | $attributes = Arr::renameKeys($attributes, $this->getMapperConfig()->getColumnAttributeMap()); |
| 80 | 80 | if ($this->castingManager) { |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | $relation = $this->mapper->getRelation($name); |
| 92 | 92 | if ($relation instanceof ToOneInterface |
| 93 | 93 | && isset($attributes[$name]) |
| 94 | - && ! is_object($attributes[$name])) { |
|
| 94 | + && !is_object($attributes[$name])) { |
|
| 95 | 95 | $attributes[$name] = $relation->getForeignMapper()->newEntity($attributes[$name]); |
| 96 | 96 | } elseif ($relation instanceof ToManyInterface |
| 97 | - && ! $relation instanceof ToOneInterface) { |
|
| 97 | + && !$relation instanceof ToOneInterface) { |
|
| 98 | 98 | /** |
| 99 | 99 | * here we need to check against ToOneInterface as well |
| 100 | 100 | * because OneToOne relation extends |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | $foreignMapper = $this->mapper->getRelation($relationName) |
| 63 | - ->getForeignMapper(); |
|
| 63 | + ->getForeignMapper(); |
|
| 64 | 64 | $currentValue = $this->mapper->getHydrator()->get($entity, $relationName); |
| 65 | 65 | $this->patchOrCreate($foreignMapper, $currentValue, $attributes); |
| 66 | 66 | $this->mapper->getHydrator()->set($entity, $relationName, $currentValue); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | private function patchCollection(EntityInterface $entity, string $relationName, $attributes) |
| 70 | 70 | { |
| 71 | 71 | $foreignMapper = $this->mapper->getRelation($relationName) |
| 72 | - ->getForeignMapper(); |
|
| 72 | + ->getForeignMapper(); |
|
| 73 | 73 | /** @var Collection|null $collection */ |
| 74 | 74 | $collection = $this->mapper->getHydrator()->get($entity, $relationName); |
| 75 | 75 | if (!$collection || $collection->isEmpty()) { |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | $foreignMapper = $this->mapper->getRelation($relationName) |
| 72 | 72 | ->getForeignMapper(); |
| 73 | 73 | /** @var Collection|null $collection */ |
| 74 | - $collection = $this->mapper->getHydrator()->get($entity, $relationName); |
|
| 74 | + $collection = $this->mapper->getHydrator()->get($entity, $relationName); |
|
| 75 | 75 | if (!$collection || $collection->isEmpty()) { |
| 76 | 76 | $this->mapper->getHydrator()->set($entity, $relationName, $foreignMapper->newCollection($attributes)); |
| 77 | 77 | return; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function includesRelation($relationName) |
| 118 | 118 | { |
| 119 | - $relations = (array) $this->getOption('relations'); |
|
| 119 | + $relations = (array)$this->getOption('relations'); |
|
| 120 | 120 | |
| 121 | 121 | return $relations === true || in_array($relationName, $relations); |
| 122 | 122 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | protected function addActionsForRelatedEntities() |
| 129 | 129 | { |
| 130 | - if (! $this->mapper) { |
|
| 130 | + if (!$this->mapper) { |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |