@@ -45,6 +45,7 @@ |
||
45 | 45 | * {@inheritDoc} |
46 | 46 | * |
47 | 47 | * @param MultiGetCache $cache |
48 | + * @param string $name |
|
48 | 49 | */ |
49 | 50 | public function __construct($name, MultiGetCache $cache, $lifetime = 0) |
50 | 51 | { |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Cache\Region; |
7 | 7 |
@@ -23,7 +23,6 @@ |
||
23 | 23 | |
24 | 24 | use Doctrine\ORM\Mapping\ToOneAssociationMetadata; |
25 | 25 | use PDO; |
26 | -use Doctrine\ORM\Mapping\ClassMetadata; |
|
27 | 26 | |
28 | 27 | /** |
29 | 28 | * The ArrayHydrator produces a nested array "graph" that is often (not always) |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM\Internal\Hydration; |
6 | 6 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | // It's a joined result |
95 | 95 | |
96 | 96 | $parent = $this->rsm->parentAliasMap[$dqlAlias]; |
97 | - $path = $parent . '.' . $dqlAlias; |
|
97 | + $path = $parent.'.'.$dqlAlias; |
|
98 | 98 | |
99 | 99 | // missing parent data, skipping as RIGHT JOIN hydration is not supported. |
100 | - if ( ! isset($nonemptyComponents[$parent]) ) { |
|
100 | + if ( ! isset($nonemptyComponents[$parent])) { |
|
101 | 101 | continue; |
102 | 102 | } |
103 | 103 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | if ($this->rsm->isMixed && isset($this->rootAliases[$parent])) { |
107 | 107 | $first = reset($this->resultPointers); |
108 | 108 | // TODO: Exception if $key === null ? |
109 | - $baseElement =& $this->resultPointers[$parent][key($first)]; |
|
109 | + $baseElement = & $this->resultPointers[$parent][key($first)]; |
|
110 | 110 | } else if (isset($this->resultPointers[$parent])) { |
111 | - $baseElement =& $this->resultPointers[$parent]; |
|
111 | + $baseElement = & $this->resultPointers[$parent]; |
|
112 | 112 | } else { |
113 | 113 | unset($this->resultPointers[$dqlAlias]); // Ticket #1228 |
114 | 114 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $relation = $parentClass->getProperty($relationAlias); |
121 | 121 | |
122 | 122 | // Check the type of the relation (many or single-valued) |
123 | - if (! $relation instanceof ToOneAssociationMetadata) { |
|
123 | + if ( ! $relation instanceof ToOneAssociationMetadata) { |
|
124 | 124 | $oneToOne = false; |
125 | 125 | |
126 | 126 | if ( ! isset($baseElement[$relationAlias])) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - $coll =& $baseElement[$relationAlias]; |
|
162 | + $coll = & $baseElement[$relationAlias]; |
|
163 | 163 | |
164 | 164 | if (is_array($coll)) { |
165 | 165 | $this->updateResultPointer($coll, $index, $dqlAlias, $oneToOne); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $entityKey = $this->rsm->entityMappings[$dqlAlias] ?: 0; |
172 | 172 | |
173 | 173 | // if this row has a NULL value for the root result id then make it a null result. |
174 | - if ( ! isset($nonemptyComponents[$dqlAlias]) ) { |
|
174 | + if ( ! isset($nonemptyComponents[$dqlAlias])) { |
|
175 | 175 | $result[] = $this->rsm->isMixed |
176 | 176 | ? [$entityKey => null] |
177 | 177 | : null; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $resultKey = $this->resultCounter - 1; |
233 | 233 | } |
234 | 234 | |
235 | - $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0); |
|
235 | + $scalarCount = (isset($rowData['scalars']) ? count($rowData['scalars']) : 0); |
|
236 | 236 | |
237 | 237 | foreach ($rowData['newObjects'] as $objIndex => $newObject) { |
238 | 238 | $class = $newObject['class']; |
@@ -270,13 +270,13 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | if ($oneToOne) { |
273 | - $this->resultPointers[$dqlAlias] =& $coll; |
|
273 | + $this->resultPointers[$dqlAlias] = & $coll; |
|
274 | 274 | |
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
278 | 278 | if ($index !== false) { |
279 | - $this->resultPointers[$dqlAlias] =& $coll[$index]; |
|
279 | + $this->resultPointers[$dqlAlias] = & $coll[$index]; |
|
280 | 280 | |
281 | 281 | return; |
282 | 282 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | end($coll); |
289 | - $this->resultPointers[$dqlAlias] =& $coll[key($coll)]; |
|
289 | + $this->resultPointers[$dqlAlias] = & $coll[key($coll)]; |
|
290 | 290 | |
291 | 291 | return; |
292 | 292 | } |
@@ -25,8 +25,6 @@ |
||
25 | 25 | use Doctrine\ORM\Mapping\ToManyAssociationMetadata; |
26 | 26 | use Doctrine\ORM\Mapping\ToOneAssociationMetadata; |
27 | 27 | use PDO; |
28 | -use Doctrine\Common\Collections\ArrayCollection; |
|
29 | -use Doctrine\ORM\Event\PostLoadEventDispatcher; |
|
30 | 28 | use Doctrine\ORM\Mapping\ClassMetadata; |
31 | 29 | use Doctrine\ORM\PersistentCollection; |
32 | 30 | use Doctrine\ORM\Proxy\Proxy; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM\Internal\Hydration; |
6 | 6 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function prepare() |
70 | 70 | { |
71 | - if (! isset($this->hints[UnitOfWork::HINT_DEFEREAGERLOAD])) { |
|
71 | + if ( ! isset($this->hints[UnitOfWork::HINT_DEFEREAGERLOAD])) { |
|
72 | 72 | $this->hints[UnitOfWork::HINT_DEFEREAGERLOAD] = true; |
73 | 73 | } |
74 | 74 | |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | |
79 | 79 | // Remember which associations are "fetch joined", so that we know where to inject |
80 | 80 | // collection stubs or proxies and where not. |
81 | - if (! isset($this->rsm->relationMap[$dqlAlias])) { |
|
81 | + if ( ! isset($this->rsm->relationMap[$dqlAlias])) { |
|
82 | 82 | continue; |
83 | 83 | } |
84 | 84 | |
85 | 85 | $parent = $this->rsm->parentAliasMap[$dqlAlias]; |
86 | 86 | |
87 | - if (! isset($this->rsm->aliasMap[$parent])) { |
|
87 | + if ( ! isset($this->rsm->aliasMap[$parent])) { |
|
88 | 88 | throw HydrationException::parentObjectOfRelationNotFound($dqlAlias, $parent); |
89 | 89 | } |
90 | 90 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $class = $this->getClassMetadata($className); |
111 | 111 | $inverseAssoc = $class->getProperty($association->getInversedBy()); |
112 | 112 | |
113 | - if (! ($inverseAssoc instanceof ToOneAssociationMetadata)) { |
|
113 | + if ( ! ($inverseAssoc instanceof ToOneAssociationMetadata)) { |
|
114 | 114 | continue; |
115 | 115 | } |
116 | 116 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | $value = $association->getValue($entity); |
177 | 177 | $oid = spl_object_hash($entity); |
178 | 178 | |
179 | - if (! $value instanceof PersistentCollection) { |
|
179 | + if ( ! $value instanceof PersistentCollection) { |
|
180 | 180 | $value = $association->wrap($entity, $value, $this->em); |
181 | 181 | |
182 | 182 | $association->setValue($entity, $value); |
183 | 183 | |
184 | 184 | $this->uow->setOriginalEntityProperty($oid, $fieldName, $value); |
185 | 185 | |
186 | - $this->initializedCollections[$oid . $fieldName] = $value; |
|
186 | + $this->initializedCollections[$oid.$fieldName] = $value; |
|
187 | 187 | } else if ( |
188 | 188 | isset($this->hints[Query::HINT_REFRESH]) || |
189 | 189 | (isset($this->hints['fetched'][$parentDqlAlias][$fieldName]) && ! $value->isInitialized()) |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | $value->setInitialized(true); |
194 | 194 | $value->unwrap()->clear(); |
195 | 195 | |
196 | - $this->initializedCollections[$oid . $fieldName] = $value; |
|
196 | + $this->initializedCollections[$oid.$fieldName] = $value; |
|
197 | 197 | } else { |
198 | 198 | // Is already PersistentCollection, and DON'T REFRESH or FETCH-JOIN! |
199 | - $this->existingCollections[$oid . $fieldName] = $value; |
|
199 | + $this->existingCollections[$oid.$fieldName] = $value; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $value; |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | $parentAlias = $this->rsm->parentAliasMap[$dqlAlias]; |
315 | 315 | // we need the $path to save into the identifier map which entities were already |
316 | 316 | // seen for this parent-child relationship |
317 | - $path = $parentAlias . '.' . $dqlAlias; |
|
317 | + $path = $parentAlias.'.'.$dqlAlias; |
|
318 | 318 | |
319 | 319 | // We have a RIGHT JOIN result here. Doctrine cannot hydrate RIGHT JOIN Object-Graphs |
320 | - if (! isset($nonemptyComponents[$parentAlias])) { |
|
320 | + if ( ! isset($nonemptyComponents[$parentAlias])) { |
|
321 | 321 | // TODO: Add special case code where we hydrate the right join objects into identity map at least |
322 | 322 | continue; |
323 | 323 | } |
@@ -348,15 +348,15 @@ discard block |
||
348 | 348 | $oid = spl_object_hash($parentObject); |
349 | 349 | |
350 | 350 | // Check the type of the relation (many or single-valued) |
351 | - if (! ($association instanceof ToOneAssociationMetadata)) { |
|
351 | + if ( ! ($association instanceof ToOneAssociationMetadata)) { |
|
352 | 352 | // PATH A: Collection-valued association |
353 | 353 | $reflFieldValue = $association->getValue($parentObject); |
354 | 354 | |
355 | 355 | if (isset($nonemptyComponents[$dqlAlias])) { |
356 | - $collKey = $oid . $relationField; |
|
356 | + $collKey = $oid.$relationField; |
|
357 | 357 | if (isset($this->initializedCollections[$collKey])) { |
358 | 358 | $reflFieldValue = $this->initializedCollections[$collKey]; |
359 | - } else if (! isset($this->existingCollections[$collKey])) { |
|
359 | + } else if ( ! isset($this->existingCollections[$collKey])) { |
|
360 | 360 | $reflFieldValue = $this->initRelatedCollection($parentObject, $parentClass, $relationField, $parentAlias); |
361 | 361 | } |
362 | 362 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $index = $indexExists ? $this->identifierMap[$path][$id[$parentAlias]][$id[$dqlAlias]] : false; |
365 | 365 | $indexIsValid = $index !== false ? isset($reflFieldValue[$index]) : false; |
366 | 366 | |
367 | - if (! $indexExists || ! $indexIsValid) { |
|
367 | + if ( ! $indexExists || ! $indexIsValid) { |
|
368 | 368 | if (isset($this->existingCollections[$collKey])) { |
369 | 369 | // Collection exists, only look for the element in the identity map. |
370 | 370 | if ($element = $this->getEntityFromIdentityMap($entityName, $data)) { |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | // PATH B: Single-valued association |
401 | 401 | $reflFieldValue = $association->getValue($parentObject); |
402 | 402 | |
403 | - if (! $reflFieldValue || isset($this->hints[Query::HINT_REFRESH]) || |
|
403 | + if ( ! $reflFieldValue || isset($this->hints[Query::HINT_REFRESH]) || |
|
404 | 404 | ($reflFieldValue instanceof Proxy && ! $reflFieldValue->__isInitialized())) { |
405 | 405 | // we only need to take action if this value is null, |
406 | 406 | // we refresh the entity or its an uninitialized proxy. |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $entityKey = $this->rsm->entityMappings[$dqlAlias] ?: 0; |
462 | 462 | |
463 | 463 | // if this row has a NULL value for the root result id then make it a null result. |
464 | - if ( ! isset($nonemptyComponents[$dqlAlias]) ) { |
|
464 | + if ( ! isset($nonemptyComponents[$dqlAlias])) { |
|
465 | 465 | if ($this->rsm->isMixed) { |
466 | 466 | $result[] = [$entityKey => null]; |
467 | 467 | } else { |
@@ -517,13 +517,13 @@ discard block |
||
517 | 517 | } |
518 | 518 | } |
519 | 519 | |
520 | - if ( ! isset($resultKey) ) { |
|
520 | + if ( ! isset($resultKey)) { |
|
521 | 521 | $this->resultCounter++; |
522 | 522 | } |
523 | 523 | |
524 | 524 | // Append scalar values to mixed result sets |
525 | 525 | if (isset($rowData['scalars'])) { |
526 | - if ( ! isset($resultKey) ) { |
|
526 | + if ( ! isset($resultKey)) { |
|
527 | 527 | $resultKey = (isset($this->rsm->indexByMap['scalars'])) |
528 | 528 | ? $row[$this->rsm->indexByMap['scalars']] |
529 | 529 | : $this->resultCounter - 1; |
@@ -536,19 +536,19 @@ discard block |
||
536 | 536 | |
537 | 537 | // Append new object to mixed result sets |
538 | 538 | if (isset($rowData['newObjects'])) { |
539 | - if ( ! isset($resultKey) ) { |
|
539 | + if ( ! isset($resultKey)) { |
|
540 | 540 | $resultKey = $this->resultCounter - 1; |
541 | 541 | } |
542 | 542 | |
543 | 543 | |
544 | - $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0); |
|
544 | + $scalarCount = (isset($rowData['scalars']) ? count($rowData['scalars']) : 0); |
|
545 | 545 | |
546 | 546 | foreach ($rowData['newObjects'] as $objIndex => $newObject) { |
547 | 547 | $class = $newObject['class']; |
548 | 548 | $args = $newObject['args']; |
549 | 549 | $obj = $class->newInstanceArgs($args); |
550 | 550 | |
551 | - if ($scalarCount == 0 && count($rowData['newObjects']) == 1 ) { |
|
551 | + if ($scalarCount == 0 && count($rowData['newObjects']) == 1) { |
|
552 | 552 | $result[$resultKey] = $obj; |
553 | 553 | |
554 | 554 | continue; |
@@ -1278,7 +1278,7 @@ |
||
1278 | 1278 | * |
1279 | 1279 | * @todo guilhermeblanco Only used for ClassMetadataTest. Remove if possible! |
1280 | 1280 | * |
1281 | - * @param array $subclasses The names of all mapped subclasses. |
|
1281 | + * @param string[] $subclasses The names of all mapped subclasses. |
|
1282 | 1282 | * |
1283 | 1283 | * @return void |
1284 | 1284 | */ |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping; |
7 | 7 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | public function __toString() |
312 | 312 | { |
313 | - return __CLASS__ . '@' . spl_object_hash($this); |
|
313 | + return __CLASS__.'@'.spl_object_hash($this); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | // Restore ReflectionClass and properties |
414 | 414 | $this->reflectionClass = $reflService->getClass($this->className); |
415 | 415 | |
416 | - if (! $this->reflectionClass) { |
|
416 | + if ( ! $this->reflectionClass) { |
|
417 | 417 | return; |
418 | 418 | } |
419 | 419 | |
@@ -492,11 +492,11 @@ discard block |
||
492 | 492 | } |
493 | 493 | |
494 | 494 | // Verify & complete identifier mapping |
495 | - if (! $this->identifier) { |
|
495 | + if ( ! $this->identifier) { |
|
496 | 496 | throw MappingException::identifierRequired($this->className); |
497 | 497 | } |
498 | 498 | |
499 | - $explicitlyGeneratedProperties = array_filter($this->declaredProperties, function (Property $property) : bool { |
|
499 | + $explicitlyGeneratedProperties = array_filter($this->declaredProperties, function(Property $property) : bool { |
|
500 | 500 | return $property instanceof FieldMetadata |
501 | 501 | && $property->isPrimaryKey() |
502 | 502 | && $property->hasValueGenerator(); |
@@ -517,14 +517,14 @@ discard block |
||
517 | 517 | public function validateAssociations() : void |
518 | 518 | { |
519 | 519 | array_map( |
520 | - function (Property $property) { |
|
521 | - if (! ($property instanceof AssociationMetadata)) { |
|
520 | + function(Property $property) { |
|
521 | + if ( ! ($property instanceof AssociationMetadata)) { |
|
522 | 522 | return; |
523 | 523 | } |
524 | 524 | |
525 | 525 | $targetEntity = $property->getTargetEntity(); |
526 | 526 | |
527 | - if (! class_exists($targetEntity)) { |
|
527 | + if ( ! class_exists($targetEntity)) { |
|
528 | 528 | throw MappingException::invalidTargetEntityClass($targetEntity, $this->className, $property->getName()); |
529 | 529 | } |
530 | 530 | }, |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | foreach ($this->lifecycleCallbacks as $callbacks) { |
547 | 547 | /** @var array $callbacks */ |
548 | 548 | foreach ($callbacks as $callbackFuncName) { |
549 | - if (! $reflService->hasPublicMethod($this->className, $callbackFuncName)) { |
|
549 | + if ( ! $reflService->hasPublicMethod($this->className, $callbackFuncName)) { |
|
550 | 550 | throw MappingException::lifecycleCallbackMethodNotFound($this->className, $callbackFuncName); |
551 | 551 | } |
552 | 552 | } |
@@ -574,11 +574,11 @@ discard block |
||
574 | 574 | */ |
575 | 575 | public function isIdentifier(string $fieldName) : bool |
576 | 576 | { |
577 | - if (! $this->identifier) { |
|
577 | + if ( ! $this->identifier) { |
|
578 | 578 | return false; |
579 | 579 | } |
580 | 580 | |
581 | - if (! $this->isIdentifierComposite()) { |
|
581 | + if ( ! $this->isIdentifierComposite()) { |
|
582 | 582 | return $fieldName === $this->identifier[0]; |
583 | 583 | } |
584 | 584 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | */ |
607 | 607 | public function getNamedQuery($queryName) : string |
608 | 608 | { |
609 | - if (! isset($this->namedQueries[$queryName])) { |
|
609 | + if ( ! isset($this->namedQueries[$queryName])) { |
|
610 | 610 | throw MappingException::queryNotFound($this->className, $queryName); |
611 | 611 | } |
612 | 612 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | */ |
667 | 667 | public function getSqlResultSetMapping($name) |
668 | 668 | { |
669 | - if (! isset($this->sqlResultSetMappings[$name])) { |
|
669 | + if ( ! isset($this->sqlResultSetMappings[$name])) { |
|
670 | 670 | throw MappingException::resultMappingNotFound($this->className, $name); |
671 | 671 | } |
672 | 672 | |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | $property->setColumnName($columnName); |
702 | 702 | } |
703 | 703 | |
704 | - if (! $this->isMappedSuperclass) { |
|
704 | + if ( ! $this->isMappedSuperclass) { |
|
705 | 705 | $property->setTableName($this->getTableName()); |
706 | 706 | } |
707 | 707 | |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | throw MappingException::sqlConversionNotAllowedForPrimaryKeyProperties($property); |
722 | 722 | }; |
723 | 723 | |
724 | - if (! in_array($fieldName, $this->identifier)) { |
|
724 | + if ( ! in_array($fieldName, $this->identifier)) { |
|
725 | 725 | $this->identifier[] = $fieldName; |
726 | 726 | } |
727 | 727 | } |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $fieldName = $property->getName(); |
776 | 776 | $targetEntity = $property->getTargetEntity(); |
777 | 777 | |
778 | - if (! $targetEntity) { |
|
778 | + if ( ! $targetEntity) { |
|
779 | 779 | throw MappingException::missingTargetEntity($fieldName); |
780 | 780 | } |
781 | 781 | |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | $this->identifier[] = $property->getName(); |
807 | 807 | } |
808 | 808 | |
809 | - if ($this->cache && !$property->getCache()) { |
|
809 | + if ($this->cache && ! $property->getCache()) { |
|
810 | 810 | throw CacheException::nonCacheableEntityAssociation($this->className, $fieldName); |
811 | 811 | } |
812 | 812 | |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | /** @var JoinColumnMetadata $joinColumn */ |
861 | 861 | if ($property instanceof OneToOneAssociationMetadata && $this->inheritanceType !== InheritanceType::SINGLE_TABLE) { |
862 | 862 | if (1 === count($property->getJoinColumns())) { |
863 | - if (! $property->isPrimaryKey()) { |
|
863 | + if ( ! $property->isPrimaryKey()) { |
|
864 | 864 | $joinColumn->setUnique(true); |
865 | 865 | } |
866 | 866 | } else { |
@@ -868,13 +868,13 @@ discard block |
||
868 | 868 | } |
869 | 869 | } |
870 | 870 | |
871 | - $joinColumn->setTableName(! $this->isMappedSuperclass ? $this->getTableName() : null); |
|
871 | + $joinColumn->setTableName( ! $this->isMappedSuperclass ? $this->getTableName() : null); |
|
872 | 872 | |
873 | - if (! $joinColumn->getColumnName()) { |
|
873 | + if ( ! $joinColumn->getColumnName()) { |
|
874 | 874 | $joinColumn->setColumnName($this->namingStrategy->joinColumnName($fieldName, $this->className)); |
875 | 875 | } |
876 | 876 | |
877 | - if (! $joinColumn->getReferencedColumnName()) { |
|
877 | + if ( ! $joinColumn->getReferencedColumnName()) { |
|
878 | 878 | $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName()); |
879 | 879 | } |
880 | 880 | |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | if ($property->isOrphanRemoval()) { |
903 | 903 | $cascades = $property->getCascade(); |
904 | 904 | |
905 | - if (! in_array('remove', $cascades)) { |
|
905 | + if ( ! in_array('remove', $cascades)) { |
|
906 | 906 | $cascades[] = 'remove'; |
907 | 907 | |
908 | 908 | $property->setCascade($cascades); |
@@ -970,14 +970,14 @@ discard block |
||
970 | 970 | $property->setOwningSide(false); |
971 | 971 | |
972 | 972 | // OneToMany MUST have mappedBy |
973 | - if (! $property->getMappedBy()) { |
|
973 | + if ( ! $property->getMappedBy()) { |
|
974 | 974 | throw MappingException::oneToManyRequiresMappedBy($property->getName()); |
975 | 975 | } |
976 | 976 | |
977 | 977 | if ($property->isOrphanRemoval()) { |
978 | 978 | $cascades = $property->getCascade(); |
979 | 979 | |
980 | - if (! in_array('remove', $cascades)) { |
|
980 | + if ( ! in_array('remove', $cascades)) { |
|
981 | 981 | $cascades[] = 'remove'; |
982 | 982 | |
983 | 983 | $property->setCascade($cascades); |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | |
1001 | 1001 | $property->setJoinTable($joinTable); |
1002 | 1002 | |
1003 | - if (! $joinTable->getName()) { |
|
1003 | + if ( ! $joinTable->getName()) { |
|
1004 | 1004 | $joinTableName = $this->namingStrategy->joinTableName( |
1005 | 1005 | $property->getSourceEntity(), |
1006 | 1006 | $property->getTargetEntity(), |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | |
1013 | 1013 | $selfReferencingEntityWithoutJoinColumns = $property->getSourceEntity() == $property->getTargetEntity() && ! $joinTable->hasColumns(); |
1014 | 1014 | |
1015 | - if (! $joinTable->getJoinColumns()) { |
|
1015 | + if ( ! $joinTable->getJoinColumns()) { |
|
1016 | 1016 | $referencedColumnName = $this->namingStrategy->referenceColumnName(); |
1017 | 1017 | $sourceReferenceName = $selfReferencingEntityWithoutJoinColumns ? 'source' : $referencedColumnName; |
1018 | 1018 | $columnName = $this->namingStrategy->joinKeyColumnName($property->getSourceEntity(), $sourceReferenceName); |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | $joinTable->addJoinColumn($joinColumn); |
1026 | 1026 | } |
1027 | 1027 | |
1028 | - if (! $joinTable->getInverseJoinColumns()) { |
|
1028 | + if ( ! $joinTable->getInverseJoinColumns()) { |
|
1029 | 1029 | $referencedColumnName = $this->namingStrategy->referenceColumnName(); |
1030 | 1030 | $targetReferenceName = $selfReferencingEntityWithoutJoinColumns ? 'target' : $referencedColumnName; |
1031 | 1031 | $columnName = $this->namingStrategy->joinKeyColumnName($property->getTargetEntity(), $targetReferenceName); |
@@ -1040,13 +1040,13 @@ discard block |
||
1040 | 1040 | |
1041 | 1041 | foreach ($joinTable->getJoinColumns() as $joinColumn) { |
1042 | 1042 | /** @var JoinColumnMetadata $joinColumn */ |
1043 | - if (! $joinColumn->getReferencedColumnName()) { |
|
1043 | + if ( ! $joinColumn->getReferencedColumnName()) { |
|
1044 | 1044 | $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName()); |
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
1048 | 1048 | |
1049 | - if (! $joinColumn->getColumnName()) { |
|
1049 | + if ( ! $joinColumn->getColumnName()) { |
|
1050 | 1050 | $columnName = $this->namingStrategy->joinKeyColumnName( |
1051 | 1051 | $property->getSourceEntity(), |
1052 | 1052 | $referencedColumnName |
@@ -1058,13 +1058,13 @@ discard block |
||
1058 | 1058 | |
1059 | 1059 | foreach ($joinTable->getInverseJoinColumns() as $inverseJoinColumn) { |
1060 | 1060 | /** @var JoinColumnMetadata $inverseJoinColumn */ |
1061 | - if (! $inverseJoinColumn->getReferencedColumnName()) { |
|
1061 | + if ( ! $inverseJoinColumn->getReferencedColumnName()) { |
|
1062 | 1062 | $inverseJoinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName()); |
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | $referencedColumnName = $inverseJoinColumn->getReferencedColumnName(); |
1066 | 1066 | |
1067 | - if (! $inverseJoinColumn->getColumnName()) { |
|
1067 | + if ( ! $inverseJoinColumn->getColumnName()) { |
|
1068 | 1068 | $columnName = $this->namingStrategy->joinKeyColumnName( |
1069 | 1069 | $property->getTargetEntity(), |
1070 | 1070 | $referencedColumnName |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | // Association defined as Id field |
1162 | 1162 | $targetClass = $em->getClassMetadata($property->getTargetEntity()); |
1163 | 1163 | |
1164 | - if (! $property->isOwningSide()) { |
|
1164 | + if ( ! $property->isOwningSide()) { |
|
1165 | 1165 | $property = $targetClass->getProperty($property->getMappedBy()); |
1166 | 1166 | $targetClass = $em->getClassMetadata($property->getTargetEntity()); |
1167 | 1167 | } |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | $columnName = $joinColumn->getColumnName(); |
1177 | 1177 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
1178 | 1178 | |
1179 | - if (! $joinColumn->getType()) { |
|
1179 | + if ( ! $joinColumn->getType()) { |
|
1180 | 1180 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $em)); |
1181 | 1181 | } |
1182 | 1182 | |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | * |
1193 | 1193 | * @return string|null |
1194 | 1194 | */ |
1195 | - public function getTableName() : ?string |
|
1195 | + public function getTableName() : ? string |
|
1196 | 1196 | { |
1197 | 1197 | return $this->table->getName(); |
1198 | 1198 | } |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | * |
1203 | 1203 | * @return string|null |
1204 | 1204 | */ |
1205 | - public function getSchemaName() : ?string |
|
1205 | + public function getSchemaName() : ? string |
|
1206 | 1206 | { |
1207 | 1207 | return $this->table->getSchema(); |
1208 | 1208 | } |
@@ -1216,11 +1216,11 @@ discard block |
||
1216 | 1216 | { |
1217 | 1217 | $schema = null === $this->getSchemaName() |
1218 | 1218 | ? '' |
1219 | - : $this->getSchemaName() . '_' |
|
1219 | + : $this->getSchemaName().'_' |
|
1220 | 1220 | ; |
1221 | 1221 | |
1222 | 1222 | // replace dots with underscores because PostgreSQL creates temporary tables in a special schema |
1223 | - return $schema . $this->getTableName() . '_id_tmp'; |
|
1223 | + return $schema.$this->getTableName().'_id_tmp'; |
|
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | /** |
@@ -1280,7 +1280,7 @@ discard block |
||
1280 | 1280 | { |
1281 | 1281 | $fieldName = $property->getName(); |
1282 | 1282 | |
1283 | - if (! isset($this->declaredProperties[$fieldName])) { |
|
1283 | + if ( ! isset($this->declaredProperties[$fieldName])) { |
|
1284 | 1284 | throw MappingException::invalidOverrideFieldName($this->className, $fieldName); |
1285 | 1285 | } |
1286 | 1286 | |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | * |
1401 | 1401 | * @return LocalColumnMetadata|null |
1402 | 1402 | */ |
1403 | - public function getColumn(string $columnName): ?LocalColumnMetadata |
|
1403 | + public function getColumn(string $columnName): ? LocalColumnMetadata |
|
1404 | 1404 | { |
1405 | 1405 | foreach ($this->declaredProperties as $property) { |
1406 | 1406 | if ($property instanceof LocalColumnMetadata && $property->getColumnName() === $columnName) { |
@@ -1486,7 +1486,7 @@ discard block |
||
1486 | 1486 | $declaringClass = $property->getDeclaringClass(); |
1487 | 1487 | |
1488 | 1488 | if ($inheritedProperty instanceof FieldMetadata) { |
1489 | - if (! $declaringClass->isMappedSuperclass) { |
|
1489 | + if ( ! $declaringClass->isMappedSuperclass) { |
|
1490 | 1490 | $inheritedProperty->setTableName($property->getTableName()); |
1491 | 1491 | } |
1492 | 1492 | |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | throw MappingException::duplicateQueryMapping($this->className, $name); |
1555 | 1555 | } |
1556 | 1556 | |
1557 | - if (! isset($queryMapping['resultClass']) && ! isset($queryMapping['resultSetMapping'])) { |
|
1557 | + if ( ! isset($queryMapping['resultClass']) && ! isset($queryMapping['resultSetMapping'])) { |
|
1558 | 1558 | throw MappingException::missingQueryMapping($this->className, $name); |
1559 | 1559 | } |
1560 | 1560 | |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | */ |
1578 | 1578 | public function addSqlResultSetMapping(array $resultMapping) |
1579 | 1579 | { |
1580 | - if (!isset($resultMapping['name'])) { |
|
1580 | + if ( ! isset($resultMapping['name'])) { |
|
1581 | 1581 | throw MappingException::nameIsMandatoryForSqlResultSetMapping($this->className); |
1582 | 1582 | } |
1583 | 1583 | |
@@ -1587,7 +1587,7 @@ discard block |
||
1587 | 1587 | |
1588 | 1588 | if (isset($resultMapping['entities'])) { |
1589 | 1589 | foreach ($resultMapping['entities'] as $key => $entityResult) { |
1590 | - if (! isset($entityResult['entityClass'])) { |
|
1590 | + if ( ! isset($entityResult['entityClass'])) { |
|
1591 | 1591 | throw MappingException::missingResultSetMappingEntity($this->className, $resultMapping['name']); |
1592 | 1592 | } |
1593 | 1593 | |
@@ -1600,11 +1600,11 @@ discard block |
||
1600 | 1600 | |
1601 | 1601 | if (isset($entityResult['fields'])) { |
1602 | 1602 | foreach ($entityResult['fields'] as $k => $field) { |
1603 | - if (! isset($field['name'])) { |
|
1603 | + if ( ! isset($field['name'])) { |
|
1604 | 1604 | throw MappingException::missingResultSetMappingFieldName($this->className, $resultMapping['name']); |
1605 | 1605 | } |
1606 | 1606 | |
1607 | - if (! isset($field['column'])) { |
|
1607 | + if ( ! isset($field['column'])) { |
|
1608 | 1608 | $fieldName = $field['name']; |
1609 | 1609 | |
1610 | 1610 | if (strpos($fieldName, '.')) { |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | * |
1629 | 1629 | * @return void |
1630 | 1630 | */ |
1631 | - public function setCustomRepositoryClassName(?string $repositoryClassName) |
|
1631 | + public function setCustomRepositoryClassName(? string $repositoryClassName) |
|
1632 | 1632 | { |
1633 | 1633 | $this->customRepositoryClassName = $repositoryClassName; |
1634 | 1634 | } |
@@ -1636,7 +1636,7 @@ discard block |
||
1636 | 1636 | /** |
1637 | 1637 | * @return string|null |
1638 | 1638 | */ |
1639 | - public function getCustomRepositoryClassName() : ?string |
|
1639 | + public function getCustomRepositoryClassName() : ? string |
|
1640 | 1640 | { |
1641 | 1641 | return $this->customRepositoryClassName; |
1642 | 1642 | } |
@@ -1713,11 +1713,11 @@ discard block |
||
1713 | 1713 | 'method' => $method, |
1714 | 1714 | ]; |
1715 | 1715 | |
1716 | - if (! class_exists($class)) { |
|
1716 | + if ( ! class_exists($class)) { |
|
1717 | 1717 | throw MappingException::entityListenerClassNotFound($class, $this->className); |
1718 | 1718 | } |
1719 | 1719 | |
1720 | - if (! method_exists($class, $method)) { |
|
1720 | + if ( ! method_exists($class, $method)) { |
|
1721 | 1721 | throw MappingException::entityListenerMethodNotFound($class, $method, $this->className); |
1722 | 1722 | } |
1723 | 1723 | |
@@ -1793,7 +1793,7 @@ discard block |
||
1793 | 1793 | return; |
1794 | 1794 | } |
1795 | 1795 | |
1796 | - if (! (class_exists($className) || interface_exists($className))) { |
|
1796 | + if ( ! (class_exists($className) || interface_exists($className))) { |
|
1797 | 1797 | throw MappingException::invalidClassInDiscriminatorMap($className, $this->className); |
1798 | 1798 | } |
1799 | 1799 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | /** |
56 | 56 | * Constructor. |
57 | 57 | * |
58 | - * @param array|string $paths |
|
58 | + * @param string $paths |
|
59 | 59 | */ |
60 | 60 | public function __construct($paths) |
61 | 61 | { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM\Mapping\Driver; |
6 | 6 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | return $this->classNames; |
79 | 79 | } |
80 | 80 | |
81 | - if (!$this->paths) { |
|
81 | + if ( ! $this->paths) { |
|
82 | 82 | throw Mapping\MappingException::pathRequired(); |
83 | 83 | } |
84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $includedFiles = []; |
87 | 87 | |
88 | 88 | foreach ($this->paths as $path) { |
89 | - if (!is_dir($path)) { |
|
89 | + if ( ! is_dir($path)) { |
|
90 | 90 | throw Mapping\MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
91 | 91 | } |
92 | 92 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach ($declared as $className) { |
112 | 112 | $rc = new \ReflectionClass($className); |
113 | 113 | $sourceFile = $rc->getFileName(); |
114 | - if (in_array($sourceFile, $includedFiles) && !$this->isTransient($className)) { |
|
114 | + if (in_array($sourceFile, $includedFiles) && ! $this->isTransient($className)) { |
|
115 | 115 | $classes[] = $className; |
116 | 116 | } |
117 | 117 | } |
@@ -207,7 +207,6 @@ |
||
207 | 207 | |
208 | 208 | /** |
209 | 209 | * @param ClassMetadata $targetClass |
210 | - * @param array $assoc |
|
211 | 210 | * @param mixed $actualValue |
212 | 211 | * |
213 | 212 | * @return self |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM; |
6 | 6 | use Doctrine\ORM\Mapping\AssociationMetadata; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | static public function scheduleInsertForManagedEntity($entity) |
23 | 23 | { |
24 | - return new self("A managed+dirty entity " . self::objToStr($entity) . " can not be scheduled for insertion."); |
|
24 | + return new self("A managed+dirty entity ".self::objToStr($entity)." can not be scheduled for insertion."); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | static public function scheduleInsertForRemovedEntity($entity) |
33 | 33 | { |
34 | - return new self("Removed entity " . self::objToStr($entity) . " can not be scheduled for insertion."); |
|
34 | + return new self("Removed entity ".self::objToStr($entity)." can not be scheduled for insertion."); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | static public function scheduleInsertTwice($entity) |
43 | 43 | { |
44 | - return new self("Entity " . self::objToStr($entity) . " can not be scheduled for insertion twice."); |
|
44 | + return new self("Entity ".self::objToStr($entity)." can not be scheduled for insertion twice."); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | static public function entityWithoutIdentity($className, $entity) |
54 | 54 | { |
55 | 55 | return new self( |
56 | - "The given entity of type '" . $className . "' (".self::objToStr($entity).") has no identity/no " . |
|
56 | + "The given entity of type '".$className."' (".self::objToStr($entity).") has no identity/no ". |
|
57 | 57 | "id values set. It cannot be added to the identity map." |
58 | 58 | ); |
59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | static public function readOnlyRequiresManagedEntity($entity) |
67 | 67 | { |
68 | - return new self("Only managed entities can be marked or checked as read only. But " . self::objToStr($entity) . " is not"); |
|
68 | + return new self("Only managed entities can be marked or checked as read only. But ".self::objToStr($entity)." is not"); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | static public function entityNotManaged($entity) |
123 | 123 | { |
124 | - return new self("Entity " . self::objToStr($entity) . " is not managed. An entity is managed if its fetched " . |
|
124 | + return new self("Entity ".self::objToStr($entity)." is not managed. An entity is managed if its fetched ". |
|
125 | 125 | "from the database or registered as new through EntityManager#persist"); |
126 | 126 | } |
127 | 127 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | static public function entityHasNoIdentity($entity, $operation) |
135 | 135 | { |
136 | - return new self("Entity has no identity, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); |
|
136 | + return new self("Entity has no identity, therefore ".$operation." cannot be performed. ".self::objToStr($entity)); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | static public function entityIsRemoved($entity, $operation) |
146 | 146 | { |
147 | - return new self("Entity is removed, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); |
|
147 | + return new self("Entity is removed, therefore ".$operation." cannot be performed. ".self::objToStr($entity)); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | static public function detachedEntityCannot($entity, $operation) |
157 | 157 | { |
158 | - return new self("Detached entity " . self::objToStr($entity) . " cannot be " . $operation); |
|
158 | + return new self("Detached entity ".self::objToStr($entity)." cannot be ".$operation); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public static function invalidObject($context, $given, $parameterIndex = 1) |
169 | 169 | { |
170 | - return new self($context . ' expects parameter ' . $parameterIndex . |
|
171 | - ' to be an entity object, '. gettype($given) . ' given.'); |
|
170 | + return new self($context.' expects parameter '.$parameterIndex. |
|
171 | + ' to be an entity object, '.gettype($given).' given.'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public static function invalidCompositeIdentifier() |
178 | 178 | { |
179 | - return new self("Binding an entity with a composite primary key to a query is not supported. " . |
|
179 | + return new self("Binding an entity with a composite primary key to a query is not supported. ". |
|
180 | 180 | "You should split the parameter into the explicit fields and bind them separately."); |
181 | 181 | } |
182 | 182 |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param string $field |
121 | 121 | * @param array $args |
122 | 122 | * |
123 | - * @return object |
|
123 | + * @return PersistentObject |
|
124 | 124 | * |
125 | 125 | * @throws \BadMethodCallException When no persistent field exists by that name. |
126 | 126 | * @throws \InvalidArgumentException When the wrong target object type is passed to an association. |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param string $field |
208 | 208 | * @param array $args |
209 | 209 | * |
210 | - * @return object |
|
210 | + * @return PersistentObject |
|
211 | 211 | * |
212 | 212 | * @throws \BadMethodCallException |
213 | 213 | * @throws \InvalidArgumentException |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM; |
6 | 6 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | if ($entityManager !== self::$entityManager) { |
91 | 91 | throw new \RuntimeException( |
92 | - "Trying to use PersistentObject with different EntityManager instances. " . |
|
92 | + "Trying to use PersistentObject with different EntityManager instances. ". |
|
93 | 93 | "Was PersistentObject::setEntityManager() called?" |
94 | 94 | ); |
95 | 95 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $property = $this->cm->getProperty($field); |
116 | 116 | |
117 | - if (! $property) { |
|
117 | + if ( ! $property) { |
|
118 | 118 | throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
119 | 119 | } |
120 | 120 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $property = $this->cm->getProperty($field); |
155 | 155 | |
156 | - if (! $property) { |
|
156 | + if ( ! $property) { |
|
157 | 157 | throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
158 | 158 | } |
159 | 159 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $mappedByField = $property->getMappedBy(); |
180 | 180 | $targetMetadata = self::$entityManager->getClassMetadata($property->getTargetEntity()); |
181 | 181 | $targetProperty = $targetMetadata->getProperty($mappedByField); |
182 | - $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set') . $mappedByField; |
|
182 | + $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set').$mappedByField; |
|
183 | 183 | |
184 | 184 | $targetObject->$setterMethodName($this); |
185 | 185 | } |
@@ -201,21 +201,21 @@ discard block |
||
201 | 201 | |
202 | 202 | $property = $this->cm->getProperty($field); |
203 | 203 | |
204 | - if (! $property) { |
|
204 | + if ( ! $property) { |
|
205 | 205 | throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
206 | 206 | } |
207 | 207 | |
208 | - if (! ($property instanceof ToManyAssociationMetadata)) { |
|
208 | + if ( ! ($property instanceof ToManyAssociationMetadata)) { |
|
209 | 209 | throw new \BadMethodCallException("There is no method add".$field."() on ".$this->cm->getClassName()); |
210 | 210 | } |
211 | 211 | |
212 | 212 | $targetClassName = $property->getTargetEntity(); |
213 | 213 | |
214 | - if (! ($args[0] instanceof $targetClassName)) { |
|
214 | + if ( ! ($args[0] instanceof $targetClassName)) { |
|
215 | 215 | throw new \InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
216 | 216 | } |
217 | 217 | |
218 | - if (! ($this->$field instanceof Collection)) { |
|
218 | + if ( ! ($this->$field instanceof Collection)) { |
|
219 | 219 | $this->$field = new ArrayCollection($this->$field ?: []); |
220 | 220 | } |
221 | 221 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | return; |
240 | 240 | } |
241 | 241 | |
242 | - if (!self::$entityManager) { |
|
242 | + if ( ! self::$entityManager) { |
|
243 | 243 | throw new \RuntimeException("No runtime entity manager set. Call PersistentObject#setEntityManager()."); |
244 | 244 | } |
245 | 245 |
@@ -22,7 +22,6 @@ |
||
22 | 22 | namespace Doctrine\ORM\Persisters\Collection; |
23 | 23 | |
24 | 24 | use Doctrine\Common\Collections\Criteria; |
25 | -use Doctrine\ORM\Mapping\ColumnMetadata; |
|
26 | 25 | use Doctrine\ORM\Mapping\InheritanceType; |
27 | 26 | use Doctrine\ORM\Mapping\ToManyAssociationMetadata; |
28 | 27 | use Doctrine\ORM\PersistentCollection; |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | return (bool) $persister->count($criteria); |
146 | 146 | } |
147 | 147 | |
148 | - /** |
|
149 | - * {@inheritdoc} |
|
150 | - */ |
|
148 | + /** |
|
149 | + * {@inheritdoc} |
|
150 | + */ |
|
151 | 151 | public function contains(PersistentCollection $collection, $element) |
152 | 152 | { |
153 | 153 | if ( ! $this->isValidEntityState($element)) { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | |
266 | 266 | // 2) Build insert table records into temporary table |
267 | 267 | $dql = ' SELECT t0.' . implode(', t0.', $rootClass->getIdentifierFieldNames()) |
268 | - . ' FROM ' . $targetClass->getClassName() . ' t0 WHERE t0.' . $association->getMappedBy() . ' = :owner'; |
|
268 | + . ' FROM ' . $targetClass->getClassName() . ' t0 WHERE t0.' . $association->getMappedBy() . ' = :owner'; |
|
269 | 269 | $query = $this->em->createQuery($dql)->setParameter('owner', $collection->getOwner()); |
270 | 270 | |
271 | 271 | $statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ') ' . $query->getSQL(); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM\Persisters\Collection; |
6 | 6 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | // the entire collection with a new would trigger this operation. |
31 | 31 | $association = $collection->getMapping(); |
32 | 32 | |
33 | - if (! $association->isOrphanRemoval()) { |
|
33 | + if ( ! $association->isOrphanRemoval()) { |
|
34 | 34 | // Handling non-orphan removal should never happen, as @OneToMany |
35 | 35 | // can only be inverse side. For owning side one to many, it is |
36 | 36 | // required to have a join table, which would classify as a ManyToManyPersister. |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $association = $collection->getMapping(); |
64 | 64 | |
65 | - if (! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
65 | + if ( ! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
66 | 66 | throw new \BadMethodCallException("Selecting a collection by index is only supported on indexed collections."); |
67 | 67 | } |
68 | 68 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $association = $collection->getMapping(); |
113 | 113 | |
114 | - if (! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
114 | + if ( ! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
115 | 115 | throw new \BadMethodCallException("Selecting a collection by index is only supported on indexed collections."); |
116 | 116 | } |
117 | 117 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | // only works with single id identifier entities. Will throw an |
121 | 121 | // exception in Entity Persisters if that is not the case for the |
122 | 122 | // 'mappedBy' field. |
123 | - $criteria = [ |
|
123 | + $criteria = [ |
|
124 | 124 | $association->getMappedBy() => $collection->getOwner(), |
125 | 125 | $association->getIndexedBy() => $key, |
126 | 126 | ]; |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | { |
158 | 158 | $association = $collection->getMapping(); |
159 | 159 | |
160 | - if (! $association->isOrphanRemoval()) { |
|
160 | + if ( ! $association->isOrphanRemoval()) { |
|
161 | 161 | // no-op: this is not the owning side, therefore no operations should be applied |
162 | 162 | return false; |
163 | 163 | } |
164 | 164 | |
165 | - if (! $this->isValidEntityState($element)) { |
|
165 | + if ( ! $this->isValidEntityState($element)) { |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | $tableName = $targetClass->table->getQuotedQualifiedName($this->platform); |
205 | - $statement = 'DELETE FROM ' . $tableName . ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?'; |
|
205 | + $statement = 'DELETE FROM '.$tableName.' WHERE '.implode(' = ? AND ', $columns).' = ?'; |
|
206 | 206 | |
207 | 207 | return $this->conn->executeUpdate($statement, $parameters); |
208 | 208 | } |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | ]; |
242 | 242 | } |
243 | 243 | |
244 | - $statement = $this->platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable |
|
245 | - . ' (' . $this->platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
244 | + $statement = $this->platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable |
|
245 | + . ' ('.$this->platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
246 | 246 | |
247 | 247 | $this->conn->executeUpdate($statement); |
248 | 248 | |
249 | 249 | // 2) Build insert table records into temporary table |
250 | - $dql = ' SELECT t0.' . implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
251 | - . ' FROM ' . $targetClass->getClassName() . ' t0 WHERE t0.' . $association->getMappedBy() . ' = :owner'; |
|
250 | + $dql = ' SELECT t0.'.implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
251 | + . ' FROM '.$targetClass->getClassName().' t0 WHERE t0.'.$association->getMappedBy().' = :owner'; |
|
252 | 252 | $query = $this->em->createQuery($dql)->setParameter('owner', $collection->getOwner()); |
253 | 253 | |
254 | - $statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnNameList . ') ' . $query->getSQL(); |
|
254 | + $statement = 'INSERT INTO '.$tempTable.' ('.$idColumnNameList.') '.$query->getSQL(); |
|
255 | 255 | $parameters = array_values($sourcePersister->getIdentifier($collection->getOwner())); |
256 | 256 | $numDeleted = $this->conn->executeUpdate($statement, $parameters); |
257 | 257 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | // 4) Delete records on each table in the hierarchy |
267 | 267 | $hierarchyClasses = array_merge( |
268 | 268 | array_map( |
269 | - function ($className) { return $this->em->getClassMetadata($className); }, |
|
269 | + function($className) { return $this->em->getClassMetadata($className); }, |
|
270 | 270 | array_reverse($targetClass->getSubClasses()) |
271 | 271 | ), |
272 | 272 | [$targetClass], |
@@ -1409,7 +1409,6 @@ |
||
1409 | 1409 | * Gets the SQL join fragment used when selecting entities from a |
1410 | 1410 | * many-to-many association. |
1411 | 1411 | * |
1412 | - * @param ManyToManyAssociationMetadata $manyToMany |
|
1413 | 1412 | * |
1414 | 1413 | * @return string |
1415 | 1414 | */ |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | |
324 | 324 | // FIXME: Order with composite keys might not be correct |
325 | 325 | $sql = 'SELECT ' . $columnName |
326 | - . ' FROM ' . $tableName |
|
327 | - . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
326 | + . ' FROM ' . $tableName |
|
327 | + . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
328 | 328 | |
329 | 329 | $flattenedId = $this->em->getIdentifierFlattener()->flattenIdentifier($versionedClass, $id); |
330 | 330 | $versionType = $versionProperty->getType(); |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | } |
458 | 458 | |
459 | 459 | $sql = 'UPDATE ' . $quotedTableName |
460 | - . ' SET ' . implode(', ', $set) |
|
461 | - . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
460 | + . ' SET ' . implode(', ', $set) |
|
461 | + . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
462 | 462 | |
463 | 463 | $result = $this->conn->executeUpdate($sql, $params, $types); |
464 | 464 | |
@@ -1626,9 +1626,9 @@ discard block |
||
1626 | 1626 | $lock = $this->getLockTablesSql($lockMode); |
1627 | 1627 | $where = ($conditionSql ? ' WHERE ' . $conditionSql : '') . ' '; |
1628 | 1628 | $sql = 'SELECT 1 ' |
1629 | - . $lock |
|
1630 | - . $where |
|
1631 | - . $lockSql; |
|
1629 | + . $lock |
|
1630 | + . $where |
|
1631 | + . $lockSql; |
|
1632 | 1632 | |
1633 | 1633 | list($params, $types) = $this->expandParameters($criteria); |
1634 | 1634 | |
@@ -2107,8 +2107,8 @@ discard block |
||
2107 | 2107 | $alias = $this->getSQLTableAlias($this->class->getTableName()); |
2108 | 2108 | |
2109 | 2109 | $sql = 'SELECT 1 ' |
2110 | - . $this->getLockTablesSql(null) |
|
2111 | - . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
2110 | + . $this->getLockTablesSql(null) |
|
2111 | + . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
2112 | 2112 | |
2113 | 2113 | list($params, $types) = $this->expandParameters($criteria); |
2114 | 2114 | |
@@ -2142,9 +2142,9 @@ discard block |
||
2142 | 2142 | |
2143 | 2143 | // if one of the join columns is nullable, return left join |
2144 | 2144 | foreach ($association->getJoinColumns() as $joinColumn) { |
2145 | - if (! $joinColumn->isNullable()) { |
|
2146 | - continue; |
|
2147 | - } |
|
2145 | + if (! $joinColumn->isNullable()) { |
|
2146 | + continue; |
|
2147 | + } |
|
2148 | 2148 | |
2149 | 2149 | return 'LEFT JOIN'; |
2150 | 2150 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM\Persisters\Entity; |
6 | 6 | |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | $tableName = $versionedClass->table->getQuotedQualifiedName($this->platform); |
301 | 301 | $columnName = $this->platform->quoteIdentifier($versionProperty->getColumnName()); |
302 | 302 | $identifier = array_map( |
303 | - function ($columnName) { return $this->platform->quoteIdentifier($columnName); }, |
|
303 | + function($columnName) { return $this->platform->quoteIdentifier($columnName); }, |
|
304 | 304 | array_keys($versionedClass->getIdentifierColumns($this->em)) |
305 | 305 | ); |
306 | 306 | |
307 | 307 | // FIXME: Order with composite keys might not be correct |
308 | - $sql = 'SELECT ' . $columnName |
|
309 | - . ' FROM ' . $tableName |
|
310 | - . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; |
|
308 | + $sql = 'SELECT '.$columnName |
|
309 | + . ' FROM '.$tableName |
|
310 | + . ' WHERE '.implode(' = ? AND ', $identifier).' = ?'; |
|
311 | 311 | |
312 | 312 | $flattenedId = $this->em->getIdentifierFlattener()->flattenIdentifier($versionedClass, $id); |
313 | 313 | $versionType = $versionProperty->getType(); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | if (($value = $identifier[$field]) !== null) { |
395 | 395 | // @todo guilhermeblanco Make sure we do not have flat association values. |
396 | - if (! is_array($value)) { |
|
396 | + if ( ! is_array($value)) { |
|
397 | 397 | $value = [$targetClass->identifier[0] => $value]; |
398 | 398 | } |
399 | 399 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
407 | 407 | $targetField = $targetClass->fieldNames[$referencedColumnName]; |
408 | 408 | |
409 | - if (! $joinColumn->getType()) { |
|
409 | + if ( ! $joinColumn->getType()) { |
|
410 | 410 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
411 | 411 | } |
412 | 412 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | $quotedColumnName = $this->platform->quoteIdentifier($joinColumn->getColumnName()); |
475 | 475 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
476 | 476 | |
477 | - if (! $joinColumn->getType()) { |
|
477 | + if ( ! $joinColumn->getType()) { |
|
478 | 478 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
479 | 479 | } |
480 | 480 | |
@@ -501,18 +501,18 @@ discard block |
||
501 | 501 | case Type::SMALLINT: |
502 | 502 | case Type::INTEGER: |
503 | 503 | case Type::BIGINT: |
504 | - $set[] = $versionColumnName . ' = ' . $versionColumnName . ' + 1'; |
|
504 | + $set[] = $versionColumnName.' = '.$versionColumnName.' + 1'; |
|
505 | 505 | break; |
506 | 506 | |
507 | 507 | case Type::DATETIME: |
508 | - $set[] = $versionColumnName . ' = CURRENT_TIMESTAMP'; |
|
508 | + $set[] = $versionColumnName.' = CURRENT_TIMESTAMP'; |
|
509 | 509 | break; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
513 | - $sql = 'UPDATE ' . $quotedTableName |
|
514 | - . ' SET ' . implode(', ', $set) |
|
515 | - . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; |
|
513 | + $sql = 'UPDATE '.$quotedTableName |
|
514 | + . ' SET '.implode(', ', $set) |
|
515 | + . ' WHERE '.implode(' = ? AND ', $where).' = ?'; |
|
516 | 516 | |
517 | 517 | $result = $this->conn->executeUpdate($sql, $params, $types); |
518 | 518 | |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | protected function deleteJoinTableRecords($identifier) |
532 | 532 | { |
533 | 533 | foreach ($this->class->getDeclaredPropertiesIterator() as $association) { |
534 | - if (! ($association instanceof ManyToManyAssociationMetadata)) { |
|
534 | + if ( ! ($association instanceof ManyToManyAssociationMetadata)) { |
|
535 | 535 | continue; |
536 | 536 | } |
537 | 537 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $keys = []; |
545 | 545 | |
546 | 546 | if ( ! $owningAssociation->isOwningSide()) { |
547 | - $class = $this->em->getClassMetadata($association->getTargetEntity()); |
|
547 | + $class = $this->em->getClassMetadata($association->getTargetEntity()); |
|
548 | 548 | $owningAssociation = $class->getProperty($association->getMappedBy()); |
549 | 549 | } |
550 | 550 | |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | } |
657 | 657 | |
658 | 658 | // Only owning side of x-1 associations can have a FK column. |
659 | - if (! $property instanceof ToOneAssociationMetadata || ! $property->isOwningSide()) { |
|
659 | + if ( ! $property instanceof ToOneAssociationMetadata || ! $property->isOwningSide()) { |
|
660 | 660 | continue; |
661 | 661 | } |
662 | 662 | |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | /** @var JoinColumnMetadata $joinColumn */ |
677 | 677 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
678 | 678 | |
679 | - if (! $joinColumn->getType()) { |
|
679 | + if ( ! $joinColumn->getType()) { |
|
680 | 680 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
681 | 681 | } |
682 | 682 | |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $propertyName = $this->class->fieldNames[$columnName]; |
706 | 706 | $property = $this->class->getProperty($propertyName); |
707 | 707 | |
708 | - if (! $property) { |
|
708 | + if ( ! $property) { |
|
709 | 709 | return null; |
710 | 710 | } |
711 | 711 | |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | /** @var JoinColumnMetadata $joinColumn */ |
725 | 725 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
726 | 726 | |
727 | - if (! $joinColumn->getType()) { |
|
727 | + if ( ! $joinColumn->getType()) { |
|
728 | 728 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
729 | 729 | } |
730 | 730 | |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | // unset the old value and set the new sql aliased value here. By definition |
842 | 842 | // unset($identifier[$targetKeyColumn] works here with how UnitOfWork::createEntity() calls this method. |
843 | 843 | // @todo guilhermeblanco In master we have: $identifier[$targetClass->getFieldForColumn($targetKeyColumn)] = |
844 | - $identifier[$targetTableAlias . "." . $targetKeyColumn] = $value; |
|
844 | + $identifier[$targetTableAlias.".".$targetKeyColumn] = $value; |
|
845 | 845 | |
846 | 846 | unset($identifier[$targetKeyColumn]); |
847 | 847 | } |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | $criteria = []; |
1062 | 1062 | $parameters = []; |
1063 | 1063 | |
1064 | - if (! $association->isOwningSide()) { |
|
1064 | + if ( ! $association->isOwningSide()) { |
|
1065 | 1065 | $class = $this->em->getClassMetadata($association->getTargetEntity()); |
1066 | 1066 | $owningAssoc = $class->getProperty($association->getMappedBy()); |
1067 | 1067 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | $value = $value[$targetClass->identifier[0]]; |
1090 | 1090 | } |
1091 | 1091 | |
1092 | - $criteria[$joinTableName . '.' . $quotedColumnName] = $value; |
|
1092 | + $criteria[$joinTableName.'.'.$quotedColumnName] = $value; |
|
1093 | 1093 | $parameters[] = [ |
1094 | 1094 | 'value' => $value, |
1095 | 1095 | 'field' => $fieldName, |
@@ -1140,11 +1140,11 @@ discard block |
||
1140 | 1140 | |
1141 | 1141 | switch ($lockMode) { |
1142 | 1142 | case LockMode::PESSIMISTIC_READ: |
1143 | - $lockSql = ' ' . $this->platform->getReadLockSQL(); |
|
1143 | + $lockSql = ' '.$this->platform->getReadLockSQL(); |
|
1144 | 1144 | break; |
1145 | 1145 | |
1146 | 1146 | case LockMode::PESSIMISTIC_WRITE: |
1147 | - $lockSql = ' ' . $this->platform->getWriteLockSQL(); |
|
1147 | + $lockSql = ' '.$this->platform->getWriteLockSQL(); |
|
1148 | 1148 | break; |
1149 | 1149 | } |
1150 | 1150 | |
@@ -1155,14 +1155,14 @@ discard block |
||
1155 | 1155 | |
1156 | 1156 | if ('' !== $filterSql) { |
1157 | 1157 | $conditionSql = $conditionSql |
1158 | - ? $conditionSql . ' AND ' . $filterSql |
|
1158 | + ? $conditionSql.' AND '.$filterSql |
|
1159 | 1159 | : $filterSql; |
1160 | 1160 | } |
1161 | 1161 | |
1162 | - $select = 'SELECT ' . $columnList; |
|
1163 | - $from = ' FROM ' . $tableName . ' '. $tableAlias; |
|
1164 | - $join = $this->currentPersisterContext->selectJoinSql . $joinSql; |
|
1165 | - $where = ($conditionSql ? ' WHERE ' . $conditionSql : ''); |
|
1162 | + $select = 'SELECT '.$columnList; |
|
1163 | + $from = ' FROM '.$tableName.' '.$tableAlias; |
|
1164 | + $join = $this->currentPersisterContext->selectJoinSql.$joinSql; |
|
1165 | + $where = ($conditionSql ? ' WHERE '.$conditionSql : ''); |
|
1166 | 1166 | $lock = $this->platform->appendLockHint($from, $lockMode); |
1167 | 1167 | $query = $select |
1168 | 1168 | . $lock |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | . $where |
1171 | 1171 | . $orderBySql; |
1172 | 1172 | |
1173 | - return $this->platform->modifyLimitQuery($query, $limit, $offset) . $lockSql; |
|
1173 | + return $this->platform->modifyLimitQuery($query, $limit, $offset).$lockSql; |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | /** |
@@ -1189,13 +1189,13 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | if ('' !== $filterSql) { |
1191 | 1191 | $conditionSql = $conditionSql |
1192 | - ? $conditionSql . ' AND ' . $filterSql |
|
1192 | + ? $conditionSql.' AND '.$filterSql |
|
1193 | 1193 | : $filterSql; |
1194 | 1194 | } |
1195 | 1195 | |
1196 | 1196 | $sql = 'SELECT COUNT(*) ' |
1197 | - . 'FROM ' . $tableName . ' ' . $tableAlias |
|
1198 | - . (empty($conditionSql) ? '' : ' WHERE ' . $conditionSql); |
|
1197 | + . 'FROM '.$tableName.' '.$tableAlias |
|
1198 | + . (empty($conditionSql) ? '' : ' WHERE '.$conditionSql); |
|
1199 | 1199 | |
1200 | 1200 | return $sql; |
1201 | 1201 | } |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | */ |
1213 | 1213 | protected final function getOrderBySQL(array $orderBy, $baseTableAlias) |
1214 | 1214 | { |
1215 | - if (! $orderBy) { |
|
1215 | + if ( ! $orderBy) { |
|
1216 | 1216 | return ''; |
1217 | 1217 | } |
1218 | 1218 | |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | foreach ($orderBy as $fieldName => $orientation) { |
1222 | 1222 | $orientation = strtoupper(trim($orientation)); |
1223 | 1223 | |
1224 | - if (! in_array($orientation, ['ASC', 'DESC'])) { |
|
1224 | + if ( ! in_array($orientation, ['ASC', 'DESC'])) { |
|
1225 | 1225 | throw ORMException::invalidOrientation($this->class->getClassName(), $fieldName); |
1226 | 1226 | } |
1227 | 1227 | |
@@ -1231,11 +1231,11 @@ discard block |
||
1231 | 1231 | $tableAlias = $this->getSQLTableAlias($property->getTableName()); |
1232 | 1232 | $columnName = $this->platform->quoteIdentifier($property->getColumnName()); |
1233 | 1233 | |
1234 | - $orderByList[] = $tableAlias . '.' . $columnName . ' ' . $orientation; |
|
1234 | + $orderByList[] = $tableAlias.'.'.$columnName.' '.$orientation; |
|
1235 | 1235 | |
1236 | 1236 | continue; |
1237 | 1237 | } else if ($property instanceof AssociationMetadata) { |
1238 | - if (! $property->isOwningSide()) { |
|
1238 | + if ( ! $property->isOwningSide()) { |
|
1239 | 1239 | throw ORMException::invalidFindByInverseAssociation($this->class->getClassName(), $fieldName); |
1240 | 1240 | } |
1241 | 1241 | |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | /* @var JoinColumnMetadata $joinColumn */ |
1249 | 1249 | $quotedColumnName = $this->platform->quoteIdentifier($joinColumn->getColumnName()); |
1250 | 1250 | |
1251 | - $orderByList[] = $tableAlias . '.' . $quotedColumnName . ' ' . $orientation; |
|
1251 | + $orderByList[] = $tableAlias.'.'.$quotedColumnName.' '.$orientation; |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | continue; |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | throw ORMException::unrecognizedField($fieldName); |
1258 | 1258 | } |
1259 | 1259 | |
1260 | - return ' ORDER BY ' . implode(', ', $orderByList); |
|
1260 | + return ' ORDER BY '.implode(', ', $orderByList); |
|
1261 | 1261 | } |
1262 | 1262 | |
1263 | 1263 | /** |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | |
1280 | 1280 | |
1281 | 1281 | $this->currentPersisterContext->rsm->addEntityResult($this->class->getClassName(), 'r'); // r for root |
1282 | - $this->currentPersisterContext->selectJoinSql = ''; |
|
1282 | + $this->currentPersisterContext->selectJoinSql = ''; |
|
1283 | 1283 | |
1284 | 1284 | $eagerAliasCounter = 0; |
1285 | 1285 | $columnList = []; |
@@ -1315,7 +1315,7 @@ discard block |
||
1315 | 1315 | break; // now this is why you shouldn't use inheritance |
1316 | 1316 | } |
1317 | 1317 | |
1318 | - $assocAlias = 'e' . ($eagerAliasCounter++); |
|
1318 | + $assocAlias = 'e'.($eagerAliasCounter++); |
|
1319 | 1319 | |
1320 | 1320 | $this->currentPersisterContext->rsm->addJoinedEntityResult($targetEntity, $assocAlias, 'r', $fieldName); |
1321 | 1321 | |
@@ -1340,14 +1340,14 @@ discard block |
||
1340 | 1340 | $this->currentPersisterContext->rsm->addIndexBy($assocAlias, $property->getIndexedBy()); |
1341 | 1341 | } |
1342 | 1342 | |
1343 | - if (! $property->isOwningSide()) { |
|
1343 | + if ( ! $property->isOwningSide()) { |
|
1344 | 1344 | $owningAssociation = $eagerEntity->getProperty($property->getMappedBy()); |
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | $joinTableAlias = $this->getSQLTableAlias($eagerEntity->getTableName(), $assocAlias); |
1348 | 1348 | $joinTableName = $eagerEntity->table->getQuotedQualifiedName($this->platform); |
1349 | 1349 | |
1350 | - $this->currentPersisterContext->selectJoinSql .= ' ' . $this->getJoinSQLForAssociation($property); |
|
1350 | + $this->currentPersisterContext->selectJoinSql .= ' '.$this->getJoinSQLForAssociation($property); |
|
1351 | 1351 | |
1352 | 1352 | $sourceClass = $this->em->getClassMetadata($owningAssociation->getSourceEntity()); |
1353 | 1353 | $targetClass = $this->em->getClassMetadata($owningAssociation->getTargetEntity()); |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | $joinCondition[] = $filterSql; |
1370 | 1370 | } |
1371 | 1371 | |
1372 | - $this->currentPersisterContext->selectJoinSql .= ' ' . $joinTableName . ' ' . $joinTableAlias . ' ON '; |
|
1372 | + $this->currentPersisterContext->selectJoinSql .= ' '.$joinTableName.' '.$joinTableAlias.' ON '; |
|
1373 | 1373 | $this->currentPersisterContext->selectJoinSql .= implode(' AND ', $joinCondition); |
1374 | 1374 | |
1375 | 1375 | break; |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | */ |
1394 | 1394 | protected function getSelectColumnAssociationSQL($field, AssociationMetadata $association, ClassMetadata $class, $alias = 'r') |
1395 | 1395 | { |
1396 | - if (! ($association->isOwningSide() && $association instanceof ToOneAssociationMetadata)) { |
|
1396 | + if ( ! ($association->isOwningSide() && $association instanceof ToOneAssociationMetadata)) { |
|
1397 | 1397 | return ''; |
1398 | 1398 | } |
1399 | 1399 | |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
1409 | 1409 | $resultColumnName = $this->getSQLColumnAlias(); |
1410 | 1410 | |
1411 | - if (! $joinColumn->getType()) { |
|
1411 | + if ( ! $joinColumn->getType()) { |
|
1412 | 1412 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
1413 | 1413 | } |
1414 | 1414 | |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | $owningAssociation = $association; |
1441 | 1441 | $sourceTableAlias = $this->getSQLTableAlias($this->class->getTableName()); |
1442 | 1442 | |
1443 | - if (! $association->isOwningSide()) { |
|
1443 | + if ( ! $association->isOwningSide()) { |
|
1444 | 1444 | $targetEntity = $this->em->getClassMetadata($association->getTargetEntity()); |
1445 | 1445 | $owningAssociation = $targetEntity->getProperty($association->getMappedBy()); |
1446 | 1446 | } |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | ); |
1463 | 1463 | } |
1464 | 1464 | |
1465 | - return ' INNER JOIN ' . $joinTableName . ' ON ' . implode(' AND ', $conditions); |
|
1465 | + return ' INNER JOIN '.$joinTableName.' ON '.implode(' AND ', $conditions); |
|
1466 | 1466 | } |
1467 | 1467 | |
1468 | 1468 | /** |
@@ -1557,7 +1557,7 @@ discard block |
||
1557 | 1557 | $columnName = $joinColumn->getColumnName(); |
1558 | 1558 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
1559 | 1559 | |
1560 | - if (! $joinColumn->getType()) { |
|
1560 | + if ( ! $joinColumn->getType()) { |
|
1561 | 1561 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
1562 | 1562 | } |
1563 | 1563 | |
@@ -1596,7 +1596,7 @@ discard block |
||
1596 | 1596 | |
1597 | 1597 | $this->currentPersisterContext->rsm->addFieldResult($alias, $columnAlias, $field, $class->getClassName()); |
1598 | 1598 | |
1599 | - return $property->getType()->convertToPHPValueSQL($sql, $this->platform) . ' AS ' . $columnAlias; |
|
1599 | + return $property->getType()->convertToPHPValueSQL($sql, $this->platform).' AS '.$columnAlias; |
|
1600 | 1600 | } |
1601 | 1601 | |
1602 | 1602 | /** |
@@ -1610,14 +1610,14 @@ discard block |
||
1610 | 1610 | protected function getSQLTableAlias($tableName, $assocName = '') |
1611 | 1611 | { |
1612 | 1612 | if ($tableName) { |
1613 | - $tableName .= '#' . $assocName; |
|
1613 | + $tableName .= '#'.$assocName; |
|
1614 | 1614 | } |
1615 | 1615 | |
1616 | 1616 | if (isset($this->currentPersisterContext->sqlTableAliases[$tableName])) { |
1617 | 1617 | return $this->currentPersisterContext->sqlTableAliases[$tableName]; |
1618 | 1618 | } |
1619 | 1619 | |
1620 | - $tableAlias = 't' . $this->currentPersisterContext->sqlAliasCounter++; |
|
1620 | + $tableAlias = 't'.$this->currentPersisterContext->sqlAliasCounter++; |
|
1621 | 1621 | |
1622 | 1622 | $this->currentPersisterContext->sqlTableAliases[$tableName] = $tableAlias; |
1623 | 1623 | |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | } |
1645 | 1645 | |
1646 | 1646 | $lock = $this->getLockTablesSql($lockMode); |
1647 | - $where = ($conditionSql ? ' WHERE ' . $conditionSql : '') . ' '; |
|
1647 | + $where = ($conditionSql ? ' WHERE '.$conditionSql : '').' '; |
|
1648 | 1648 | $sql = 'SELECT 1 ' |
1649 | 1649 | . $lock |
1650 | 1650 | . $where |
@@ -1667,7 +1667,7 @@ discard block |
||
1667 | 1667 | $tableName = $this->class->table->getQuotedQualifiedName($this->platform); |
1668 | 1668 | |
1669 | 1669 | return $this->platform->appendLockHint( |
1670 | - 'FROM ' . $tableName . ' ' . $this->getSQLTableAlias($this->class->getTableName()), |
|
1670 | + 'FROM '.$tableName.' '.$this->getSQLTableAlias($this->class->getTableName()), |
|
1671 | 1671 | $lockMode |
1672 | 1672 | ); |
1673 | 1673 | } |
@@ -1720,19 +1720,19 @@ discard block |
||
1720 | 1720 | |
1721 | 1721 | if (null !== $comparison) { |
1722 | 1722 | // special case null value handling |
1723 | - if (($comparison === Comparison::EQ || $comparison === Comparison::IS) && null ===$value) { |
|
1724 | - $selectedColumns[] = $column . ' IS NULL'; |
|
1723 | + if (($comparison === Comparison::EQ || $comparison === Comparison::IS) && null === $value) { |
|
1724 | + $selectedColumns[] = $column.' IS NULL'; |
|
1725 | 1725 | |
1726 | 1726 | continue; |
1727 | 1727 | } |
1728 | 1728 | |
1729 | 1729 | if ($comparison === Comparison::NEQ && null === $value) { |
1730 | - $selectedColumns[] = $column . ' IS NOT NULL'; |
|
1730 | + $selectedColumns[] = $column.' IS NOT NULL'; |
|
1731 | 1731 | |
1732 | 1732 | continue; |
1733 | 1733 | } |
1734 | 1734 | |
1735 | - $selectedColumns[] = $column . ' ' . sprintf(self::$comparisonMap[$comparison], $placeholder); |
|
1735 | + $selectedColumns[] = $column.' '.sprintf(self::$comparisonMap[$comparison], $placeholder); |
|
1736 | 1736 | |
1737 | 1737 | continue; |
1738 | 1738 | } |
@@ -1781,7 +1781,7 @@ discard block |
||
1781 | 1781 | $tableAlias = $this->getSQLTableAlias($property->getTableName()); |
1782 | 1782 | $columnName = $this->platform->quoteIdentifier($property->getColumnName()); |
1783 | 1783 | |
1784 | - return [$tableAlias . '.' . $columnName]; |
|
1784 | + return [$tableAlias.'.'.$columnName]; |
|
1785 | 1785 | } |
1786 | 1786 | |
1787 | 1787 | if ($property instanceof AssociationMetadata) { |
@@ -1790,7 +1790,7 @@ discard block |
||
1790 | 1790 | |
1791 | 1791 | // Many-To-Many requires join table check for joinColumn |
1792 | 1792 | if ($owningAssociation instanceof ManyToManyAssociationMetadata) { |
1793 | - if (! $owningAssociation->isOwningSide()) { |
|
1793 | + if ( ! $owningAssociation->isOwningSide()) { |
|
1794 | 1794 | $owningAssociation = $association; |
1795 | 1795 | } |
1796 | 1796 | |
@@ -1804,15 +1804,15 @@ discard block |
||
1804 | 1804 | foreach ($joinColumns as $joinColumn) { |
1805 | 1805 | $quotedColumnName = $this->platform->quoteIdentifier($joinColumn->getColumnName()); |
1806 | 1806 | |
1807 | - $columns[] = $joinTableName . '.' . $quotedColumnName; |
|
1807 | + $columns[] = $joinTableName.'.'.$quotedColumnName; |
|
1808 | 1808 | } |
1809 | 1809 | |
1810 | 1810 | } else { |
1811 | - if (! $owningAssociation->isOwningSide()) { |
|
1811 | + if ( ! $owningAssociation->isOwningSide()) { |
|
1812 | 1812 | throw ORMException::invalidFindByInverseAssociation($this->class->getClassName(), $field); |
1813 | 1813 | } |
1814 | 1814 | |
1815 | - $class = $this->class->isInheritedProperty($field) |
|
1815 | + $class = $this->class->isInheritedProperty($field) |
|
1816 | 1816 | ? $owningAssociation->getDeclaringClass() |
1817 | 1817 | : $this->class |
1818 | 1818 | ; |
@@ -1821,7 +1821,7 @@ discard block |
||
1821 | 1821 | foreach ($owningAssociation->getJoinColumns() as $joinColumn) { |
1822 | 1822 | $quotedColumnName = $this->platform->quoteIdentifier($joinColumn->getColumnName()); |
1823 | 1823 | |
1824 | - $columns[] = $tableAlias . '.' . $quotedColumnName; |
|
1824 | + $columns[] = $tableAlias.'.'.$quotedColumnName; |
|
1825 | 1825 | } |
1826 | 1826 | } |
1827 | 1827 | |
@@ -1934,7 +1934,7 @@ discard block |
||
1934 | 1934 | $value = $value[$targetClass->identifier[0]]; |
1935 | 1935 | } |
1936 | 1936 | |
1937 | - $criteria[$tableAlias . "." . $quotedColumnName] = $value; |
|
1937 | + $criteria[$tableAlias.".".$quotedColumnName] = $value; |
|
1938 | 1938 | $parameters[] = [ |
1939 | 1939 | 'value' => $value, |
1940 | 1940 | 'field' => $fieldName, |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | case ($property instanceof AssociationMetadata): |
2022 | 2022 | $class = $this->em->getClassMetadata($property->getTargetEntity()); |
2023 | 2023 | |
2024 | - if (! $property->isOwningSide()) { |
|
2024 | + if ( ! $property->isOwningSide()) { |
|
2025 | 2025 | $property = $class->getProperty($property->getMappedBy()); |
2026 | 2026 | $class = $this->em->getClassMetadata($property->getTargetEntity()); |
2027 | 2027 | } |
@@ -2035,7 +2035,7 @@ discard block |
||
2035 | 2035 | /** @var JoinColumnMetadata $joinColumn */ |
2036 | 2036 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
2037 | 2037 | |
2038 | - if (! $joinColumn->getType()) { |
|
2038 | + if ( ! $joinColumn->getType()) { |
|
2039 | 2039 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $class, $this->em)); |
2040 | 2040 | } |
2041 | 2041 | |
@@ -2050,7 +2050,7 @@ discard block |
||
2050 | 2050 | } |
2051 | 2051 | |
2052 | 2052 | if (is_array($value)) { |
2053 | - return array_map(function ($type) { |
|
2053 | + return array_map(function($type) { |
|
2054 | 2054 | return $type->getBindingType() + Connection::ARRAY_PARAM_OFFSET; |
2055 | 2055 | }, $types); |
2056 | 2056 | } |
@@ -2129,12 +2129,12 @@ discard block |
||
2129 | 2129 | |
2130 | 2130 | $sql = 'SELECT 1 ' |
2131 | 2131 | . $this->getLockTablesSql(null) |
2132 | - . ' WHERE ' . $this->getSelectConditionSQL($criteria); |
|
2132 | + . ' WHERE '.$this->getSelectConditionSQL($criteria); |
|
2133 | 2133 | |
2134 | 2134 | list($params, $types) = $this->expandParameters($criteria); |
2135 | 2135 | |
2136 | 2136 | if (null !== $extraConditions) { |
2137 | - $sql .= ' AND ' . $this->getSelectConditionCriteriaSQL($extraConditions); |
|
2137 | + $sql .= ' AND '.$this->getSelectConditionCriteriaSQL($extraConditions); |
|
2138 | 2138 | list($criteriaParams, $criteriaTypes) = $this->expandCriteriaParameters($extraConditions); |
2139 | 2139 | |
2140 | 2140 | $params = array_merge($params, $criteriaParams); |
@@ -2142,7 +2142,7 @@ discard block |
||
2142 | 2142 | } |
2143 | 2143 | |
2144 | 2144 | if ($filterSql = $this->generateFilterConditionSQL($this->class, $alias)) { |
2145 | - $sql .= ' AND ' . $filterSql; |
|
2145 | + $sql .= ' AND '.$filterSql; |
|
2146 | 2146 | } |
2147 | 2147 | |
2148 | 2148 | return (bool) $this->conn->fetchColumn($sql, $params, 0, $types); |
@@ -2157,13 +2157,13 @@ discard block |
||
2157 | 2157 | */ |
2158 | 2158 | protected function getJoinSQLForAssociation(AssociationMetadata $association) |
2159 | 2159 | { |
2160 | - if (! $association->isOwningSide()) { |
|
2160 | + if ( ! $association->isOwningSide()) { |
|
2161 | 2161 | return 'LEFT JOIN'; |
2162 | 2162 | } |
2163 | 2163 | |
2164 | 2164 | // if one of the join columns is nullable, return left join |
2165 | 2165 | foreach ($association->getJoinColumns() as $joinColumn) { |
2166 | - if (! $joinColumn->isNullable()) { |
|
2166 | + if ( ! $joinColumn->isNullable()) { |
|
2167 | 2167 | continue; |
2168 | 2168 | } |
2169 | 2169 | |
@@ -2180,7 +2180,7 @@ discard block |
||
2180 | 2180 | */ |
2181 | 2181 | public function getSQLColumnAlias() |
2182 | 2182 | { |
2183 | - return $this->platform->getSQLResultCasing('c' . $this->currentPersisterContext->sqlAliasCounter++); |
|
2183 | + return $this->platform->getSQLResultCasing('c'.$this->currentPersisterContext->sqlAliasCounter++); |
|
2184 | 2184 | } |
2185 | 2185 | |
2186 | 2186 | /** |
@@ -2197,13 +2197,13 @@ discard block |
||
2197 | 2197 | |
2198 | 2198 | foreach ($this->em->getFilters()->getEnabledFilters() as $filter) { |
2199 | 2199 | if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) { |
2200 | - $filterClauses[] = '(' . $filterExpr . ')'; |
|
2200 | + $filterClauses[] = '('.$filterExpr.')'; |
|
2201 | 2201 | } |
2202 | 2202 | } |
2203 | 2203 | |
2204 | 2204 | $sql = implode(' AND ', $filterClauses); |
2205 | 2205 | |
2206 | - return $sql ? "(" . $sql . ")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" |
|
2206 | + return $sql ? "(".$sql.")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL" |
|
2207 | 2207 | } |
2208 | 2208 | |
2209 | 2209 | /** |