@@ -213,8 +213,8 @@ |
||
| 213 | 213 | $this->metadataCache = []; |
| 214 | 214 | |
| 215 | 215 | $this->em |
| 216 | - ->getEventManager() |
|
| 217 | - ->removeEventListener([Events::onClear], $this); |
|
| 216 | + ->getEventManager() |
|
| 217 | + ->removeEventListener([Events::onClear], $this); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $row = $this->stmt->fetch(FetchMode::ASSOCIATIVE); |
| 152 | 152 | |
| 153 | - if (! $row) { |
|
| 153 | + if ( ! $row) { |
|
| 154 | 154 | $this->cleanup(); |
| 155 | 155 | |
| 156 | 156 | return false; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | : $value; |
| 293 | 293 | |
| 294 | 294 | if ($cacheKeyInfo['isIdentifier'] && $value !== null) { |
| 295 | - $id[$dqlAlias] .= '|' . $value; |
|
| 295 | + $id[$dqlAlias] .= '|'.$value; |
|
| 296 | 296 | $nonemptyComponents[$dqlAlias] = true; |
| 297 | 297 | } |
| 298 | 298 | break; |
@@ -328,10 +328,10 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | // WARNING: BC break! We know this is the desired behavior to type convert values, but this |
| 330 | 330 | // erroneous behavior exists since 2.0 and we're forced to keep compatibility. |
| 331 | - if (! isset($cacheKeyInfo['isScalar'])) { |
|
| 331 | + if ( ! isset($cacheKeyInfo['isScalar'])) { |
|
| 332 | 332 | $dqlAlias = $cacheKeyInfo['dqlAlias']; |
| 333 | 333 | $type = $cacheKeyInfo['type']; |
| 334 | - $fieldName = $dqlAlias . '_' . $fieldName; |
|
| 334 | + $fieldName = $dqlAlias.'_'.$fieldName; |
|
| 335 | 335 | $value = $type |
| 336 | 336 | ? $type->convertToPHPValue($value, $this->platform) |
| 337 | 337 | : $value; |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | private function getDiscriminatorValues(ClassMetadata $classMetadata) : array |
| 436 | 436 | { |
| 437 | 437 | $values = array_map( |
| 438 | - function (string $subClass) : string { |
|
| 438 | + function(string $subClass) : string { |
|
| 439 | 439 | return (string) $this->getClassMetadata($subClass)->discriminatorValue; |
| 440 | 440 | }, |
| 441 | 441 | $classMetadata->getSubClasses() |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | protected function getClassMetadata($className) |
| 457 | 457 | { |
| 458 | - if (! isset($this->metadataCache[$className])) { |
|
| 458 | + if ( ! isset($this->metadataCache[$className])) { |
|
| 459 | 459 | $this->metadataCache[$className] = $this->em->getClassMetadata($className); |
| 460 | 460 | } |
| 461 | 461 | |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | $em = $this->createMock(EntityManagerInterface::class); |
| 61 | 61 | |
| 62 | 62 | $mappingDriver->method('getAllClassNames') |
| 63 | - ->willReturn([]); |
|
| 63 | + ->willReturn([]); |
|
| 64 | 64 | |
| 65 | 65 | $configuration->method('getMetadataDriverImpl') |
| 66 | - ->willReturn($mappingDriver); |
|
| 66 | + ->willReturn($mappingDriver); |
|
| 67 | 67 | |
| 68 | 68 | $em->method('getConfiguration') |
| 69 | - ->willReturn($configuration); |
|
| 69 | + ->willReturn($configuration); |
|
| 70 | 70 | |
| 71 | 71 | $application = new Application(); |
| 72 | 72 | $application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($em)])); |
@@ -95,17 +95,17 @@ discard block |
||
| 95 | 95 | $em = $this->createMock(EntityManagerInterface::class); |
| 96 | 96 | |
| 97 | 97 | $mappingDriver->method('getAllClassNames') |
| 98 | - ->willReturn(['InvalidEntity']); |
|
| 98 | + ->willReturn(['InvalidEntity']); |
|
| 99 | 99 | |
| 100 | 100 | $configuration->method('getMetadataDriverImpl') |
| 101 | - ->willReturn($mappingDriver); |
|
| 101 | + ->willReturn($mappingDriver); |
|
| 102 | 102 | |
| 103 | 103 | $em->method('getConfiguration') |
| 104 | - ->willReturn($configuration); |
|
| 104 | + ->willReturn($configuration); |
|
| 105 | 105 | |
| 106 | 106 | $em->method('getClassMetadata') |
| 107 | - ->with('InvalidEntity') |
|
| 108 | - ->willThrowException(new MappingException('exception message')); |
|
| 107 | + ->with('InvalidEntity') |
|
| 108 | + ->willThrowException(new MappingException('exception message')); |
|
| 109 | 109 | |
| 110 | 110 | $application = new Application(); |
| 111 | 111 | $application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($em)])); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $this->tester->execute( |
| 63 | 63 | [ |
| 64 | 64 | 'command' => $this->command->getName(), |
| 65 | - 'dql' => 'SELECT e FROM ' . DateTimeModel::class . ' e', |
|
| 65 | + 'dql' => 'SELECT e FROM '.DateTimeModel::class.' e', |
|
| 66 | 66 | ] |
| 67 | 67 | ) |
| 68 | 68 | ); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->tester->execute( |
| 81 | 81 | [ |
| 82 | 82 | 'command' => $this->command->getName(), |
| 83 | - 'dql' => 'SELECT e FROM ' . DateTimeModel::class . ' e', |
|
| 83 | + 'dql' => 'SELECT e FROM '.DateTimeModel::class.' e', |
|
| 84 | 84 | '--show-sql' => 'true', |
| 85 | 85 | ] |
| 86 | 86 | ) |
@@ -45,10 +45,10 @@ |
||
| 45 | 45 | protected function configure() |
| 46 | 46 | { |
| 47 | 47 | $this->setName('orm:validate-schema') |
| 48 | - ->setDescription('Validate the mapping files') |
|
| 49 | - ->addOption('skip-mapping', null, InputOption::VALUE_NONE, 'Skip the mapping validation check') |
|
| 50 | - ->addOption('skip-sync', null, InputOption::VALUE_NONE, 'Skip checking if the mapping is in sync with the database') |
|
| 51 | - ->setHelp('Validate that the mapping files are correct and in sync with the database.'); |
|
| 48 | + ->setDescription('Validate the mapping files') |
|
| 49 | + ->addOption('skip-mapping', null, InputOption::VALUE_NONE, 'Skip the mapping validation check') |
|
| 50 | + ->addOption('skip-sync', null, InputOption::VALUE_NONE, 'Skip checking if the mapping is in sync with the database') |
|
| 51 | + ->setHelp('Validate that the mapping files are correct and in sync with the database.'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $ui->text('<comment>[SKIPPED] The mapping was not checked.</comment>'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if (! $skipMapping) { |
|
| 49 | + if ( ! $skipMapping) { |
|
| 50 | 50 | $errors = $validator->validateMapping(); |
| 51 | 51 | |
| 52 | 52 | if ($errors) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | if ($input->getOption('skip-sync')) { |
| 74 | 74 | $ui->text('<comment>[SKIPPED] The database was not checked for synchronicity.</comment>'); |
| 75 | - } elseif (! $validator->schemaInSyncWithMetadata()) { |
|
| 75 | + } elseif ( ! $validator->schemaInSyncWithMetadata()) { |
|
| 76 | 76 | $ui->error('The database schema is not in sync with the current mapping file.'); |
| 77 | 77 | $exit += 2; |
| 78 | 78 | } else { |
@@ -45,9 +45,9 @@ |
||
| 45 | 45 | protected function configure() |
| 46 | 46 | { |
| 47 | 47 | $this->setName('orm:ensure-production-settings') |
| 48 | - ->setDescription('Verify that Doctrine is properly configured for a production environment') |
|
| 49 | - ->addOption('complete', null, InputOption::VALUE_NONE, 'Flag to also inspect database connection existence.') |
|
| 50 | - ->setHelp('Verify that Doctrine is properly configured for a production environment.'); |
|
| 48 | + ->setDescription('Verify that Doctrine is properly configured for a production environment') |
|
| 49 | + ->addOption('complete', null, InputOption::VALUE_NONE, 'Flag to also inspect database connection existence.') |
|
| 50 | + ->setHelp('Verify that Doctrine is properly configured for a production environment.'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -46,11 +46,11 @@ |
||
| 46 | 46 | protected function configure() |
| 47 | 47 | { |
| 48 | 48 | $this->setName('orm:generate-proxies') |
| 49 | - ->setAliases(['orm:generate:proxies']) |
|
| 50 | - ->setDescription('Generates proxy classes for entity classes') |
|
| 51 | - ->addArgument('dest-path', InputArgument::OPTIONAL, 'The path to generate your proxy classes. If none is provided, it will attempt to grab from configuration.') |
|
| 52 | - ->addOption('filter', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'A string pattern used to match entities that should be processed.') |
|
| 53 | - ->setHelp('Generates proxy classes for entity classes.'); |
|
| 49 | + ->setAliases(['orm:generate:proxies']) |
|
| 50 | + ->setDescription('Generates proxy classes for entity classes') |
|
| 51 | + ->addArgument('dest-path', InputArgument::OPTIONAL, 'The path to generate your proxy classes. If none is provided, it will attempt to grab from configuration.') |
|
| 52 | + ->addOption('filter', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'A string pattern used to match entities that should be processed.') |
|
| 53 | + ->setHelp('Generates proxy classes for entity classes.'); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -57,19 +57,19 @@ |
||
| 57 | 57 | $destPath = $em->getConfiguration()->getProxyDir(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if (! is_dir($destPath)) { |
|
| 60 | + if ( ! is_dir($destPath)) { |
|
| 61 | 61 | mkdir($destPath, 0775, true); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $destPath = realpath($destPath); |
| 65 | 65 | |
| 66 | - if (! file_exists($destPath)) { |
|
| 66 | + if ( ! file_exists($destPath)) { |
|
| 67 | 67 | throw new InvalidArgumentException( |
| 68 | 68 | sprintf("Proxies destination directory '<info>%s</info>' does not exist.", $em->getConfiguration()->getProxyDir()) |
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if (! is_writable($destPath)) { |
|
| 72 | + if ( ! is_writable($destPath)) { |
|
| 73 | 73 | throw new InvalidArgumentException( |
| 74 | 74 | sprintf("Proxies destination directory '<info>%s</info>' does not have write permissions.", $destPath) |
| 75 | 75 | ); |
@@ -268,8 +268,8 @@ |
||
| 268 | 268 | $this->em->clear(); |
| 269 | 269 | |
| 270 | 270 | $newUser = $this->em->createQuery('SELECT u, g FROM Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.groups g WHERE u.id = ?1') |
| 271 | - ->setParameter(1, $user->getId()) |
|
| 272 | - ->getSingleResult(); |
|
| 271 | + ->setParameter(1, $user->getId()) |
|
| 272 | + ->getSingleResult(); |
|
| 273 | 273 | self::assertCount(0, $newUser->groups); |
| 274 | 274 | self::assertInstanceOf(ManyToManyAssociationMetadata::class, $newUser->groups->getMapping()); |
| 275 | 275 | |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | $user->username = 'gblanco'; |
| 295 | 295 | $user->status = 'developer'; |
| 296 | 296 | |
| 297 | - for ($i=0; $i < $groupCount; ++$i) { |
|
| 297 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 298 | 298 | $group = new CmsGroup(); |
| 299 | - $group->name = 'Developers_' . $i; |
|
| 299 | + $group->name = 'Developers_'.$i; |
|
| 300 | 300 | $user->addGroup($group); |
| 301 | 301 | } |
| 302 | 302 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $user |
| 429 | 429 | ->getGroups() |
| 430 | 430 | ->matching($criteria) |
| 431 | - ->map(static function (CmsGroup $group) { |
|
| 431 | + ->map(static function(CmsGroup $group) { |
|
| 432 | 432 | return $group->getName(); |
| 433 | 433 | }) |
| 434 | 434 | ->toArray() |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $user |
| 473 | 473 | ->getTags() |
| 474 | 474 | ->matching($criteria) |
| 475 | - ->map(static function (CmsTag $tag) { |
|
| 475 | + ->map(static function(CmsTag $tag) { |
|
| 476 | 476 | return $tag->getName(); |
| 477 | 477 | }) |
| 478 | 478 | ->toArray() |
@@ -54,8 +54,8 @@ |
||
| 54 | 54 | $user1 = $this->em->getReference(DDC1400User::class, $user1->id); |
| 55 | 55 | |
| 56 | 56 | $this->em->createQuery('SELECT a, s FROM ' . DDC1400Article::class . ' a JOIN a.userStates s WITH s.user = :activeUser') |
| 57 | - ->setParameter('activeUser', $user1) |
|
| 58 | - ->getResult(); |
|
| 57 | + ->setParameter('activeUser', $user1) |
|
| 58 | + ->getResult(); |
|
| 59 | 59 | |
| 60 | 60 | $queryCount = $this->getCurrentQueryCount(); |
| 61 | 61 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | |
| 55 | 55 | $user1 = $this->em->getReference(DDC1400User::class, $user1->id); |
| 56 | 56 | |
| 57 | - $this->em->createQuery('SELECT a, s FROM ' . DDC1400Article::class . ' a JOIN a.userStates s WITH s.user = :activeUser') |
|
| 57 | + $this->em->createQuery('SELECT a, s FROM '.DDC1400Article::class.' a JOIN a.userStates s WITH s.user = :activeUser') |
|
| 58 | 58 | ->setParameter('activeUser', $user1) |
| 59 | 59 | ->getResult(); |
| 60 | 60 | |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | protected function configure() |
| 29 | 29 | { |
| 30 | 30 | $this->setName('orm:schema-tool:drop') |
| 31 | - ->setDescription('Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output') |
|
| 32 | - ->addOption('dump-sql', null, InputOption::VALUE_NONE, 'Instead of trying to apply generated SQLs into EntityManager Storage Connection, output them.') |
|
| 33 | - ->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for the deletion of the database, but force the operation to run.") |
|
| 34 | - ->addOption('full-database', null, InputOption::VALUE_NONE, 'Instead of using the Class Metadata to detect the database table schema, drop ALL assets that the database contains.') |
|
| 35 | - ->setHelp(<<<'EOT' |
|
| 31 | + ->setDescription('Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output') |
|
| 32 | + ->addOption('dump-sql', null, InputOption::VALUE_NONE, 'Instead of trying to apply generated SQLs into EntityManager Storage Connection, output them.') |
|
| 33 | + ->addOption('force', 'f', InputOption::VALUE_NONE, "Don't ask for the deletion of the database, but force the operation to run.") |
|
| 34 | + ->addOption('full-database', null, InputOption::VALUE_NONE, 'Instead of using the Class Metadata to detect the database table schema, drop ALL assets that the database contains.') |
|
| 35 | + ->setHelp(<<<'EOT' |
|
| 36 | 36 | Processes the schema and either drop the database schema of EntityManager Storage Connection or generate the SQL output. |
| 37 | 37 | Beware that the complete database is dropped by this command, even tables that are not relevant to your metadata model. |
| 38 | 38 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $config->setFilterSchemaAssetsExpression($regexp); |
| 44 | 44 | EOT |
| 45 | - ); |
|
| 45 | + ); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |