@@ -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 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $this->identifierFlattener = new IdentifierFlattener($this->unitOfWork, $this->metadatas); |
| 150 | 150 | |
| 151 | 151 | if ($config->isSecondLevelCacheEnabled()) { |
| 152 | - $cacheConfig = $config->getSecondLevelCacheConfiguration(); |
|
| 152 | + $cacheConfig = $config->getSecondLevelCacheConfiguration(); |
|
| 153 | 153 | //$cacheFactory = $cacheConfig->getCacheFactory(); |
| 154 | 154 | //$this->cache = $cacheFactory->createCache($this); |
| 155 | 155 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | { |
| 267 | 267 | $query = new Query($this); |
| 268 | 268 | |
| 269 | - if (! empty($dql)) { |
|
| 269 | + if ( ! empty($dql)) { |
|
| 270 | 270 | $query->setDQL($dql); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $class = $this->metadatas->get(ltrim($entityName, '\\')); |
| 357 | 357 | $className = $class->getClassName(); |
| 358 | 358 | |
| 359 | - if (! is_array($id)) { |
|
| 359 | + if ( ! is_array($id)) { |
|
| 360 | 360 | if ($class->isIdentifierComposite()) { |
| 361 | 361 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
| 362 | 362 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | foreach ($id as $i => $value) { |
| 368 | 368 | if (is_object($value)) { |
| 369 | - try{ |
|
| 369 | + try { |
|
| 370 | 370 | $this->metadatas->get(StaticClassNameConverter::getClass($value)); |
| 371 | 371 | $id[$i] = $this->unitOfWork->getSingleIdentifierValue($value); |
| 372 | 372 | } catch (\Exception $e) { |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | $sortedId = []; |
| 383 | 383 | |
| 384 | 384 | foreach ($class->identifier as $identifier) { |
| 385 | - if (! isset($id[$identifier])) { |
|
| 385 | + if ( ! isset($id[$identifier])) { |
|
| 386 | 386 | throw ORMException::missingIdentifierField($className, $identifier); |
| 387 | 387 | } |
| 388 | 388 | |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | // Check identity map first |
| 400 | 400 | $entity = $unitOfWork->tryGetById($sortedId, $class->getRootClassName()); |
| 401 | 401 | if ($entity !== false) { |
| 402 | - if (! ($entity instanceof $className)) { |
|
| 402 | + if ( ! ($entity instanceof $className)) { |
|
| 403 | 403 | return null; |
| 404 | 404 | } |
| 405 | 405 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | switch (true) { |
| 425 | 425 | case $lockMode === LockMode::OPTIMISTIC: |
| 426 | - if (! $class->isVersioned()) { |
|
| 426 | + if ( ! $class->isVersioned()) { |
|
| 427 | 427 | throw OptimisticLockException::notVersioned($className); |
| 428 | 428 | } |
| 429 | 429 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | case $lockMode === LockMode::PESSIMISTIC_READ: |
| 437 | 437 | case $lockMode === LockMode::PESSIMISTIC_WRITE: |
| 438 | - if (! $this->getConnection()->isTransactionActive()) { |
|
| 438 | + if ( ! $this->getConnection()->isTransactionActive()) { |
|
| 439 | 439 | throw TransactionRequiredException::transactionRequired(); |
| 440 | 440 | } |
| 441 | 441 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $class = $this->metadatas->get(ltrim($entityName, '\\')); |
| 455 | 455 | $className = $class->getClassName(); |
| 456 | 456 | |
| 457 | - if (! is_array($id)) { |
|
| 457 | + if ( ! is_array($id)) { |
|
| 458 | 458 | if ($class->isIdentifierComposite()) { |
| 459 | 459 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
| 460 | 460 | } |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $scalarId[$i] = $value; |
| 469 | 469 | |
| 470 | 470 | if (is_object($value)) { |
| 471 | - try{ |
|
| 471 | + try { |
|
| 472 | 472 | $this->metadatas->get(StaticClassNameConverter::getClass($value)); |
| 473 | 473 | $scalarId[$i] = $this->unitOfWork->getSingleIdentifierValue($value); |
| 474 | 474 | } catch (\Exception $e) { |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $sortedId = []; |
| 485 | 485 | |
| 486 | 486 | foreach ($class->identifier as $identifier) { |
| 487 | - if (! isset($scalarId[$identifier])) { |
|
| 487 | + if ( ! isset($scalarId[$identifier])) { |
|
| 488 | 488 | throw ORMException::missingIdentifierField($className, $identifier); |
| 489 | 489 | } |
| 490 | 490 | |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | $class = $this->metadatas->get(ltrim($entityName, '\\')); |
| 526 | 526 | $className = $class->getClassName(); |
| 527 | 527 | |
| 528 | - if (! is_array($id)) { |
|
| 528 | + if ( ! is_array($id)) { |
|
| 529 | 529 | if ($class->isIdentifierComposite()) { |
| 530 | 530 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
| 531 | 531 | } |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | foreach ($id as $i => $value) { |
| 537 | 537 | if (is_object($value)) { |
| 538 | - try{ |
|
| 538 | + try { |
|
| 539 | 539 | $this->metadatas->get(StaticClassNameConverter::getClass($value)); |
| 540 | 540 | $id[$i] = $this->unitOfWork->getSingleIdentifierValue($value); |
| 541 | 541 | } catch (\Exception $e) { |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | $sortedId = []; |
| 552 | 552 | |
| 553 | 553 | foreach ($class->identifier as $identifier) { |
| 554 | - if (! isset($id[$identifier])) { |
|
| 554 | + if ( ! isset($id[$identifier])) { |
|
| 555 | 555 | throw ORMException::missingIdentifierField($className, $identifier); |
| 556 | 556 | } |
| 557 | 557 | |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | public function persist($entity) |
| 626 | 626 | { |
| 627 | - if (! is_object($entity)) { |
|
| 627 | + if ( ! is_object($entity)) { |
|
| 628 | 628 | throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()', $entity); |
| 629 | 629 | } |
| 630 | 630 | |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | */ |
| 647 | 647 | public function remove($entity) |
| 648 | 648 | { |
| 649 | - if (! is_object($entity)) { |
|
| 649 | + if ( ! is_object($entity)) { |
|
| 650 | 650 | throw ORMInvalidArgumentException::invalidObject('EntityManager#remove()', $entity); |
| 651 | 651 | } |
| 652 | 652 | |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | */ |
| 667 | 667 | public function refresh($entity) |
| 668 | 668 | { |
| 669 | - if (! is_object($entity)) { |
|
| 669 | + if ( ! is_object($entity)) { |
|
| 670 | 670 | throw ORMInvalidArgumentException::invalidObject('EntityManager#refresh()', $entity); |
| 671 | 671 | } |
| 672 | 672 | |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | */ |
| 822 | 822 | public static function create($connection, Configuration $config, ?EventManager $eventManager = null) |
| 823 | 823 | { |
| 824 | - if (! $config->getMetadataDriverImpl()) { |
|
| 824 | + if ( ! $config->getMetadataDriverImpl()) { |
|
| 825 | 825 | throw ORMException::missingMappingDriverImpl(); |
| 826 | 826 | } |
| 827 | 827 | |
@@ -864,12 +864,12 @@ discard block |
||
| 864 | 864 | return DriverManager::getConnection($connection, $config, $eventManager ?: new EventManager()); |
| 865 | 865 | } |
| 866 | 866 | |
| 867 | - if (! $connection instanceof Connection) { |
|
| 867 | + if ( ! $connection instanceof Connection) { |
|
| 868 | 868 | throw new \InvalidArgumentException( |
| 869 | 869 | sprintf( |
| 870 | 870 | 'Invalid $connection argument of type %s given%s.', |
| 871 | 871 | is_object($connection) ? get_class($connection) : gettype($connection), |
| 872 | - is_object($connection) ? '' : ': "' . $connection . '"' |
|
| 872 | + is_object($connection) ? '' : ': "'.$connection.'"' |
|
| 873 | 873 | ) |
| 874 | 874 | ); |
| 875 | 875 | } |
@@ -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; |
| 6 | 6 | |
@@ -15,23 +15,23 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | private function __construct(array $classMetadatas) |
| 17 | 17 | { |
| 18 | - $metadataByClassName = array_reduce ( |
|
| 18 | + $metadataByClassName = array_reduce( |
|
| 19 | 19 | $classMetadatas, |
| 20 | - function ( $carry, ClassMetadata $classMetadata ) |
|
| 20 | + function($carry, ClassMetadata $classMetadata) |
|
| 21 | 21 | { |
| 22 | 22 | $className = $classMetadata->getClassName(); |
| 23 | 23 | $carry[$className] = $classMetadata; |
| 24 | 24 | return $carry; |
| 25 | 25 | } , |
| 26 | 26 | [] |
| 27 | - ) ; |
|
| 27 | + ); |
|
| 28 | 28 | $this->classMetadatas = $metadataByClassName; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function get($name) |
| 32 | 32 | { |
| 33 | - if(!isset($this->classMetadatas[$name])){ |
|
| 34 | - throw new \Exception('No metadata found for ' . $name); |
|
| 33 | + if ( ! isset($this->classMetadatas[$name])) { |
|
| 34 | + throw new \Exception('No metadata found for '.$name); |
|
| 35 | 35 | } |
| 36 | 36 | return $this->classMetadatas[$name]; |
| 37 | 37 | } |
@@ -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; |
| 6 | 6 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $this->configuration = $configuration; |
| 63 | 63 | $this->connection = $connection; |
| 64 | 64 | $this->eventManager = $eventManager; |
| 65 | - $this->driver = $this->configuration->getMetadataDriverImpl(); |
|
| 65 | + $this->driver = $this->configuration->getMetadataDriverImpl(); |
|
| 66 | 66 | $this->initialize = true; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | string $className, |
| 91 | 91 | ClassMetadataBuildingContext $metadataBuildingContext |
| 92 | 92 | ) : ?ClassMetadata { |
| 93 | - if (! $this->eventManager->hasListeners(Events::onClassMetadataNotFound)) { |
|
| 93 | + if ( ! $this->eventManager->hasListeners(Events::onClassMetadataNotFound)) { |
|
| 94 | 94 | return null; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | $classMetadata->setCache(clone $parent->getCache()); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if (! empty($parent->entityListeners) && empty($classMetadata->entityListeners)) { |
|
| 154 | + if ( ! empty($parent->entityListeners) && empty($classMetadata->entityListeners)) { |
|
| 155 | 155 | $classMetadata->entityListeners = $parent->entityListeners; |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if (! $classMetadata->discriminatorMap && $classMetadata->inheritanceType !== InheritanceType::NONE && $classMetadata->isRootEntity()) { |
|
| 159 | + if ( ! $classMetadata->discriminatorMap && $classMetadata->inheritanceType !== InheritanceType::NONE && $classMetadata->isRootEntity()) { |
|
| 160 | 160 | $this->addDefaultDiscriminatorMap($classMetadata); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | protected function completeRuntimeMetadata(ClassMetadata $class, ?ClassMetadata $parent = null) : void |
| 178 | 178 | { |
| 179 | - if (! $parent || ! $parent->isMappedSuperclass) { |
|
| 179 | + if ( ! $parent || ! $parent->isMappedSuperclass) { |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | continue; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - if (! ($property instanceof ToOneAssociationMetadata)) { |
|
| 197 | + if ( ! ($property instanceof ToOneAssociationMetadata)) { |
|
| 198 | 198 | continue; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | protected function validateRuntimeMetadata(ClassMetadata $class, ?ClassMetadata $parent = null) : void |
| 215 | 215 | { |
| 216 | - if (! $class->getReflectionClass()) { |
|
| 216 | + if ( ! $class->getReflectionClass()) { |
|
| 217 | 217 | // only validate if there is a reflection class instance |
| 218 | 218 | return; |
| 219 | 219 | } |
@@ -223,13 +223,13 @@ discard block |
||
| 223 | 223 | $class->validateLifecycleCallbacks($this->getReflectionService()); |
| 224 | 224 | |
| 225 | 225 | // verify inheritance |
| 226 | - if (! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) { |
|
| 227 | - if (! $parent) { |
|
| 228 | - if (! $class->discriminatorMap) { |
|
| 226 | + if ( ! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) { |
|
| 227 | + if ( ! $parent) { |
|
| 228 | + if ( ! $class->discriminatorMap) { |
|
| 229 | 229 | throw MappingException::missingDiscriminatorMap($class->getClassName()); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - if (! $class->discriminatorColumn) { |
|
| 232 | + if ( ! $class->discriminatorColumn) { |
|
| 233 | 233 | throw MappingException::missingDiscriminatorColumn($class->getClassName()); |
| 234 | 234 | } |
| 235 | 235 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | private function completeIdentifierGeneratorMappings(ClassMetadata $class) : void |
| 351 | 351 | { |
| 352 | 352 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
| 353 | - if (! $property instanceof FieldMetadata /*&& ! $property instanceof AssocationMetadata*/) { |
|
| 353 | + if ( ! $property instanceof FieldMetadata /*&& ! $property instanceof AssocationMetadata*/) { |
|
| 354 | 354 | continue; |
| 355 | 355 | } |
| 356 | 356 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | private function completeFieldIdentifierGeneratorMapping(FieldMetadata $field) |
| 362 | 362 | { |
| 363 | - if (! $field->hasValueGenerator()) { |
|
| 363 | + if ( ! $field->hasValueGenerator()) { |
|
| 364 | 364 | return; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -412,10 +412,10 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | case GeneratorType::CUSTOM: |
| 414 | 414 | $definition = $generator->getDefinition(); |
| 415 | - if (! isset($definition['class'])) { |
|
| 415 | + if ( ! isset($definition['class'])) { |
|
| 416 | 416 | throw new ORMException(sprintf('Cannot instantiate custom generator, no class has been defined')); |
| 417 | 417 | } |
| 418 | - if (! class_exists($definition['class'])) { |
|
| 418 | + if ( ! class_exists($definition['class'])) { |
|
| 419 | 419 | throw new ORMException(sprintf('Cannot instantiate custom generator : %s', var_export($definition, true))); //$definition['class'])); |
| 420 | 420 | } |
| 421 | 421 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | break; |
| 428 | 428 | |
| 429 | 429 | default: |
| 430 | - throw new ORMException('Unknown generator type: ' . $generator->getType()); |
|
| 430 | + throw new ORMException('Unknown generator type: '.$generator->getType()); |
|
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | private function getTargetPlatform() : Platforms\AbstractPlatform |
| 451 | 451 | { |
| 452 | - if (! $this->targetPlatform) { |
|
| 452 | + if ( ! $this->targetPlatform) { |
|
| 453 | 453 | $this->targetPlatform = $this->connection->getDatabasePlatform(); |
| 454 | 454 | } |
| 455 | 455 | |