@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function register($object) |
43 | 43 | { |
44 | - if (! is_object($object)) { |
|
44 | + if ( ! is_object($object)) { |
|
45 | 45 | throw new \InvalidArgumentException(sprintf('An object was expected, but got "%s".', gettype($object))); |
46 | 46 | } |
47 | 47 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public function generate(EntityManagerInterface $em, ?object $entity) |
18 | 18 | { |
19 | 19 | $conn = $em->getConnection(); |
20 | - $sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression(); |
|
20 | + $sql = 'SELECT '.$conn->getDatabasePlatform()->getGuidExpression(); |
|
21 | 21 | |
22 | 22 | return $conn->query($sql)->fetchColumn(0); |
23 | 23 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | public function executeDeferred(EntityManagerInterface $entityManager, object $entity) : void |
40 | 40 | { |
41 | 41 | foreach ($this->executors as $executor) { |
42 | - if (! $executor->isDeferred()) { |
|
42 | + if ( ! $executor->isDeferred()) { |
|
43 | 43 | continue; |
44 | 44 | } |
45 | 45 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | public function executeImmediate(EntityManagerInterface $entityManager, object $entity) : void |
26 | 26 | { |
27 | - if (! $this->executor->isDeferred()) { |
|
27 | + if ( ! $this->executor->isDeferred()) { |
|
28 | 28 | $this->dispatchExecutor($entity, $entityManager); |
29 | 29 | } |
30 | 30 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | $this->allocationSize |
59 | 59 | ); |
60 | 60 | |
61 | - if ($conn->executeUpdate($updateSql, [1 => $currentLevel, 2 => $currentLevel+1]) !== 1) { |
|
61 | + if ($conn->executeUpdate($updateSql, [1 => $currentLevel, 2 => $currentLevel + 1]) !== 1) { |
|
62 | 62 | // no affected rows, concurrency issue, throw exception |
63 | 63 | } |
64 | 64 | } else { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | if ($entityManager !== self::$entityManager) { |
79 | 79 | throw new \RuntimeException( |
80 | - 'Trying to use PersistentObject with different EntityManager instances. ' . |
|
80 | + 'Trying to use PersistentObject with different EntityManager instances. '. |
|
81 | 81 | 'Was PersistentObject::setEntityManager() called?' |
82 | 82 | ); |
83 | 83 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | |
103 | 103 | $property = $this->cm->getProperty($field); |
104 | 104 | |
105 | - if (! $property) { |
|
106 | - throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
105 | + if ( ! $property) { |
|
106 | + throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | switch (true) { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $targetClassName = $property->getTargetEntity(); |
116 | 116 | |
117 | 117 | if ($args[0] !== null && ! ($args[0] instanceof $targetClassName)) { |
118 | - throw new \InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
118 | + throw new \InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $this->{$field} = $args[0]; |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | |
142 | 142 | $property = $this->cm->getProperty($field); |
143 | 143 | |
144 | - if (! $property) { |
|
145 | - throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
144 | + if ( ! $property) { |
|
145 | + throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $this->{$field}; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $mappedByField = $property->getMappedBy(); |
165 | 165 | $targetMetadata = self::$entityManager->getClassMetadata($property->getTargetEntity()); |
166 | 166 | $targetProperty = $targetMetadata->getProperty($mappedByField); |
167 | - $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set') . $mappedByField; |
|
167 | + $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set').$mappedByField; |
|
168 | 168 | |
169 | 169 | $targetObject->{$setterMethodName}($this); |
170 | 170 | } |
@@ -186,21 +186,21 @@ discard block |
||
186 | 186 | |
187 | 187 | $property = $this->cm->getProperty($field); |
188 | 188 | |
189 | - if (! $property) { |
|
190 | - throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
189 | + if ( ! $property) { |
|
190 | + throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
191 | 191 | } |
192 | 192 | |
193 | - if (! ($property instanceof ToManyAssociationMetadata)) { |
|
194 | - throw new \BadMethodCallException('There is no method add' . $field . '() on ' . $this->cm->getClassName()); |
|
193 | + if ( ! ($property instanceof ToManyAssociationMetadata)) { |
|
194 | + throw new \BadMethodCallException('There is no method add'.$field.'() on '.$this->cm->getClassName()); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | $targetClassName = $property->getTargetEntity(); |
198 | 198 | |
199 | - if (! ($args[0] instanceof $targetClassName)) { |
|
200 | - throw new \InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
199 | + if ( ! ($args[0] instanceof $targetClassName)) { |
|
200 | + throw new \InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
201 | 201 | } |
202 | 202 | |
203 | - if (! ($this->{$field} instanceof Collection)) { |
|
203 | + if ( ! ($this->{$field} instanceof Collection)) { |
|
204 | 204 | $this->{$field} = new ArrayCollection($this->{$field} ?: []); |
205 | 205 | } |
206 | 206 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | return; |
223 | 223 | } |
224 | 224 | |
225 | - if (! self::$entityManager) { |
|
225 | + if ( ! self::$entityManager) { |
|
226 | 226 | throw new \RuntimeException('No runtime entity manager set. Call PersistentObject#setEntityManager().'); |
227 | 227 | } |
228 | 228 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | return $this->add($field, $args); |
256 | 256 | |
257 | 257 | default: |
258 | - throw new \BadMethodCallException('There is no method ' . $method . ' on ' . $this->cm->getClassName()); |
|
258 | + throw new \BadMethodCallException('There is no method '.$method.' on '.$this->cm->getClassName()); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | { |
290 | 290 | $query = new Query($this); |
291 | 291 | |
292 | - if (! empty($dql)) { |
|
292 | + if ( ! empty($dql)) { |
|
293 | 293 | $query->setDQL($dql); |
294 | 294 | } |
295 | 295 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\')); |
380 | 380 | $className = $class->getClassName(); |
381 | 381 | |
382 | - if (! is_array($id)) { |
|
382 | + if ( ! is_array($id)) { |
|
383 | 383 | if ($class->isIdentifierComposite()) { |
384 | 384 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
385 | 385 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $sortedId = []; |
401 | 401 | |
402 | 402 | foreach ($class->identifier as $identifier) { |
403 | - if (! isset($id[$identifier])) { |
|
403 | + if ( ! isset($id[$identifier])) { |
|
404 | 404 | throw MissingIdentifierField::fromFieldAndClass($identifier, $className); |
405 | 405 | } |
406 | 406 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | // Check identity map first |
418 | 418 | $entity = $unitOfWork->tryGetById($sortedId, $class->getRootClassName()); |
419 | 419 | if ($entity !== false) { |
420 | - if (! ($entity instanceof $className)) { |
|
420 | + if ( ! ($entity instanceof $className)) { |
|
421 | 421 | return null; |
422 | 422 | } |
423 | 423 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | |
442 | 442 | switch (true) { |
443 | 443 | case $lockMode === LockMode::OPTIMISTIC: |
444 | - if (! $class->isVersioned()) { |
|
444 | + if ( ! $class->isVersioned()) { |
|
445 | 445 | throw OptimisticLockException::notVersioned($className); |
446 | 446 | } |
447 | 447 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | |
454 | 454 | case $lockMode === LockMode::PESSIMISTIC_READ: |
455 | 455 | case $lockMode === LockMode::PESSIMISTIC_WRITE: |
456 | - if (! $this->getConnection()->isTransactionActive()) { |
|
456 | + if ( ! $this->getConnection()->isTransactionActive()) { |
|
457 | 457 | throw TransactionRequiredException::transactionRequired(); |
458 | 458 | } |
459 | 459 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\')); |
473 | 473 | $className = $class->getClassName(); |
474 | 474 | |
475 | - if (! is_array($id)) { |
|
475 | + if ( ! is_array($id)) { |
|
476 | 476 | if ($class->isIdentifierComposite()) { |
477 | 477 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
478 | 478 | } |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $sortedId = []; |
498 | 498 | |
499 | 499 | foreach ($class->identifier as $identifier) { |
500 | - if (! isset($scalarId[$identifier])) { |
|
500 | + if ( ! isset($scalarId[$identifier])) { |
|
501 | 501 | throw MissingIdentifierField::fromFieldAndClass($identifier, $className); |
502 | 502 | } |
503 | 503 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\')); |
539 | 539 | $className = $class->getClassName(); |
540 | 540 | |
541 | - if (! is_array($id)) { |
|
541 | + if ( ! is_array($id)) { |
|
542 | 542 | if ($class->isIdentifierComposite()) { |
543 | 543 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
544 | 544 | } |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | $sortedId = []; |
560 | 560 | |
561 | 561 | foreach ($class->identifier as $identifier) { |
562 | - if (! isset($id[$identifier])) { |
|
562 | + if ( ! isset($id[$identifier])) { |
|
563 | 563 | throw MissingIdentifierField::fromFieldAndClass($identifier, $className); |
564 | 564 | } |
565 | 565 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | */ |
633 | 633 | public function persist($entity) |
634 | 634 | { |
635 | - if (! is_object($entity)) { |
|
635 | + if ( ! is_object($entity)) { |
|
636 | 636 | throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()', $entity); |
637 | 637 | } |
638 | 638 | |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | */ |
655 | 655 | public function remove($entity) |
656 | 656 | { |
657 | - if (! is_object($entity)) { |
|
657 | + if ( ! is_object($entity)) { |
|
658 | 658 | throw ORMInvalidArgumentException::invalidObject('EntityManager#remove()', $entity); |
659 | 659 | } |
660 | 660 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | */ |
675 | 675 | public function refresh($entity) |
676 | 676 | { |
677 | - if (! is_object($entity)) { |
|
677 | + if ( ! is_object($entity)) { |
|
678 | 678 | throw ORMInvalidArgumentException::invalidObject('EntityManager#refresh()', $entity); |
679 | 679 | } |
680 | 680 | |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | */ |
830 | 830 | public static function create($connection, Configuration $config, ?EventManager $eventManager = null) |
831 | 831 | { |
832 | - if (! $config->getMetadataDriverImpl()) { |
|
832 | + if ( ! $config->getMetadataDriverImpl()) { |
|
833 | 833 | throw MissingMappingDriverImplementation::create(); |
834 | 834 | } |
835 | 835 | |
@@ -856,12 +856,12 @@ discard block |
||
856 | 856 | return DriverManager::getConnection($connection, $config, $eventManager ?: new EventManager()); |
857 | 857 | } |
858 | 858 | |
859 | - if (! $connection instanceof Connection) { |
|
859 | + if ( ! $connection instanceof Connection) { |
|
860 | 860 | throw new \InvalidArgumentException( |
861 | 861 | sprintf( |
862 | 862 | 'Invalid $connection argument of type %s given%s.', |
863 | 863 | is_object($connection) ? get_class($connection) : gettype($connection), |
864 | - is_object($connection) ? '' : ': "' . $connection . '"' |
|
864 | + is_object($connection) ? '' : ': "'.$connection.'"' |
|
865 | 865 | ) |
866 | 866 | ); |
867 | 867 | } |
@@ -99,7 +99,7 @@ |
||
99 | 99 | */ |
100 | 100 | private function assertValidField($field) |
101 | 101 | { |
102 | - if (! isset($this->entityChangeSet[$field])) { |
|
102 | + if ( ! isset($this->entityChangeSet[$field])) { |
|
103 | 103 | throw new \InvalidArgumentException(sprintf( |
104 | 104 | 'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.', |
105 | 105 | $field, |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $normalizedAssociatedId = []; |
36 | 36 | |
37 | 37 | foreach ($targetClass->getDeclaredPropertiesIterator() as $name => $declaredProperty) { |
38 | - if (! array_key_exists($name, $flatIdentifier)) { |
|
38 | + if ( ! array_key_exists($name, $flatIdentifier)) { |
|
39 | 39 | continue; |
40 | 40 | } |
41 | 41 |