@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $mapper->entityClass = $mapperConfig->entityClass; |
145 | 145 | } |
146 | 146 | |
147 | - if (isset($mapperConfig->behaviours) && ! empty($mapperConfig->behaviours)) { |
|
147 | + if (isset($mapperConfig->behaviours) && !empty($mapperConfig->behaviours)) { |
|
148 | 148 | $mapper->use(...$mapperConfig->behaviours); |
149 | 149 | } |
150 | 150 | |
@@ -155,14 +155,14 @@ discard block |
||
155 | 155 | { |
156 | 156 | $this->orm = $orm; |
157 | 157 | |
158 | - if (! $entityHydrator) { |
|
158 | + if (!$entityHydrator) { |
|
159 | 159 | $entityHydrator = new GenericEntityHydrator(); |
160 | 160 | $entityHydrator->setMapper($this); |
161 | 161 | $entityHydrator->setCastingManager($orm->getCastingManager()); |
162 | 162 | } |
163 | 163 | $this->entityHydrator = $entityHydrator; |
164 | 164 | |
165 | - if (! $queryBuilder) { |
|
165 | + if (!$queryBuilder) { |
|
166 | 166 | $queryBuilder = QueryBuilder::getInstance(); |
167 | 167 | } |
168 | 168 | $this->queryBuilder = $queryBuilder; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $mapper = $this; |
234 | 234 | |
235 | 235 | $singular = Inflector::singularize($this->getTableAlias(true)); |
236 | - $castingManager->register($singular, function ($value) use ($mapper) { |
|
236 | + $castingManager->register($singular, function($value) use ($mapper) { |
|
237 | 237 | if ($value instanceof $this->entityClass) { |
238 | 238 | return $value; |
239 | 239 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | }); |
243 | 243 | |
244 | 244 | $plural = $this->getTableAlias(true); |
245 | - $castingManager->register($plural, function ($values) use ($mapper) { |
|
245 | + $castingManager->register($plural, function($values) use ($mapper) { |
|
246 | 246 | if ($values instanceof Collection) { |
247 | 247 | return $values; |
248 | 248 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function getTableAlias($returnTableIfNull = false) |
280 | 280 | { |
281 | - return (! $this->tableAlias && $returnTableIfNull) ? $this->table : $this->tableAlias; |
|
281 | + return (!$this->tableAlias && $returnTableIfNull) ? $this->table : $this->tableAlias; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | public function getTableReference() |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | return null; |
348 | 348 | } |
349 | 349 | |
350 | - $receivedTracker = ! ! $tracker; |
|
351 | - if (! $tracker) { |
|
350 | + $receivedTracker = !!$tracker; |
|
351 | + if (!$tracker) { |
|
352 | 352 | $receivedTracker = false; |
353 | 353 | $tracker = new Tracker([$data]); |
354 | 354 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $this->injectAggregates($entity, $tracker, $load); |
359 | 359 | $entity->setPersistenceState(StateEnum::SYNCHRONIZED); |
360 | 360 | |
361 | - if (! $receivedTracker) { |
|
361 | + if (!$receivedTracker) { |
|
362 | 362 | $tracker->replaceRows([$entity]); |
363 | 363 | } |
364 | 364 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $queryCallback = $eagerLoad[$name] ?? null; |
404 | 404 | $nextLoad = Arr::getChildren($eagerLoad, $name); |
405 | 405 | |
406 | - if (! $tracker->hasRelation($name)) { |
|
406 | + if (!$tracker->hasRelation($name)) { |
|
407 | 407 | $tracker->setRelation($name, $relation, $queryCallback, $nextLoad); |
408 | 408 | } |
409 | 409 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | protected function injectAggregates(EntityInterface $entity, Tracker $tracker, array $eagerLoad = []) |
421 | 421 | { |
422 | 422 | foreach (array_keys($this->relations) as $name) { |
423 | - $relation = $this->getRelation($name); |
|
423 | + $relation = $this->getRelation($name); |
|
424 | 424 | if (!method_exists($relation, 'getAggregates')) { |
425 | 425 | continue; |
426 | 426 | } |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | |
470 | 470 | public function getRelation($name): Relation |
471 | 471 | { |
472 | - if (! $this->hasRelation($name)) { |
|
472 | + if (!$this->hasRelation($name)) { |
|
473 | 473 | throw new \InvalidArgumentException("Relation named {$name} is not registered for this mapper"); |
474 | 474 | } |
475 | 475 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $this->relations[$name] = $this->orm->createRelation($this, $name, $this->relations[$name]); |
478 | 478 | } |
479 | 479 | $relation = $this->relations[$name]; |
480 | - if (! $relation instanceof Relation) { |
|
480 | + if (!$relation instanceof Relation) { |
|
481 | 481 | throw new \InvalidArgumentException("Relation named {$name} is not a proper Relation instance"); |
482 | 482 | } |
483 | 483 | |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | public function newSaveAction(EntityInterface $entity, $options): Update |
533 | 533 | { |
534 | - if (! $this->getEntityAttribute($entity, $this->primaryKey)) { |
|
534 | + if (!$this->getEntityAttribute($entity, $this->primaryKey)) { |
|
535 | 535 | $action = new Insert($this, $entity, $options); |
536 | 536 | } else { |
537 | 537 | $action = new Update($this, $entity, $options); |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | |
569 | 569 | protected function assertCanPersistEntity($entity) |
570 | 570 | { |
571 | - if (! $entity || ! $entity instanceof $this->entityClass) { |
|
571 | + if (!$entity || !$entity instanceof $this->entityClass) { |
|
572 | 572 | throw new \InvalidArgumentException(sprintf( |
573 | 573 | 'Mapper %s can only persist entity of class %s. %s class provided', |
574 | 574 | __CLASS__, |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | public function joinSubselect(Query $query, string $reference) |
29 | 29 | { |
30 | 30 | $subselect = $query->subSelectForJoinWith() |
31 | - ->from($this->foreignMapper->getTable()) |
|
32 | - ->columns($this->foreignMapper->getTable() . '.*') |
|
33 | - ->as($reference); |
|
31 | + ->from($this->foreignMapper->getTable()) |
|
32 | + ->columns($this->foreignMapper->getTable() . '.*') |
|
33 | + ->as($reference); |
|
34 | 34 | |
35 | 35 | $subselect = $this->applyQueryCallback($subselect); |
36 | 36 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->addActionOnSave($action); |
109 | 109 | } else { |
110 | 110 | $foreignEntity = $this->nativeMapper |
111 | - ->getEntityAttribute($action->getEntity(), $this->name); |
|
111 | + ->getEntityAttribute($action->getEntity(), $this->name); |
|
112 | 112 | |
113 | 113 | if ($foreignEntity) { |
114 | 114 | $remainingRelations = $this->getRemainingRelations($action->getOption('relations')); |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | parent::applyDefaults(); |
16 | 16 | |
17 | 17 | $foreignKey = $this->foreignMapper->getPrimaryKey(); |
18 | - if (! isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
18 | + if (!isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
19 | 19 | $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey; |
20 | 20 | } |
21 | 21 | |
22 | - if (! isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
22 | + if (!isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
23 | 23 | $nativeKey = $this->getKeyColumn($this->name, $foreignKey); |
24 | 24 | $this->options[RelationConfig::NATIVE_KEY] = $nativeKey; |
25 | 25 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $state = $foreignEntity->getPersistenceState(); |
88 | 88 | $foreignEntity->setPersistenceState(StateEnum::SYNCHRONIZED); |
89 | 89 | |
90 | - $nativeKey = (array)$this->getOption(RelationConfig::NATIVE_KEY); |
|
90 | + $nativeKey = (array)$this->getOption(RelationConfig::NATIVE_KEY); |
|
91 | 91 | |
92 | 92 | foreach ($nativeKey as $k => $col) { |
93 | 93 | $this->nativeMapper->setEntityAttribute( |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | protected function addActionOnDelete(BaseAction $action) |
105 | 105 | { |
106 | 106 | // no cascade delete? treat it as a save |
107 | - if (! $this->isCascade()) { |
|
107 | + if (!$this->isCascade()) { |
|
108 | 108 | $this->addActionOnSave($action); |
109 | 109 | } else { |
110 | 110 | $foreignEntity = $this->nativeMapper |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $this->addActionOnSave($action); |
35 | 35 | } else { |
36 | 36 | $foreignEntity = $this->nativeMapper |
37 | - ->getEntityAttribute($action->getEntity(), $this->name); |
|
37 | + ->getEntityAttribute($action->getEntity(), $this->name); |
|
38 | 38 | |
39 | 39 | if ($foreignEntity) { |
40 | 40 | $remainingRelations = $this->getRemainingRelations($action->getOption('relations')); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | protected function addActionOnDelete(BaseAction $action) |
31 | 31 | { |
32 | 32 | // no cascade delete? treat it as a save |
33 | - if (! $this->isCascade()) { |
|
33 | + if (!$this->isCascade()) { |
|
34 | 34 | $this->addActionOnSave($action); |
35 | 35 | } else { |
36 | 36 | $foreignEntity = $this->nativeMapper |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function addActionOnSave(BaseAction $action) |
50 | 50 | { |
51 | - if (! $this->relationWasChanged($action->getEntity())) { |
|
51 | + if (!$this->relationWasChanged($action->getEntity())) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | $foreignEntity = $this->nativeMapper->getEntityAttribute($action->getEntity(), $this->name); |