@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $value = $this->castAttribute($attribute, $value); |
| 101 | - if (! isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
| 101 | + if (!isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
| 102 | 102 | $this->changed[$attribute] = true; |
| 103 | 103 | $this->state = StateEnum::CHANGED; |
| 104 | 104 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | public function get($attribute) |
| 111 | 111 | { |
| 112 | - if (! $attribute) { |
|
| 112 | + if (!$attribute) { |
|
| 113 | 113 | return null; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | public function getPersistenceState() |
| 122 | 122 | { |
| 123 | - if (! empty($this->changed)) { |
|
| 123 | + if (!empty($this->changed)) { |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return $this->state; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $changes = $this->changed; |
| 151 | 151 | foreach ($this->attributes as $name => $value) { |
| 152 | 152 | if (is_object($value) && method_exists($value, 'getChanges')) { |
| 153 | - if (! empty($value->getChanges())) { |
|
| 153 | + if (!empty($value->getChanges())) { |
|
| 154 | 154 | $changes[$name] = true; |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | protected function applyDefaults(): void |
| 15 | 15 | { |
| 16 | 16 | $nativeKey = $this->nativeMapper->getPrimaryKey(); |
| 17 | - if (! isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
| 17 | + if (!isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
| 18 | 18 | $this->options[RelationConfig::NATIVE_KEY] = $nativeKey; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if (! isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
| 21 | + if (!isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
| 22 | 22 | $prefix = Inflector::singularize($this->nativeMapper->getTable()); |
| 23 | 23 | $this->options[RelationConfig::FOREIGN_KEY] = $this->getKeyColumn($prefix, $nativeKey); |
| 24 | 24 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public function attachEntities(EntityInterface $nativeEntity, EntityInterface $foreignEntity) |
| 70 | 70 | { |
| 71 | 71 | foreach ($this->keyPairs as $nativeCol => $foreignCol) { |
| 72 | - $nativeKeyValue = $this->nativeMapper->getEntityAttribute($nativeEntity, $nativeCol); |
|
| 72 | + $nativeKeyValue = $this->nativeMapper->getEntityAttribute($nativeEntity, $nativeCol); |
|
| 73 | 73 | $this->foreignMapper->setEntityAttribute($foreignEntity, $foreignCol, $nativeKeyValue); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $remainingRelations = $this->getRemainingRelations($action->getOption('relations')); |
| 92 | 92 | |
| 93 | 93 | // no cascade delete? treat as save so we can process the changes |
| 94 | - if (! $this->isCascade()) { |
|
| 94 | + if (!$this->isCascade()) { |
|
| 95 | 95 | $this->addActionOnSave($action); |
| 96 | 96 | } else { |
| 97 | 97 | // retrieve them again from the DB since the related collection might not have everything |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | // save the entities still in the collection |
| 125 | 125 | foreach ($foreignEntities as $foreignEntity) { |
| 126 | - if (! empty($foreignEntity->getChanges())) { |
|
| 126 | + if (!empty($foreignEntity->getChanges())) { |
|
| 127 | 127 | $saveAction = $this->foreignMapper |
| 128 | 128 | ->newSaveAction($foreignEntity, ['relations' => $remainingRelations]); |
| 129 | 129 | $saveAction->addColumns($this->getExtraColumnsForAction()); |
@@ -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 | |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | public function revert() |
| 59 | 59 | { |
| 60 | - if (! $this->hasRun) { |
|
| 60 | + if (!$this->hasRun) { |
|
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | $this->entity->setPersistenceState($this->entityState); |
@@ -55,8 +55,8 @@ |
||
| 55 | 55 | if (count($columns) > 0) { |
| 56 | 56 | $updateSql = new \Sirius\Sql\Update($connection); |
| 57 | 57 | $updateSql->table($this->mapper->getTable()) |
| 58 | - ->columns($columns) |
|
| 59 | - ->whereAll($conditions, false); |
|
| 58 | + ->columns($columns) |
|
| 59 | + ->whereAll($conditions, false); |
|
| 60 | 60 | $updateSql->perform(); |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 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 | |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | public static function joinCondition($firsTable, $firstColumns, $secondTable, $secondColumns) |
| 18 | 18 | { |
| 19 | - $firstColumns = (array) $firstColumns; |
|
| 20 | - $secondColumns = (array) $secondColumns; |
|
| 19 | + $firstColumns = (array)$firstColumns; |
|
| 20 | + $secondColumns = (array)$secondColumns; |
|
| 21 | 21 | |
| 22 | 22 | $parts = []; |
| 23 | 23 | foreach ($firstColumns as $k => $col) { |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | |
| 85 | 85 | public function joinWith($name): Query |
| 86 | 86 | { |
| 87 | - if (! $this->mapper->hasRelation($name)) { |
|
| 87 | + if (!$this->mapper->hasRelation($name)) { |
|
| 88 | 88 | throw new \InvalidArgumentException( |
| 89 | 89 | sprintf("Relation %s, not defined for %s", $name, $this->mapper->getTable()) |
| 90 | 90 | ); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function bool($value) |
| 68 | 68 | { |
| 69 | - return ! ! $value; |
|
| 69 | + return !!$value; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // phpcs:ignore |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | public function float($value) |
| 84 | 84 | { |
| 85 | - return $value === null ? null : (float) $value; |
|
| 85 | + return $value === null ? null : (float)$value; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function decimal($value, $digits) |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function json($value) |
| 94 | 94 | { |
| 95 | - if (! $value) { |
|
| 95 | + if (!$value) { |
|
| 96 | 96 | return new \ArrayObject(); |
| 97 | 97 | } |
| 98 | 98 | if (is_array($value)) { |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $foreignMapper = $options[RelationConfig::FOREIGN_MAPPER]; |
| 24 | 24 | if ($this->orm->has($foreignMapper)) { |
| 25 | - if (! $foreignMapper instanceof Mapper) { |
|
| 25 | + if (!$foreignMapper instanceof Mapper) { |
|
| 26 | 26 | $foreignMapper = $this->orm->get($foreignMapper); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | $type = $options[RelationConfig::TYPE]; |
| 30 | 30 | $relationClass = __NAMESPACE__ . '\\' . Str::className($type); |
| 31 | 31 | |
| 32 | - if (! class_exists($relationClass)) { |
|
| 32 | + if (!class_exists($relationClass)) { |
|
| 33 | 33 | throw new \InvalidArgumentException("{$relationClass} does not exist"); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function hydrate(array $attributes = []) |
| 33 | 33 | { |
| 34 | 34 | $attributes = $this->castingManager |
| 35 | - ->castArray($attributes, $this->mapper->getCasts()); |
|
| 35 | + ->castArray($attributes, $this->mapper->getCasts()); |
|
| 36 | 36 | $attributes = Arr::renameKeys($attributes, $this->mapper->getColumnAttributeMap()); |
| 37 | 37 | $class = $this->mapper->getEntityClass() ?? GenericEntity::class; |
| 38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | array_flip($this->mapper->getColumnAttributeMap()) |
| 47 | 47 | ); |
| 48 | 48 | $data = $this->castingManager |
| 49 | - ->castArrayForDb($data, $this->mapper->getCasts()); |
|
| 49 | + ->castArrayForDb($data, $this->mapper->getCasts()); |
|
| 50 | 50 | |
| 51 | 51 | return Arr::only($data, $this->mapper->getColumns()); |
| 52 | 52 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | ) { |
| 45 | 45 | $this->connectionLocator = $connectionLocator; |
| 46 | 46 | |
| 47 | - if (! $castingManager) { |
|
| 47 | + if (!$castingManager) { |
|
| 48 | 48 | $castingManager = new CastingManager(); |
| 49 | 49 | } |
| 50 | 50 | $this->castingManager = $castingManager; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | unset($this->lazyMappers[$name]); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if (! isset($this->mappers[$name]) || ! $this->mappers[$name]) { |
|
| 83 | + if (!isset($this->mappers[$name]) || !$this->mappers[$name]) { |
|
| 84 | 84 | throw new InvalidArgumentException(sprintf('Mapper named %s is not registered', $name)); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $mapper = $mapperConfigOrFactory($this); |
| 122 | - if (! $mapper instanceof Mapper) { |
|
| 122 | + if (!$mapper instanceof Mapper) { |
|
| 123 | 123 | throw new InvalidArgumentException( |
| 124 | 124 | 'The mapper generated from the factory is not a valid `Mapper` instance' |
| 125 | 125 | ); |