@@ -1261,25 +1261,25 @@ discard block |
||
| 1261 | 1261 | private function getDQLForDelete() : string |
| 1262 | 1262 | { |
| 1263 | 1263 | return 'DELETE' |
| 1264 | - . $this->getReducedDQLQueryPart('from', ['pre' => ' ', 'separator' => ', ']) |
|
| 1265 | - . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) |
|
| 1266 | - . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); |
|
| 1264 | + . $this->getReducedDQLQueryPart('from', ['pre' => ' ', 'separator' => ', ']) |
|
| 1265 | + . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) |
|
| 1266 | + . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); |
|
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | private function getDQLForUpdate() : string |
| 1270 | 1270 | { |
| 1271 | 1271 | return 'UPDATE' |
| 1272 | - . $this->getReducedDQLQueryPart('from', ['pre' => ' ', 'separator' => ', ']) |
|
| 1273 | - . $this->getReducedDQLQueryPart('set', ['pre' => ' SET ', 'separator' => ', ']) |
|
| 1274 | - . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) |
|
| 1275 | - . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); |
|
| 1272 | + . $this->getReducedDQLQueryPart('from', ['pre' => ' ', 'separator' => ', ']) |
|
| 1273 | + . $this->getReducedDQLQueryPart('set', ['pre' => ' SET ', 'separator' => ', ']) |
|
| 1274 | + . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) |
|
| 1275 | + . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); |
|
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | private function getDQLForSelect() : string |
| 1279 | 1279 | { |
| 1280 | 1280 | $dql = 'SELECT' |
| 1281 | - . ($this->dqlParts['distinct']===true ? ' DISTINCT' : '') |
|
| 1282 | - . $this->getReducedDQLQueryPart('select', ['pre' => ' ', 'separator' => ', ']); |
|
| 1281 | + . ($this->dqlParts['distinct']===true ? ' DISTINCT' : '') |
|
| 1282 | + . $this->getReducedDQLQueryPart('select', ['pre' => ' ', 'separator' => ', ']); |
|
| 1283 | 1283 | |
| 1284 | 1284 | $fromParts = $this->getDQLPart('from'); |
| 1285 | 1285 | $joinParts = $this->getDQLPart('join'); |
@@ -1303,10 +1303,10 @@ discard block |
||
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | 1305 | $dql .= implode(', ', $fromClauses) |
| 1306 | - . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) |
|
| 1307 | - . $this->getReducedDQLQueryPart('groupBy', ['pre' => ' GROUP BY ', 'separator' => ', ']) |
|
| 1308 | - . $this->getReducedDQLQueryPart('having', ['pre' => ' HAVING ']) |
|
| 1309 | - . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); |
|
| 1306 | + . $this->getReducedDQLQueryPart('where', ['pre' => ' WHERE ']) |
|
| 1307 | + . $this->getReducedDQLQueryPart('groupBy', ['pre' => ' GROUP BY ', 'separator' => ', ']) |
|
| 1308 | + . $this->getReducedDQLQueryPart('having', ['pre' => ' HAVING ']) |
|
| 1309 | + . $this->getReducedDQLQueryPart('orderBy', ['pre' => ' ORDER BY ', 'separator' => ', ']); |
|
| 1310 | 1310 | |
| 1311 | 1311 | return $dql; |
| 1312 | 1312 | } |
@@ -1323,8 +1323,8 @@ discard block |
||
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | return ($options['pre'] ?? '') |
| 1326 | - . (is_array($queryPart) ? implode($options['separator'], $queryPart) : $queryPart) |
|
| 1327 | - . ($options['post'] ?? ''); |
|
| 1326 | + . (is_array($queryPart) ? implode($options['separator'], $queryPart) : $queryPart) |
|
| 1327 | + . ($options['post'] ?? ''); |
|
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | 1330 | /** |
@@ -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 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | { |
| 379 | 379 | $aliases = $this->getRootAliases(); |
| 380 | 380 | |
| 381 | - if (! isset($aliases[0])) { |
|
| 381 | + if ( ! isset($aliases[0])) { |
|
| 382 | 382 | throw new \RuntimeException('No alias was set before invoking getRootAlias().'); |
| 383 | 383 | } |
| 384 | 384 | |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | public function getParameter($key) : ?Query\Parameter |
| 558 | 558 | { |
| 559 | 559 | $filteredParameters = $this->parameters->filter( |
| 560 | - function (Query\Parameter $parameter) use ($key) : bool { |
|
| 560 | + function(Query\Parameter $parameter) use ($key) : bool { |
|
| 561 | 561 | $parameterName = $parameter->getName(); |
| 562 | 562 | |
| 563 | 563 | return $key === $parameterName || (string) $key === (string) $parameterName; |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | { |
| 628 | 628 | if ($append && ($dqlPartName === 'where' || $dqlPartName === 'having')) { |
| 629 | 629 | throw new \InvalidArgumentException( |
| 630 | - "Using \$append = true does not have an effect with 'where' or 'having' " . |
|
| 630 | + "Using \$append = true does not have an effect with 'where' or 'having' ". |
|
| 631 | 631 | 'parts. See QueryBuilder#andWhere() for an example for correct usage.' |
| 632 | 632 | ); |
| 633 | 633 | } |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | { |
| 759 | 759 | $this->type = self::DELETE; |
| 760 | 760 | |
| 761 | - if (! $delete) { |
|
| 761 | + if ( ! $delete) { |
|
| 762 | 762 | return $this; |
| 763 | 763 | } |
| 764 | 764 | |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | { |
| 784 | 784 | $this->type = self::UPDATE; |
| 785 | 785 | |
| 786 | - if (! $update) { |
|
| 786 | + if ( ! $update) { |
|
| 787 | 787 | return $this; |
| 788 | 788 | } |
| 789 | 789 | |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | { |
| 835 | 835 | $rootAliases = $this->getRootAliases(); |
| 836 | 836 | |
| 837 | - if (! in_array($alias, $rootAliases, true)) { |
|
| 837 | + if ( ! in_array($alias, $rootAliases, true)) { |
|
| 838 | 838 | throw new Query\QueryException( |
| 839 | 839 | sprintf('Specified root alias %s must be set before invoking indexBy().', $alias) |
| 840 | 840 | ); |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | */ |
| 988 | 988 | public function where($predicates) : self |
| 989 | 989 | { |
| 990 | - if (! (func_num_args() === 1 && $predicates instanceof Expr\Composite)) { |
|
| 990 | + if ( ! (func_num_args() === 1 && $predicates instanceof Expr\Composite)) { |
|
| 991 | 991 | $predicates = new Expr\Andx(func_get_args()); |
| 992 | 992 | } |
| 993 | 993 | |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | */ |
| 1101 | 1101 | public function having($having) : self |
| 1102 | 1102 | { |
| 1103 | - if (! (func_num_args() === 1 && ($having instanceof Expr\Andx || $having instanceof Expr\Orx))) { |
|
| 1103 | + if ( ! (func_num_args() === 1 && ($having instanceof Expr\Andx || $having instanceof Expr\Orx))) { |
|
| 1104 | 1104 | $having = new Expr\Andx(func_get_args()); |
| 1105 | 1105 | } |
| 1106 | 1106 | |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | public function addCriteria(Criteria $criteria) : self |
| 1189 | 1189 | { |
| 1190 | 1190 | $allAliases = $this->getAllAliases(); |
| 1191 | - if (! isset($allAliases[0])) { |
|
| 1191 | + if ( ! isset($allAliases[0])) { |
|
| 1192 | 1192 | throw new Query\QueryException('No aliases are set before invoking addCriteria().'); |
| 1193 | 1193 | } |
| 1194 | 1194 | |
@@ -1206,14 +1206,14 @@ discard block |
||
| 1206 | 1206 | foreach ($criteria->getOrderings() as $sort => $order) { |
| 1207 | 1207 | $hasValidAlias = false; |
| 1208 | 1208 | foreach ($allAliases as $alias) { |
| 1209 | - if (strpos($sort . '.', $alias . '.') === 0) { |
|
| 1209 | + if (strpos($sort.'.', $alias.'.') === 0) { |
|
| 1210 | 1210 | $hasValidAlias = true; |
| 1211 | 1211 | break; |
| 1212 | 1212 | } |
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | - if (! $hasValidAlias) { |
|
| 1216 | - $sort = $allAliases[0] . '.' . $sort; |
|
| 1215 | + if ( ! $hasValidAlias) { |
|
| 1216 | + $sort = $allAliases[0].'.'.$sort; |
|
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | $this->addOrderBy($sort, $order); |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | private function getDQLForSelect() : string |
| 1279 | 1279 | { |
| 1280 | 1280 | $dql = 'SELECT' |
| 1281 | - . ($this->dqlParts['distinct']===true ? ' DISTINCT' : '') |
|
| 1281 | + . ($this->dqlParts['distinct'] === true ? ' DISTINCT' : '') |
|
| 1282 | 1282 | . $this->getReducedDQLQueryPart('select', ['pre' => ' ', 'separator' => ', ']); |
| 1283 | 1283 | |
| 1284 | 1284 | $fromParts = $this->getDQLPart('from'); |
@@ -1286,7 +1286,7 @@ discard block |
||
| 1286 | 1286 | $fromClauses = []; |
| 1287 | 1287 | |
| 1288 | 1288 | // Loop through all FROM clauses |
| 1289 | - if (! empty($fromParts)) { |
|
| 1289 | + if ( ! empty($fromParts)) { |
|
| 1290 | 1290 | $dql .= ' FROM '; |
| 1291 | 1291 | |
| 1292 | 1292 | foreach ($fromParts as $from) { |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | |
| 1295 | 1295 | if ($from instanceof Expr\From && isset($joinParts[$from->getAlias()])) { |
| 1296 | 1296 | foreach ($joinParts[$from->getAlias()] as $join) { |
| 1297 | - $fromClause .= ' ' . ((string) $join); |
|
| 1297 | + $fromClause .= ' '.((string) $join); |
|
| 1298 | 1298 | } |
| 1299 | 1299 | } |
| 1300 | 1300 | |
@@ -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 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | { |
| 282 | 282 | $query = new Query($this); |
| 283 | 283 | |
| 284 | - if (! empty($dql)) { |
|
| 284 | + if ( ! empty($dql)) { |
|
| 285 | 285 | $query->setDQL($dql); |
| 286 | 286 | } |
| 287 | 287 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $class = $this->metadataFactory->getMetadataFor(ltrim($className, '\\')); |
| 373 | 373 | $className = $class->getClassName(); |
| 374 | 374 | |
| 375 | - if (! is_array($id)) { |
|
| 375 | + if ( ! is_array($id)) { |
|
| 376 | 376 | if ($class->isIdentifierComposite()) { |
| 377 | 377 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
| 378 | 378 | } |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $sortedId = []; |
| 394 | 394 | |
| 395 | 395 | foreach ($class->identifier as $identifier) { |
| 396 | - if (! isset($id[$identifier])) { |
|
| 396 | + if ( ! isset($id[$identifier])) { |
|
| 397 | 397 | throw ORMException::missingIdentifierField($className, $identifier); |
| 398 | 398 | } |
| 399 | 399 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | // Check identity map first |
| 411 | 411 | $entity = $unitOfWork->tryGetById($sortedId, $class->getRootClassName()); |
| 412 | 412 | if ($entity !== false) { |
| 413 | - if (! ($entity instanceof $className)) { |
|
| 413 | + if ( ! ($entity instanceof $className)) { |
|
| 414 | 414 | return null; |
| 415 | 415 | } |
| 416 | 416 | |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | switch (true) { |
| 436 | 436 | case $lockMode === LockMode::OPTIMISTIC: |
| 437 | - if (! $class->isVersioned()) { |
|
| 437 | + if ( ! $class->isVersioned()) { |
|
| 438 | 438 | throw OptimisticLockException::notVersioned($className); |
| 439 | 439 | } |
| 440 | 440 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | case $lockMode === LockMode::PESSIMISTIC_READ: |
| 448 | 448 | case $lockMode === LockMode::PESSIMISTIC_WRITE: |
| 449 | - if (! $this->getConnection()->isTransactionActive()) { |
|
| 449 | + if ( ! $this->getConnection()->isTransactionActive()) { |
|
| 450 | 450 | throw TransactionRequiredException::transactionRequired(); |
| 451 | 451 | } |
| 452 | 452 | |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | $class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\')); |
| 466 | 466 | $className = $class->getClassName(); |
| 467 | 467 | |
| 468 | - if (! is_array($id)) { |
|
| 468 | + if ( ! is_array($id)) { |
|
| 469 | 469 | if ($class->isIdentifierComposite()) { |
| 470 | 470 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
| 471 | 471 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $sortedId = []; |
| 491 | 491 | |
| 492 | 492 | foreach ($class->identifier as $identifier) { |
| 493 | - if (! isset($scalarId[$identifier])) { |
|
| 493 | + if ( ! isset($scalarId[$identifier])) { |
|
| 494 | 494 | throw ORMException::missingIdentifierField($className, $identifier); |
| 495 | 495 | } |
| 496 | 496 | |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | $class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\')); |
| 532 | 532 | $className = $class->getClassName(); |
| 533 | 533 | |
| 534 | - if (! is_array($id)) { |
|
| 534 | + if ( ! is_array($id)) { |
|
| 535 | 535 | if ($class->isIdentifierComposite()) { |
| 536 | 536 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
| 537 | 537 | } |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | $sortedId = []; |
| 553 | 553 | |
| 554 | 554 | foreach ($class->identifier as $identifier) { |
| 555 | - if (! isset($id[$identifier])) { |
|
| 555 | + if ( ! isset($id[$identifier])) { |
|
| 556 | 556 | throw ORMException::missingIdentifierField($className, $identifier); |
| 557 | 557 | } |
| 558 | 558 | |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | public function persist(object $object) : void |
| 626 | 626 | { |
| 627 | - if (! is_object($object)) { |
|
| 627 | + if ( ! is_object($object)) { |
|
| 628 | 628 | throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()', $object); |
| 629 | 629 | } |
| 630 | 630 | |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | */ |
| 647 | 647 | public function remove(object $entity) : void |
| 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(object $entity) : void |
| 668 | 668 | { |
| 669 | - if (! is_object($entity)) { |
|
| 669 | + if ( ! is_object($entity)) { |
|
| 670 | 670 | throw ORMInvalidArgumentException::invalidObject('EntityManager#refresh()', $entity); |
| 671 | 671 | } |
| 672 | 672 | |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | */ |
| 820 | 820 | public static function create($connection, Configuration $config, ?EventManager $eventManager = null) : self |
| 821 | 821 | { |
| 822 | - if (! $config->getMetadataDriverImpl()) { |
|
| 822 | + if ( ! $config->getMetadataDriverImpl()) { |
|
| 823 | 823 | throw ORMException::missingMappingDriverImpl(); |
| 824 | 824 | } |
| 825 | 825 | |
@@ -844,12 +844,12 @@ discard block |
||
| 844 | 844 | return DriverManager::getConnection($connection, $config, $eventManager ?: new EventManager()); |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | - if (! $connection instanceof Connection) { |
|
| 847 | + if ( ! $connection instanceof Connection) { |
|
| 848 | 848 | throw new \InvalidArgumentException( |
| 849 | 849 | sprintf( |
| 850 | 850 | 'Invalid $connection argument of type %s given%s.', |
| 851 | 851 | is_object($connection) ? get_class($connection) : gettype($connection), |
| 852 | - is_object($connection) ? '' : ': "' . $connection . '"' |
|
| 852 | + is_object($connection) ? '' : ': "'.$connection.'"' |
|
| 853 | 853 | ) |
| 854 | 854 | ); |
| 855 | 855 | } |
@@ -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 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | public function getParameter($key) : ?Parameter |
| 285 | 285 | { |
| 286 | 286 | $filteredParameters = $this->parameters->filter( |
| 287 | - function (Parameter $parameter) use ($key) : bool { |
|
| 287 | + function(Parameter $parameter) use ($key) : bool { |
|
| 288 | 288 | $parameterName = $parameter->getName(); |
| 289 | 289 | |
| 290 | 290 | return $key === $parameterName || (string) $key === (string) $parameterName; |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | return null; |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | - if (! is_array($result)) { |
|
| 673 | + if ( ! is_array($result)) { |
|
| 674 | 674 | return $result; |
| 675 | 675 | } |
| 676 | 676 | |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | throw new NoResultException(); |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - if (! is_array($result)) { |
|
| 705 | + if ( ! is_array($result)) { |
|
| 706 | 706 | return $result; |
| 707 | 707 | } |
| 708 | 708 | |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | $this->setHydrationMode($hydrationMode); |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | - if (! empty($parameters)) { |
|
| 793 | + if ( ! empty($parameters)) { |
|
| 794 | 794 | $this->setParameters($parameters); |
| 795 | 795 | } |
| 796 | 796 | |
@@ -830,11 +830,11 @@ discard block |
||
| 830 | 830 | $this->setHydrationMode($hydrationMode); |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | - if (! empty($parameters)) { |
|
| 833 | + if ( ! empty($parameters)) { |
|
| 834 | 834 | $this->setParameters($parameters); |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - $setCacheEntry = function () : void { |
|
| 837 | + $setCacheEntry = function() : void { |
|
| 838 | 838 | }; |
| 839 | 839 | |
| 840 | 840 | if ($this->hydrationCacheProfile !== null) { |
@@ -848,11 +848,11 @@ discard block |
||
| 848 | 848 | return $result[$realCacheKey]; |
| 849 | 849 | } |
| 850 | 850 | |
| 851 | - if (! $result) { |
|
| 851 | + if ( ! $result) { |
|
| 852 | 852 | $result = []; |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | - $setCacheEntry = function ($data) use ($cache, $result, $cacheKey, $realCacheKey, $queryCacheProfile) : void { |
|
| 855 | + $setCacheEntry = function($data) use ($cache, $result, $cacheKey, $realCacheKey, $queryCacheProfile) : void { |
|
| 856 | 856 | $result[$realCacheKey] = $data; |
| 857 | 857 | |
| 858 | 858 | $cache->save($cacheKey, $result, $queryCacheProfile->getLifetime()); |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | { |
| 1005 | 1005 | $query = $this->getSQL(); |
| 1006 | 1006 | $hints = $this->getHints(); |
| 1007 | - $params = array_map(function (Parameter $parameter) { |
|
| 1007 | + $params = array_map(function(Parameter $parameter) { |
|
| 1008 | 1008 | $value = $parameter->getValue(); |
| 1009 | 1009 | |
| 1010 | 1010 | // Small optimization |
@@ -1018,6 +1018,6 @@ discard block |
||
| 1018 | 1018 | |
| 1019 | 1019 | ksort($hints); |
| 1020 | 1020 | |
| 1021 | - return sha1($query . '-' . serialize($params) . '-' . serialize($hints)); |
|
| 1021 | + return sha1($query.'-'.serialize($params).'-'.serialize($hints)); |
|
| 1022 | 1022 | } |
| 1023 | 1023 | } |
@@ -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\Cache; |
| 6 | 6 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $metadata = $this->em->getClassMetadata($className); |
| 56 | 56 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 57 | 57 | |
| 58 | - if (! ($persister instanceof CachedPersister)) { |
|
| 58 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 59 | 59 | return null; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $metadata = $this->em->getClassMetadata($className); |
| 71 | 71 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
| 72 | 72 | |
| 73 | - if (! ($persister instanceof CachedPersister)) { |
|
| 73 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 74 | 74 | return null; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $metadata = $this->em->getClassMetadata($className); |
| 86 | 86 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 87 | 87 | |
| 88 | - if (! ($persister instanceof CachedPersister)) { |
|
| 88 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 89 | 89 | return false; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $metadata = $this->em->getClassMetadata($className); |
| 101 | 101 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 102 | 102 | |
| 103 | - if (! ($persister instanceof CachedPersister)) { |
|
| 103 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 104 | 104 | return; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $metadata = $this->em->getClassMetadata($className); |
| 116 | 116 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 117 | 117 | |
| 118 | - if (! ($persister instanceof CachedPersister)) { |
|
| 118 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 119 | 119 | return; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | foreach ($metadatas as $metadata) { |
| 133 | 133 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 134 | 134 | |
| 135 | - if (! ($persister instanceof CachedPersister)) { |
|
| 135 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 136 | 136 | continue; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $metadata = $this->em->getClassMetadata($className); |
| 149 | 149 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
| 150 | 150 | |
| 151 | - if (! ($persister instanceof CachedPersister)) { |
|
| 151 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 152 | 152 | return false; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $metadata = $this->em->getClassMetadata($className); |
| 164 | 164 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
| 165 | 165 | |
| 166 | - if (! ($persister instanceof CachedPersister)) { |
|
| 166 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 167 | 167 | return; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $metadata = $this->em->getClassMetadata($className); |
| 179 | 179 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
| 180 | 180 | |
| 181 | - if (! ($persister instanceof CachedPersister)) { |
|
| 181 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 182 | 182 | return; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -194,13 +194,13 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | foreach ($metadatas as $metadata) { |
| 196 | 196 | foreach ($metadata->getDeclaredPropertiesIterator() as $association) { |
| 197 | - if (! $association instanceof ToManyAssociationMetadata) { |
|
| 197 | + if ( ! $association instanceof ToManyAssociationMetadata) { |
|
| 198 | 198 | continue; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $persister = $this->uow->getCollectionPersister($association); |
| 202 | 202 | |
| 203 | - if (! ($persister instanceof CachedPersister)) { |
|
| 203 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 204 | 204 | continue; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -251,11 +251,10 @@ discard block |
||
| 251 | 251 | public function getQueryCache(?string $regionName = null) : QueryCache |
| 252 | 252 | { |
| 253 | 253 | if ($regionName === null) { |
| 254 | - return $this->defaultQueryCache ?: |
|
| 255 | - $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em); |
|
| 254 | + return $this->defaultQueryCache ?: $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em); |
|
| 256 | 255 | } |
| 257 | 256 | |
| 258 | - if (! isset($this->queryCaches[$regionName])) { |
|
| 257 | + if ( ! isset($this->queryCaches[$regionName])) { |
|
| 259 | 258 | $this->queryCaches[$regionName] = $this->cacheFactory->buildQueryCache($this->em, $regionName); |
| 260 | 259 | } |
| 261 | 260 | |
@@ -268,7 +267,7 @@ discard block |
||
| 268 | 267 | */ |
| 269 | 268 | private function buildEntityCacheKey(ClassMetadata $metadata, $identifier) : EntityCacheKey |
| 270 | 269 | { |
| 271 | - if (! is_array($identifier)) { |
|
| 270 | + if ( ! is_array($identifier)) { |
|
| 272 | 271 | $identifier = $this->toIdentifierArray($metadata, $identifier); |
| 273 | 272 | } |
| 274 | 273 | |
@@ -282,7 +281,7 @@ discard block |
||
| 282 | 281 | */ |
| 283 | 282 | private function buildCollectionCacheKey(ClassMetadata $metadata, string $association, $ownerIdentifier) : CollectionCacheKey |
| 284 | 283 | { |
| 285 | - if (! is_array($ownerIdentifier)) { |
|
| 284 | + if ( ! is_array($ownerIdentifier)) { |
|
| 286 | 285 | $ownerIdentifier = $this->toIdentifierArray($metadata, $ownerIdentifier); |
| 287 | 286 | } |
| 288 | 287 | |
@@ -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 | |
@@ -229,14 +229,14 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | private function resolveMagicCall(string $method, string $by, array $arguments) |
| 231 | 231 | { |
| 232 | - if (! $arguments) { |
|
| 233 | - throw ORMException::findByRequiresParameter($method . $by); |
|
| 232 | + if ( ! $arguments) { |
|
| 233 | + throw ORMException::findByRequiresParameter($method.$by); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | $fieldName = lcfirst(Inflector::classify($by)); |
| 237 | 237 | |
| 238 | 238 | if ($this->class->getProperty($fieldName) === null) { |
| 239 | - throw ORMException::invalidMagicCall($this->entityName, $fieldName, $method . $by); |
|
| 239 | + throw ORMException::invalidMagicCall($this->entityName, $fieldName, $method.$by); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | return $this->{$method}([$fieldName => $arguments[0]], ...array_slice($arguments, 1)); |
@@ -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 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | // Check query cache. |
| 256 | 256 | $queryCache = $this->getQueryCacheDriver(); |
| 257 | - if (! ($this->useQueryCache && $queryCache)) { |
|
| 257 | + if ( ! ($this->useQueryCache && $queryCache)) { |
|
| 258 | 258 | $parser = new Parser($this); |
| 259 | 259 | |
| 260 | 260 | $this->parserResult = $parser->parse(); |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $value = $parameter->getValue(); |
| 392 | 392 | $rsm = $this->getResultSetMapping(); |
| 393 | 393 | |
| 394 | - if (! isset($paramMappings[$key])) { |
|
| 394 | + if ( ! isset($paramMappings[$key])) { |
|
| 395 | 395 | throw QueryException::unknownParameter($key); |
| 396 | 396 | } |
| 397 | 397 | |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | public function setLockMode(int $lockMode) : parent |
| 684 | 684 | { |
| 685 | 685 | if (in_array($lockMode, [LockMode::NONE, LockMode::PESSIMISTIC_READ, LockMode::PESSIMISTIC_WRITE], true)) { |
| 686 | - if (! $this->em->getConnection()->isTransactionActive()) { |
|
| 686 | + if ( ! $this->em->getConnection()->isTransactionActive()) { |
|
| 687 | 687 | throw TransactionRequiredException::transactionRequired(); |
| 688 | 688 | } |
| 689 | 689 | } |
@@ -722,11 +722,11 @@ discard block |
||
| 722 | 722 | ->getName(); |
| 723 | 723 | |
| 724 | 724 | return md5( |
| 725 | - $this->getDQL() . serialize($this->hints) . |
|
| 726 | - '&platform=' . $platform . |
|
| 727 | - ($this->em->hasFilters() ? $this->em->getFilters()->getHash() : '') . |
|
| 728 | - '&firstResult=' . $this->firstResult . '&maxResult=' . $this->maxResults . |
|
| 729 | - '&hydrationMode=' . $this->hydrationMode . '&types=' . serialize($this->parsedTypes) . 'DOCTRINE_QUERY_CACHE_SALT' |
|
| 725 | + $this->getDQL().serialize($this->hints). |
|
| 726 | + '&platform='.$platform. |
|
| 727 | + ($this->em->hasFilters() ? $this->em->getFilters()->getHash() : ''). |
|
| 728 | + '&firstResult='.$this->firstResult.'&maxResult='.$this->maxResults. |
|
| 729 | + '&hydrationMode='.$this->hydrationMode.'&types='.serialize($this->parsedTypes).'DOCTRINE_QUERY_CACHE_SALT' |
|
| 730 | 730 | ); |
| 731 | 731 | } |
| 732 | 732 | |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | */ |
| 736 | 736 | protected function getHash() : string |
| 737 | 737 | { |
| 738 | - return sha1(parent::getHash() . '-' . $this->firstResult . '-' . $this->maxResults); |
|
| 738 | + return sha1(parent::getHash().'-'.$this->firstResult.'-'.$this->maxResults); |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | /** |
@@ -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 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $this->computeChangeSets(); |
| 337 | 337 | |
| 338 | - if (! ($this->entityInsertions || |
|
| 338 | + if ( ! ($this->entityInsertions || |
|
| 339 | 339 | $this->entityDeletions || |
| 340 | 340 | $this->entityUpdates || |
| 341 | 341 | $this->collectionUpdates || |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | // Entity deletions come last and need to be in reverse commit order |
| 395 | 395 | if ($this->entityDeletions) { |
| 396 | 396 | foreach (array_reverse($commitOrder) as $committedEntityName) { |
| 397 | - if (! $this->entityDeletions) { |
|
| 397 | + if ( ! $this->entityDeletions) { |
|
| 398 | 398 | break; // just a performance optimisation |
| 399 | 399 | } |
| 400 | 400 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $oid = spl_object_id($entity); |
| 476 | 476 | $data = []; |
| 477 | 477 | |
| 478 | - if (! isset($this->entityChangeSets[$oid])) { |
|
| 478 | + if ( ! isset($this->entityChangeSets[$oid])) { |
|
| 479 | 479 | return $data; |
| 480 | 480 | } |
| 481 | 481 | |
@@ -556,12 +556,12 @@ discard block |
||
| 556 | 556 | || ! $class->getProperty($name) instanceof FieldMetadata |
| 557 | 557 | || ! $class->getProperty($name)->hasValueGenerator() |
| 558 | 558 | || $class->getProperty($name)->getValueGenerator()->getType() !== GeneratorType::IDENTITY |
| 559 | - ) && (! $class->isVersioned() || $name !== $class->versionProperty->getName())) { |
|
| 559 | + ) && ( ! $class->isVersioned() || $name !== $class->versionProperty->getName())) { |
|
| 560 | 560 | $actualData[$name] = $value; |
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - if (! isset($this->originalEntityData[$oid])) { |
|
| 564 | + if ( ! isset($this->originalEntityData[$oid])) { |
|
| 565 | 565 | // Entity is either NEW or MANAGED but not yet fully persisted (only has an id). |
| 566 | 566 | // These result in an INSERT. |
| 567 | 567 | $this->originalEntityData[$oid] = $actualData; |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | foreach ($actualData as $propName => $actualValue) { |
| 590 | 590 | // skip field, its a partially omitted one! |
| 591 | - if (! (isset($originalData[$propName]) || array_key_exists($propName, $originalData))) { |
|
| 591 | + if ( ! (isset($originalData[$propName]) || array_key_exists($propName, $originalData))) { |
|
| 592 | 592 | continue; |
| 593 | 593 | } |
| 594 | 594 | |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | if ($owner === null) { // cloned |
| 611 | 611 | $actualValue->setOwner($entity, $property); |
| 612 | 612 | } elseif ($owner !== $entity) { // no clone, we have to fix |
| 613 | - if (! $actualValue->isInitialized()) { |
|
| 613 | + if ( ! $actualValue->isInitialized()) { |
|
| 614 | 614 | $actualValue->initialize(); // we have to do this otherwise the cols share state |
| 615 | 615 | } |
| 616 | 616 | |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | // Check if original value exists |
| 649 | 649 | if ($orgValue instanceof PersistentCollection) { |
| 650 | 650 | // A PersistentCollection was de-referenced, so delete it. |
| 651 | - if (! $this->isCollectionScheduledForDeletion($orgValue)) { |
|
| 651 | + if ( ! $this->isCollectionScheduledForDeletion($orgValue)) { |
|
| 652 | 652 | $this->scheduleCollectionDeletion($orgValue); |
| 653 | 653 | |
| 654 | 654 | $changeSet[$propName] = $orgValue; // Signal changeset, to-many associations will be ignored |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | |
| 672 | 672 | // Look for changes in associations of the entity |
| 673 | 673 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
| 674 | - if (! $property instanceof AssociationMetadata) { |
|
| 674 | + if ( ! $property instanceof AssociationMetadata) { |
|
| 675 | 675 | continue; |
| 676 | 676 | } |
| 677 | 677 | |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | // Only MANAGED entities that are NOT SCHEDULED FOR INSERTION OR DELETION are processed here. |
| 739 | 739 | $oid = spl_object_id($entity); |
| 740 | 740 | |
| 741 | - if (! isset($this->entityInsertions[$oid]) && ! isset($this->entityDeletions[$oid]) && isset($this->entityStates[$oid])) { |
|
| 741 | + if ( ! isset($this->entityInsertions[$oid]) && ! isset($this->entityDeletions[$oid]) && isset($this->entityStates[$oid])) { |
|
| 742 | 742 | $this->computeChangeSet($class, $entity); |
| 743 | 743 | } |
| 744 | 744 | } |
@@ -775,13 +775,13 @@ discard block |
||
| 775 | 775 | $targetClass = $this->em->getClassMetadata($targetEntity); |
| 776 | 776 | |
| 777 | 777 | foreach ($unwrappedValue as $key => $entry) { |
| 778 | - if (! ($entry instanceof $targetEntity)) { |
|
| 778 | + if ( ! ($entry instanceof $targetEntity)) { |
|
| 779 | 779 | throw ORMInvalidArgumentException::invalidAssociation($targetClass, $association, $entry); |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | $state = $this->getEntityState($entry, self::STATE_NEW); |
| 783 | 783 | |
| 784 | - if (! ($entry instanceof $targetEntity)) { |
|
| 784 | + if ( ! ($entry instanceof $targetEntity)) { |
|
| 785 | 785 | throw ORMException::unexpectedAssociationValue( |
| 786 | 786 | $association->getSourceEntity(), |
| 787 | 787 | $association->getName(), |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | |
| 793 | 793 | switch ($state) { |
| 794 | 794 | case self::STATE_NEW: |
| 795 | - if (! in_array('persist', $association->getCascade(), true)) { |
|
| 795 | + if ( ! in_array('persist', $association->getCascade(), true)) { |
|
| 796 | 796 | $this->nonCascadedNewDetectedEntities[spl_object_id($entry)] = [$association, $entry]; |
| 797 | 797 | |
| 798 | 798 | break; |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | $persister = $this->getEntityPersister($class->getClassName()); |
| 838 | 838 | $generationPlan->executeImmediate($this->em, $entity); |
| 839 | 839 | |
| 840 | - if (! $generationPlan->containsDeferred()) { |
|
| 840 | + if ( ! $generationPlan->containsDeferred()) { |
|
| 841 | 841 | $id = $this->em->getIdentifierFlattener()->flattenIdentifier($class, $persister->getIdentifier($entity)); |
| 842 | 842 | $this->entityIdentifiers[$oid] = $id; |
| 843 | 843 | } |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | { |
| 869 | 869 | $oid = spl_object_id($entity); |
| 870 | 870 | |
| 871 | - if (! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) { |
|
| 871 | + if ( ! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) { |
|
| 872 | 872 | throw ORMInvalidArgumentException::entityNotManaged($entity); |
| 873 | 873 | } |
| 874 | 874 | |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | break; |
| 891 | 891 | |
| 892 | 892 | case ($property instanceof FieldMetadata): |
| 893 | - if (! $property->isPrimaryKey() |
|
| 893 | + if ( ! $property->isPrimaryKey() |
|
| 894 | 894 | || ! $property->getValueGenerator() |
| 895 | 895 | || $property->getValueGenerator()->getType() !== GeneratorType::IDENTITY) { |
| 896 | 896 | $actualData[$name] = $property->getValue($entity); |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | } |
| 905 | 905 | } |
| 906 | 906 | |
| 907 | - if (! isset($this->originalEntityData[$oid])) { |
|
| 907 | + if ( ! isset($this->originalEntityData[$oid])) { |
|
| 908 | 908 | throw new \RuntimeException('Cannot call recomputeSingleEntityChangeSet before computeChangeSet on an entity.'); |
| 909 | 909 | } |
| 910 | 910 | |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | if ($changeSet) { |
| 923 | 923 | if (isset($this->entityChangeSets[$oid])) { |
| 924 | 924 | $this->entityChangeSets[$oid] = array_merge($this->entityChangeSets[$oid], $changeSet); |
| 925 | - } elseif (! isset($this->entityInsertions[$oid])) { |
|
| 925 | + } elseif ( ! isset($this->entityInsertions[$oid])) { |
|
| 926 | 926 | $this->entityChangeSets[$oid] = $changeSet; |
| 927 | 927 | $this->entityUpdates[$oid] = $entity; |
| 928 | 928 | } |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | $this->recomputeSingleEntityChangeSet($class, $entity); |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | - if (! empty($this->entityChangeSets[$oid])) { |
|
| 993 | + if ( ! empty($this->entityChangeSets[$oid])) { |
|
| 994 | 994 | // echo 'Update: '; |
| 995 | 995 | // \Doctrine\Common\Util\Debug::dump($this->entityChangeSets[$oid], 3); |
| 996 | 996 | |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | // Entity with this $oid after deletion treated as NEW, even if the $oid |
| 1032 | 1032 | // is obtained by a new entity because the old one went out of scope. |
| 1033 | 1033 | //$this->entityStates[$oid] = self::STATE_NEW; |
| 1034 | - if (! $class->isIdentifierComposite()) { |
|
| 1034 | + if ( ! $class->isIdentifierComposite()) { |
|
| 1035 | 1035 | $property = $class->getProperty($class->getSingleIdentifierFieldName()); |
| 1036 | 1036 | |
| 1037 | 1037 | if ($property instanceof FieldMetadata && $property->hasValueGenerator()) { |
@@ -1078,13 +1078,13 @@ discard block |
||
| 1078 | 1078 | // Calculate dependencies for new nodes |
| 1079 | 1079 | while ($class = array_pop($newNodes)) { |
| 1080 | 1080 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
| 1081 | - if (! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) { |
|
| 1081 | + if ( ! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) { |
|
| 1082 | 1082 | continue; |
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | 1085 | $targetClass = $this->em->getClassMetadata($property->getTargetEntity()); |
| 1086 | 1086 | |
| 1087 | - if (! $calc->hasNode($targetClass->getClassName())) { |
|
| 1087 | + if ( ! $calc->hasNode($targetClass->getClassName())) { |
|
| 1088 | 1088 | $calc->addNode($targetClass->getClassName(), $targetClass); |
| 1089 | 1089 | |
| 1090 | 1090 | $newNodes[] = $targetClass; |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | |
| 1093 | 1093 | $weight = ! array_filter( |
| 1094 | 1094 | $property->getJoinColumns(), |
| 1095 | - function (JoinColumnMetadata $joinColumn) { |
|
| 1095 | + function(JoinColumnMetadata $joinColumn) { |
|
| 1096 | 1096 | return $joinColumn->isNullable(); |
| 1097 | 1097 | } |
| 1098 | 1098 | ); |
@@ -1100,14 +1100,14 @@ discard block |
||
| 1100 | 1100 | $calc->addDependency($targetClass->getClassName(), $class->getClassName(), $weight); |
| 1101 | 1101 | |
| 1102 | 1102 | // If the target class has mapped subclasses, these share the same dependency. |
| 1103 | - if (! $targetClass->getSubClasses()) { |
|
| 1103 | + if ( ! $targetClass->getSubClasses()) { |
|
| 1104 | 1104 | continue; |
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | foreach ($targetClass->getSubClasses() as $subClassName) { |
| 1108 | 1108 | $targetSubClass = $this->em->getClassMetadata($subClassName); |
| 1109 | 1109 | |
| 1110 | - if (! $calc->hasNode($subClassName)) { |
|
| 1110 | + if ( ! $calc->hasNode($subClassName)) { |
|
| 1111 | 1111 | $calc->addNode($targetSubClass->getClassName(), $targetSubClass); |
| 1112 | 1112 | |
| 1113 | 1113 | $newNodes[] = $targetSubClass; |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | { |
| 1180 | 1180 | $oid = spl_object_id($entity); |
| 1181 | 1181 | |
| 1182 | - if (! isset($this->entityIdentifiers[$oid])) { |
|
| 1182 | + if ( ! isset($this->entityIdentifiers[$oid])) { |
|
| 1183 | 1183 | throw ORMInvalidArgumentException::entityHasNoIdentity($entity, 'scheduling for update'); |
| 1184 | 1184 | } |
| 1185 | 1185 | |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | throw ORMInvalidArgumentException::entityIsRemoved($entity, 'schedule for update'); |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | - if (! isset($this->entityUpdates[$oid]) && ! isset($this->entityInsertions[$oid])) { |
|
| 1190 | + if ( ! isset($this->entityUpdates[$oid]) && ! isset($this->entityInsertions[$oid])) { |
|
| 1191 | 1191 | $this->entityUpdates[$oid] = $entity; |
| 1192 | 1192 | } |
| 1193 | 1193 | } |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | return; // entity has not been persisted yet, so nothing more to do. |
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | - if (! $this->isInIdentityMap($entity)) { |
|
| 1260 | + if ( ! $this->isInIdentityMap($entity)) { |
|
| 1261 | 1261 | return; |
| 1262 | 1262 | } |
| 1263 | 1263 | |
@@ -1265,7 +1265,7 @@ discard block |
||
| 1265 | 1265 | |
| 1266 | 1266 | unset($this->entityUpdates[$oid]); |
| 1267 | 1267 | |
| 1268 | - if (! isset($this->entityDeletions[$oid])) { |
|
| 1268 | + if ( ! isset($this->entityDeletions[$oid])) { |
|
| 1269 | 1269 | $this->entityDeletions[$oid] = $entity; |
| 1270 | 1270 | $this->entityStates[$oid] = self::STATE_REMOVED; |
| 1271 | 1271 | } |
@@ -1358,7 +1358,7 @@ discard block |
||
| 1358 | 1358 | $persister = $this->getEntityPersister($class->getClassName()); |
| 1359 | 1359 | $id = $persister->getIdentifier($entity); |
| 1360 | 1360 | |
| 1361 | - if (! $id) { |
|
| 1361 | + if ( ! $id) { |
|
| 1362 | 1362 | return self::STATE_NEW; |
| 1363 | 1363 | } |
| 1364 | 1364 | |
@@ -1698,7 +1698,7 @@ discard block |
||
| 1698 | 1698 | $class = $this->em->getClassMetadata(get_class($entity)); |
| 1699 | 1699 | |
| 1700 | 1700 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
| 1701 | - if (! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade(), true))) { |
|
| 1701 | + if ( ! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade(), true))) { |
|
| 1702 | 1702 | continue; |
| 1703 | 1703 | } |
| 1704 | 1704 | |
@@ -1744,7 +1744,7 @@ discard block |
||
| 1744 | 1744 | } |
| 1745 | 1745 | |
| 1746 | 1746 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
| 1747 | - if (! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade(), true))) { |
|
| 1747 | + if ( ! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade(), true))) { |
|
| 1748 | 1748 | continue; |
| 1749 | 1749 | } |
| 1750 | 1750 | |
@@ -1760,7 +1760,7 @@ discard block |
||
| 1760 | 1760 | |
| 1761 | 1761 | case ($relatedEntities instanceof Collection): |
| 1762 | 1762 | case (is_array($relatedEntities)): |
| 1763 | - if (! ($association instanceof ToManyAssociationMetadata)) { |
|
| 1763 | + if ( ! ($association instanceof ToManyAssociationMetadata)) { |
|
| 1764 | 1764 | throw ORMInvalidArgumentException::invalidAssociation( |
| 1765 | 1765 | $this->em->getClassMetadata($targetEntity), |
| 1766 | 1766 | $association, |
@@ -1775,7 +1775,7 @@ discard block |
||
| 1775 | 1775 | break; |
| 1776 | 1776 | |
| 1777 | 1777 | case ($relatedEntities !== null): |
| 1778 | - if (! $relatedEntities instanceof $targetEntity) { |
|
| 1778 | + if ( ! $relatedEntities instanceof $targetEntity) { |
|
| 1779 | 1779 | throw ORMInvalidArgumentException::invalidAssociation( |
| 1780 | 1780 | $this->em->getClassMetadata($targetEntity), |
| 1781 | 1781 | $association, |
@@ -1803,7 +1803,7 @@ discard block |
||
| 1803 | 1803 | $class = $this->em->getClassMetadata(get_class($entity)); |
| 1804 | 1804 | |
| 1805 | 1805 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
| 1806 | - if (! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade(), true))) { |
|
| 1806 | + if ( ! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade(), true))) { |
|
| 1807 | 1807 | continue; |
| 1808 | 1808 | } |
| 1809 | 1809 | |
@@ -1860,7 +1860,7 @@ discard block |
||
| 1860 | 1860 | |
| 1861 | 1861 | switch (true) { |
| 1862 | 1862 | case $lockMode === LockMode::OPTIMISTIC: |
| 1863 | - if (! $class->isVersioned()) { |
|
| 1863 | + if ( ! $class->isVersioned()) { |
|
| 1864 | 1864 | throw OptimisticLockException::notVersioned($class->getClassName()); |
| 1865 | 1865 | } |
| 1866 | 1866 | |
@@ -1883,7 +1883,7 @@ discard block |
||
| 1883 | 1883 | case $lockMode === LockMode::NONE: |
| 1884 | 1884 | case $lockMode === LockMode::PESSIMISTIC_READ: |
| 1885 | 1885 | case $lockMode === LockMode::PESSIMISTIC_WRITE: |
| 1886 | - if (! $this->em->getConnection()->isTransactionActive()) { |
|
| 1886 | + if ( ! $this->em->getConnection()->isTransactionActive()) { |
|
| 1887 | 1887 | throw TransactionRequiredException::transactionRequired(); |
| 1888 | 1888 | } |
| 1889 | 1889 | |
@@ -2035,7 +2035,7 @@ discard block |
||
| 2035 | 2035 | $entity->addPropertyChangedListener($this); |
| 2036 | 2036 | } |
| 2037 | 2037 | } else { |
| 2038 | - if (! isset($hints[Query::HINT_REFRESH]) |
|
| 2038 | + if ( ! isset($hints[Query::HINT_REFRESH]) |
|
| 2039 | 2039 | || (isset($hints[Query::HINT_REFRESH_ENTITY]) && $hints[Query::HINT_REFRESH_ENTITY] !== $entity)) { |
| 2040 | 2040 | return $entity; |
| 2041 | 2041 | } |
@@ -2083,7 +2083,7 @@ discard block |
||
| 2083 | 2083 | } |
| 2084 | 2084 | |
| 2085 | 2085 | foreach ($class->getDeclaredPropertiesIterator() as $field => $association) { |
| 2086 | - if (! ($association instanceof AssociationMetadata)) { |
|
| 2086 | + if ( ! ($association instanceof AssociationMetadata)) { |
|
| 2087 | 2087 | continue; |
| 2088 | 2088 | } |
| 2089 | 2089 | |
@@ -2132,7 +2132,7 @@ discard block |
||
| 2132 | 2132 | continue; |
| 2133 | 2133 | } |
| 2134 | 2134 | |
| 2135 | - if (! $association->isOwningSide()) { |
|
| 2135 | + if ( ! $association->isOwningSide()) { |
|
| 2136 | 2136 | // use the given entity association |
| 2137 | 2137 | if (isset($data[$field]) && is_object($data[$field]) && |
| 2138 | 2138 | isset($this->entityStates[spl_object_id($data[$field])])) { |
@@ -2182,7 +2182,7 @@ discard block |
||
| 2182 | 2182 | $associatedId[$targetField] = $joinColumnValue; |
| 2183 | 2183 | } |
| 2184 | 2184 | |
| 2185 | - if (! $associatedId) { |
|
| 2185 | + if ( ! $associatedId) { |
|
| 2186 | 2186 | // Foreign key is NULL |
| 2187 | 2187 | $association->setValue($entity, null); |
| 2188 | 2188 | $this->originalEntityData[$oid][$field] = null; |
@@ -2191,7 +2191,7 @@ discard block |
||
| 2191 | 2191 | } |
| 2192 | 2192 | |
| 2193 | 2193 | // @todo guilhermeblanco Can we remove the need of this somehow? |
| 2194 | - if (! isset($hints['fetchMode'][$class->getClassName()][$field])) { |
|
| 2194 | + if ( ! isset($hints['fetchMode'][$class->getClassName()][$field])) { |
|
| 2195 | 2195 | $hints['fetchMode'][$class->getClassName()][$field] = $association->getFetchMode(); |
| 2196 | 2196 | } |
| 2197 | 2197 | |
@@ -2208,7 +2208,7 @@ discard block |
||
| 2208 | 2208 | // If this is an uninitialized proxy, we are deferring eager loads, |
| 2209 | 2209 | // this association is marked as eager fetch, and its an uninitialized proxy (wtf!) |
| 2210 | 2210 | // then we can append this entity for eager loading! |
| 2211 | - if (! $targetClass->isIdentifierComposite() && |
|
| 2211 | + if ( ! $targetClass->isIdentifierComposite() && |
|
| 2212 | 2212 | $newValue instanceof GhostObjectInterface && |
| 2213 | 2213 | isset($hints[self::HINT_DEFEREAGERLOAD]) && |
| 2214 | 2214 | $hints['fetchMode'][$class->getClassName()][$field] === FetchMode::EAGER && |
@@ -2291,7 +2291,7 @@ discard block |
||
| 2291 | 2291 | |
| 2292 | 2292 | public function triggerEagerLoads() : void |
| 2293 | 2293 | { |
| 2294 | - if (! $this->eagerLoadingEntities) { |
|
| 2294 | + if ( ! $this->eagerLoadingEntities) { |
|
| 2295 | 2295 | return; |
| 2296 | 2296 | } |
| 2297 | 2297 | |
@@ -2300,7 +2300,7 @@ discard block |
||
| 2300 | 2300 | $this->eagerLoadingEntities = []; |
| 2301 | 2301 | |
| 2302 | 2302 | foreach ($eagerLoadingEntities as $entityName => $ids) { |
| 2303 | - if (! $ids) { |
|
| 2303 | + if ( ! $ids) { |
|
| 2304 | 2304 | continue; |
| 2305 | 2305 | } |
| 2306 | 2306 | |
@@ -2586,7 +2586,7 @@ discard block |
||
| 2586 | 2586 | { |
| 2587 | 2587 | $class = $this->em->getClassMetadata(get_class($entity)); |
| 2588 | 2588 | |
| 2589 | - if (! $class->getProperty($propertyName)) { |
|
| 2589 | + if ( ! $class->getProperty($propertyName)) { |
|
| 2590 | 2590 | return; // ignore non-persistent fields |
| 2591 | 2591 | } |
| 2592 | 2592 | |
@@ -2595,7 +2595,7 @@ discard block |
||
| 2595 | 2595 | // Update changeset and mark entity for synchronization |
| 2596 | 2596 | $this->entityChangeSets[$oid][$propertyName] = [$oldValue, $newValue]; |
| 2597 | 2597 | |
| 2598 | - if (! isset($this->scheduledForSynchronization[$class->getRootClassName()][$oid])) { |
|
| 2598 | + if ( ! isset($this->scheduledForSynchronization[$class->getRootClassName()][$oid])) { |
|
| 2599 | 2599 | $this->scheduleForSynchronization($entity); |
| 2600 | 2600 | } |
| 2601 | 2601 | } |
@@ -2674,7 +2674,7 @@ discard block |
||
| 2674 | 2674 | */ |
| 2675 | 2675 | private static function objToStr(object $obj) : string |
| 2676 | 2676 | { |
| 2677 | - return method_exists($obj, '__toString') ? (string) $obj : get_class($obj) . '@' . spl_object_id($obj); |
|
| 2677 | + return method_exists($obj, '__toString') ? (string) $obj : get_class($obj).'@'.spl_object_id($obj); |
|
| 2678 | 2678 | } |
| 2679 | 2679 | |
| 2680 | 2680 | /** |
@@ -2688,7 +2688,7 @@ discard block |
||
| 2688 | 2688 | */ |
| 2689 | 2689 | public function markReadOnly(object $object) : void |
| 2690 | 2690 | { |
| 2691 | - if (! $this->isInIdentityMap($object)) { |
|
| 2691 | + if ( ! $this->isInIdentityMap($object)) { |
|
| 2692 | 2692 | throw ORMInvalidArgumentException::readOnlyRequiresManagedEntity($object); |
| 2693 | 2693 | } |
| 2694 | 2694 | |
@@ -2710,7 +2710,7 @@ discard block |
||
| 2710 | 2710 | */ |
| 2711 | 2711 | private function afterTransactionComplete() : void |
| 2712 | 2712 | { |
| 2713 | - $this->performCallbackOnCachedPersister(function (CachedPersister $persister) : void { |
|
| 2713 | + $this->performCallbackOnCachedPersister(function(CachedPersister $persister) : void { |
|
| 2714 | 2714 | $persister->afterTransactionComplete(); |
| 2715 | 2715 | }); |
| 2716 | 2716 | } |
@@ -2720,7 +2720,7 @@ discard block |
||
| 2720 | 2720 | */ |
| 2721 | 2721 | private function afterTransactionRolledBack() : void |
| 2722 | 2722 | { |
| 2723 | - $this->performCallbackOnCachedPersister(function (CachedPersister $persister) : void { |
|
| 2723 | + $this->performCallbackOnCachedPersister(function(CachedPersister $persister) : void { |
|
| 2724 | 2724 | $persister->afterTransactionRolledBack(); |
| 2725 | 2725 | }); |
| 2726 | 2726 | } |
@@ -2730,7 +2730,7 @@ discard block |
||
| 2730 | 2730 | */ |
| 2731 | 2731 | private function performCallbackOnCachedPersister(callable $callback) : void |
| 2732 | 2732 | { |
| 2733 | - if (! $this->hasCache) { |
|
| 2733 | + if ( ! $this->hasCache) { |
|
| 2734 | 2734 | return; |
| 2735 | 2735 | } |
| 2736 | 2736 | |
@@ -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 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | // association (table). Without initializing the collection. |
| 320 | 320 | $removed = parent::remove($key); |
| 321 | 321 | |
| 322 | - if (! $removed) { |
|
| 322 | + if ( ! $removed) { |
|
| 323 | 323 | return $removed; |
| 324 | 324 | } |
| 325 | 325 | |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | public function removeElement($element) : bool |
| 342 | 342 | { |
| 343 | - if (! $this->initialized && |
|
| 343 | + if ( ! $this->initialized && |
|
| 344 | 344 | $this->association !== null && |
| 345 | 345 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
| 346 | 346 | if ($this->collection->contains($element)) { |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | |
| 355 | 355 | $removed = parent::removeElement($element); |
| 356 | 356 | |
| 357 | - if (! $removed) { |
|
| 357 | + if ( ! $removed) { |
|
| 358 | 358 | return $removed; |
| 359 | 359 | } |
| 360 | 360 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function containsKey($key) : bool |
| 377 | 377 | { |
| 378 | - if (! $this->initialized && |
|
| 378 | + if ( ! $this->initialized && |
|
| 379 | 379 | $this->association !== null && |
| 380 | 380 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY && |
| 381 | 381 | $this->association->getIndexedBy()) { |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | public function contains($element) : bool |
| 394 | 394 | { |
| 395 | - if (! $this->initialized && |
|
| 395 | + if ( ! $this->initialized && |
|
| 396 | 396 | $this->association !== null && |
| 397 | 397 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
| 398 | 398 | $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); |
@@ -408,11 +408,11 @@ discard block |
||
| 408 | 408 | */ |
| 409 | 409 | public function get($key) |
| 410 | 410 | { |
| 411 | - if (! $this->initialized && |
|
| 411 | + if ( ! $this->initialized && |
|
| 412 | 412 | $this->association !== null && |
| 413 | 413 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY && |
| 414 | 414 | $this->association->getIndexedBy()) { |
| 415 | - if (! $this->typeClass->isIdentifierComposite() && $this->typeClass->isIdentifier($this->association->getIndexedBy())) { |
|
| 415 | + if ( ! $this->typeClass->isIdentifierComposite() && $this->typeClass->isIdentifier($this->association->getIndexedBy())) { |
|
| 416 | 416 | return $this->em->find($this->typeClass->getClassName(), $key); |
| 417 | 417 | } |
| 418 | 418 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | public function count() : int |
| 429 | 429 | { |
| 430 | - if (! $this->initialized && |
|
| 430 | + if ( ! $this->initialized && |
|
| 431 | 431 | $this->association !== null && |
| 432 | 432 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
| 433 | 433 | $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | */ |
| 492 | 492 | public function offsetSet($offset, $value) : void |
| 493 | 493 | { |
| 494 | - if (! isset($offset)) { |
|
| 494 | + if ( ! isset($offset)) { |
|
| 495 | 495 | $this->add($value); |
| 496 | 496 | return; |
| 497 | 497 | } |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | */ |
| 588 | 588 | public function slice($offset, $length = null) : array |
| 589 | 589 | { |
| 590 | - if (! $this->initialized && |
|
| 590 | + if ( ! $this->initialized && |
|
| 591 | 591 | ! $this->isDirty && |
| 592 | 592 | $this->association !== null && |
| 593 | 593 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
@@ -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\Tests\ORM; |
| 6 | 6 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | self::assertSame( |
| 163 | 163 | $value, |
| 164 | - $this->em->transactional(function ($em) use ($value) { |
|
| 164 | + $this->em->transactional(function($em) use ($value) { |
|
| 165 | 165 | return $value; |
| 166 | 166 | }) |
| 167 | 167 | ); |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | public function testTransactionalReThrowsThrowables() : void |
| 195 | 195 | { |
| 196 | 196 | try { |
| 197 | - $this->em->transactional(function () { |
|
| 198 | - (function (array $value) { |
|
| 197 | + $this->em->transactional(function() { |
|
| 198 | + (function(array $value) { |
|
| 199 | 199 | // this only serves as an IIFE that throws a `TypeError` |
| 200 | 200 | })(null); |
| 201 | 201 | }); |