@@ -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 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | ->expects(self::once()) |
| 169 | 169 | ->method('loadCollection') |
| 170 | 170 | ->with($this->collection) |
| 171 | - ->willReturnCallback(function (PersistentCollection $persistentCollection) use ($persistedElement) : void { |
|
| 171 | + ->willReturnCallback(function(PersistentCollection $persistentCollection) use ($persistedElement) : void { |
|
| 172 | 172 | $persistentCollection->unwrap()->add($persistedElement); |
| 173 | 173 | }); |
| 174 | 174 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | ->expects(self::once()) |
| 206 | 206 | ->method('loadCollection') |
| 207 | 207 | ->with($this->collection) |
| 208 | - ->willReturnCallback(function (PersistentCollection $persistentCollection) use ( |
|
| 208 | + ->willReturnCallback(function(PersistentCollection $persistentCollection) use ( |
|
| 209 | 209 | $persistedElement, |
| 210 | 210 | $newElementThatIsAlsoPersisted |
| 211 | 211 | ) : void { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | ->expects(self::once()) |
| 248 | 248 | ->method('loadCollection') |
| 249 | 249 | ->with($this->collection) |
| 250 | - ->willReturnCallback(function (PersistentCollection $persistentCollection) use ( |
|
| 250 | + ->willReturnCallback(function(PersistentCollection $persistentCollection) use ( |
|
| 251 | 251 | $persistedElement, |
| 252 | 252 | $newElementThatIsAlsoPersisted |
| 253 | 253 | ) : void { |
@@ -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,14 +45,14 @@ |
||
| 45 | 45 | protected function configure() |
| 46 | 46 | { |
| 47 | 47 | $this->setName('orm:run-dql') |
| 48 | - ->setDescription('Executes arbitrary DQL directly from the command line') |
|
| 49 | - ->addArgument('dql', InputArgument::REQUIRED, 'The DQL to execute.') |
|
| 50 | - ->addOption('hydrate', null, InputOption::VALUE_REQUIRED, 'Hydration mode of result set. Should be either: object, array, scalar or single-scalar.', 'object') |
|
| 51 | - ->addOption('first-result', null, InputOption::VALUE_REQUIRED, 'The first result in the result set.') |
|
| 52 | - ->addOption('max-result', null, InputOption::VALUE_REQUIRED, 'The maximum number of results in the result set.') |
|
| 53 | - ->addOption('depth', null, InputOption::VALUE_REQUIRED, 'Dumping depth of Entity graph.', 7) |
|
| 54 | - ->addOption('show-sql', null, InputOption::VALUE_NONE, 'Dump generated SQL instead of executing query') |
|
| 55 | - ->setHelp('Executes arbitrary DQL directly from the command line.'); |
|
| 48 | + ->setDescription('Executes arbitrary DQL directly from the command line') |
|
| 49 | + ->addArgument('dql', InputArgument::REQUIRED, 'The DQL to execute.') |
|
| 50 | + ->addOption('hydrate', null, InputOption::VALUE_REQUIRED, 'Hydration mode of result set. Should be either: object, array, scalar or single-scalar.', 'object') |
|
| 51 | + ->addOption('first-result', null, InputOption::VALUE_REQUIRED, 'The first result in the result set.') |
|
| 52 | + ->addOption('max-result', null, InputOption::VALUE_REQUIRED, 'The maximum number of results in the result set.') |
|
| 53 | + ->addOption('depth', null, InputOption::VALUE_REQUIRED, 'Dumping depth of Entity graph.', 7) |
|
| 54 | + ->addOption('show-sql', null, InputOption::VALUE_NONE, 'Dump generated SQL instead of executing query') |
|
| 55 | + ->setHelp('Executes arbitrary DQL directly from the command line.'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $depth = $input->getOption('depth'); |
| 59 | 59 | |
| 60 | - if (! is_numeric($depth)) { |
|
| 60 | + if ( ! is_numeric($depth)) { |
|
| 61 | 61 | throw new \LogicException("Option 'depth' must contain an integer value"); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $hydrationModeName = $input->getOption('hydrate'); |
| 65 | - $hydrationMode = 'Doctrine\ORM\Query::HYDRATE_' . strtoupper(str_replace('-', '_', $hydrationModeName)); |
|
| 65 | + $hydrationMode = 'Doctrine\ORM\Query::HYDRATE_'.strtoupper(str_replace('-', '_', $hydrationModeName)); |
|
| 66 | 66 | |
| 67 | - if (! defined($hydrationMode)) { |
|
| 67 | + if ( ! defined($hydrationMode)) { |
|
| 68 | 68 | throw new \RuntimeException(sprintf( |
| 69 | 69 | "Hydration mode '%s' does not exist. It should be either: object. array, scalar or single-scalar.", |
| 70 | 70 | $hydrationModeName |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $firstResult = $input->getOption('first-result'); |
| 76 | 76 | |
| 77 | 77 | if ($firstResult !== null) { |
| 78 | - if (! is_numeric($firstResult)) { |
|
| 78 | + if ( ! is_numeric($firstResult)) { |
|
| 79 | 79 | throw new \LogicException("Option 'first-result' must contain an integer value"); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $maxResult = $input->getOption('max-result'); |
| 86 | 86 | |
| 87 | 87 | if ($maxResult !== null) { |
| 88 | - if (! is_numeric($maxResult)) { |
|
| 88 | + if ( ! is_numeric($maxResult)) { |
|
| 89 | 89 | throw new \LogicException("Option 'max-result' must contain an integer value"); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -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 | /** |
@@ -56,19 +56,19 @@ |
||
| 56 | 56 | $destPath = $em->getConfiguration()->getProxyDir(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if (! is_dir($destPath)) { |
|
| 59 | + if ( ! is_dir($destPath)) { |
|
| 60 | 60 | mkdir($destPath, 0775, true); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $destPath = realpath($destPath); |
| 64 | 64 | |
| 65 | - if (! file_exists($destPath)) { |
|
| 65 | + if ( ! file_exists($destPath)) { |
|
| 66 | 66 | throw new \InvalidArgumentException( |
| 67 | 67 | sprintf("Proxies destination directory '<info>%s</info>' does not exist.", $em->getConfiguration()->getProxyDir()) |
| 68 | 68 | ); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if (! is_writable($destPath)) { |
|
| 71 | + if ( ! is_writable($destPath)) { |
|
| 72 | 72 | throw new \InvalidArgumentException( |
| 73 | 73 | sprintf("Proxies destination directory '<info>%s</info>' does not have write permissions.", $destPath) |
| 74 | 74 | ); |
@@ -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 | |
@@ -293,9 +293,9 @@ discard block |
||
| 293 | 293 | $user->username = 'gblanco'; |
| 294 | 294 | $user->status = 'developer'; |
| 295 | 295 | |
| 296 | - for ($i=0; $i < $groupCount; ++$i) { |
|
| 296 | + for ($i = 0; $i < $groupCount; ++$i) { |
|
| 297 | 297 | $group = new CmsGroup(); |
| 298 | - $group->name = 'Developers_' . $i; |
|
| 298 | + $group->name = 'Developers_'.$i; |
|
| 299 | 299 | $user->addGroup($group); |
| 300 | 300 | } |
| 301 | 301 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $user |
| 428 | 428 | ->getGroups() |
| 429 | 429 | ->matching($criteria) |
| 430 | - ->map(function (CmsGroup $group) { |
|
| 430 | + ->map(function(CmsGroup $group) { |
|
| 431 | 431 | return $group->getName(); |
| 432 | 432 | }) |
| 433 | 433 | ->toArray() |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | $user |
| 472 | 472 | ->getTags() |
| 473 | 473 | ->matching($criteria) |
| 474 | - ->map(function (CmsTag $tag) { |
|
| 474 | + ->map(function(CmsTag $tag) { |
|
| 475 | 475 | return $tag->getName(); |
| 476 | 476 | }) |
| 477 | 477 | ->toArray() |