@@ -60,7 +60,7 @@ |
||
60 | 60 | $metadata = $it->current(); |
61 | 61 | |
62 | 62 | foreach ($this->filter as $filter) { |
63 | - $pregResult = preg_match('/' . $filter . '/', $metadata->getClassName()); |
|
63 | + $pregResult = preg_match('/'.$filter.'/', $metadata->getClassName()); |
|
64 | 64 | |
65 | 65 | if ($pregResult === false) { |
66 | 66 | throw new RuntimeException( |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $ce = []; |
80 | 80 | |
81 | 81 | foreach ($class->getDeclaredPropertiesIterator() as $fieldName => $association) { |
82 | - if (! ($association instanceof AssociationMetadata)) { |
|
82 | + if ( ! ($association instanceof AssociationMetadata)) { |
|
83 | 83 | continue; |
84 | 84 | } |
85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | foreach ($class->getSubClasses() as $subClass) { |
90 | - if (! in_array($class->getClassName(), class_parents($subClass), true)) { |
|
90 | + if ( ! in_array($class->getClassName(), class_parents($subClass), true)) { |
|
91 | 91 | $message = "According to the discriminator map class, '%s' has to be a child of '%s', but these entities are not related through inheritance."; |
92 | 92 | |
93 | 93 | $ce[] = sprintf($message, $subClass, $class->getClassName()); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $fieldName = $association->getName(); |
107 | 107 | $targetEntity = $association->getTargetEntity(); |
108 | 108 | |
109 | - if (! class_exists($targetEntity) || $metadataFactory->isTransient($targetEntity)) { |
|
109 | + if ( ! class_exists($targetEntity) || $metadataFactory->isTransient($targetEntity)) { |
|
110 | 110 | $message = "The target entity '%s' specified on %s#%s is unknown or not an entity."; |
111 | 111 | |
112 | 112 | return [sprintf($message, $targetEntity, $class->getClassName(), $fieldName)]; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | /** @var ClassMetadata $targetMetadata */ |
127 | 127 | $targetMetadata = $metadataFactory->getMetadataFor($targetEntity); |
128 | - $containsForeignId = array_filter($targetMetadata->identifier, static function ($identifier) use ($targetMetadata) { |
|
128 | + $containsForeignId = array_filter($targetMetadata->identifier, static function($identifier) use ($targetMetadata) { |
|
129 | 129 | $targetProperty = $targetMetadata->getProperty($identifier); |
130 | 130 | |
131 | 131 | return $targetProperty instanceof AssociationMetadata; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | /** @var AssociationMetadata $targetAssociation */ |
142 | 142 | $targetAssociation = $targetMetadata->getProperty($mappedBy); |
143 | 143 | |
144 | - if (! $targetAssociation) { |
|
144 | + if ( ! $targetAssociation) { |
|
145 | 145 | $message = 'The association %s#%s refers to the owning side property %s#%s which does not exist.'; |
146 | 146 | |
147 | 147 | $ce[] = sprintf($message, $class->getClassName(), $fieldName, $targetEntity, $mappedBy); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | /** @var AssociationMetadata $targetAssociation */ |
166 | 166 | $targetAssociation = $targetMetadata->getProperty($inversedBy); |
167 | 167 | |
168 | - if (! $targetAssociation) { |
|
168 | + if ( ! $targetAssociation) { |
|
169 | 169 | $message = 'The association %s#%s refers to the inverse side property %s#%s which does not exist.'; |
170 | 170 | |
171 | 171 | $ce[] = sprintf($message, $class->getClassName(), $fieldName, $targetEntity, $inversedBy); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $joinTable = $association->getJoinTable(); |
210 | 210 | |
211 | 211 | foreach ($joinTable->getJoinColumns() as $joinColumn) { |
212 | - if (! in_array($joinColumn->getReferencedColumnName(), $classIdentifierColumns, true)) { |
|
212 | + if ( ! in_array($joinColumn->getReferencedColumnName(), $classIdentifierColumns, true)) { |
|
213 | 213 | $message = "The referenced column name '%s' has to be a primary key column on the target entity class '%s'."; |
214 | 214 | |
215 | 215 | $ce[] = sprintf($message, $joinColumn->getReferencedColumnName(), $class->getClassName()); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | foreach ($joinTable->getInverseJoinColumns() as $inverseJoinColumn) { |
221 | - if (! in_array($inverseJoinColumn->getReferencedColumnName(), $targetIdentifierColumns, true)) { |
|
221 | + if ( ! in_array($inverseJoinColumn->getReferencedColumnName(), $targetIdentifierColumns, true)) { |
|
222 | 222 | $message = "The referenced column name '%s' has to be a primary key column on the target entity class '%s'."; |
223 | 223 | |
224 | 224 | $ce[] = sprintf($message, $inverseJoinColumn->getReferencedColumnName(), $targetMetadata->getClassName()); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | if (count($targetIdentifierColumns) !== count($joinTable->getInverseJoinColumns())) { |
230 | 230 | $columnNames = array_map( |
231 | - static function (JoinColumnMetadata $joinColumn) { |
|
231 | + static function(JoinColumnMetadata $joinColumn) { |
|
232 | 232 | return $joinColumn->getReferencedColumnName(); |
233 | 233 | }, |
234 | 234 | $joinTable->getInverseJoinColumns() |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | if (count($classIdentifierColumns) !== count($joinTable->getJoinColumns())) { |
245 | 245 | $columnNames = array_map( |
246 | - static function (JoinColumnMetadata $joinColumn) { |
|
246 | + static function(JoinColumnMetadata $joinColumn) { |
|
247 | 247 | return $joinColumn->getReferencedColumnName(); |
248 | 248 | }, |
249 | 249 | $joinTable->getJoinColumns() |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $joinColumns = $association->getJoinColumns(); |
261 | 261 | |
262 | 262 | foreach ($joinColumns as $joinColumn) { |
263 | - if (! in_array($joinColumn->getReferencedColumnName(), $identifierColumns, true)) { |
|
263 | + if ( ! in_array($joinColumn->getReferencedColumnName(), $identifierColumns, true)) { |
|
264 | 264 | $message = "The referenced column name '%s' has to be a primary key column on the target entity class '%s'."; |
265 | 265 | |
266 | 266 | $ce[] = sprintf($message, $joinColumn->getReferencedColumnName(), $targetMetadata->getClassName()); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | continue; |
292 | 292 | } |
293 | 293 | |
294 | - if (! ($targetProperty instanceof AssociationMetadata)) { |
|
294 | + if ( ! ($targetProperty instanceof AssociationMetadata)) { |
|
295 | 295 | $message = "The association %s#%s is ordered by a property '%s' that is non-existing field on the target entity '%s'."; |
296 | 296 | |
297 | 297 | $ce[] = sprintf($message, $class->getClassName(), $fieldName, $orderField, $targetMetadata->getClassName()); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | |
341 | 341 | $this->computeChangeSets(); |
342 | 342 | |
343 | - if (! ($this->entityInsertions || |
|
343 | + if ( ! ($this->entityInsertions || |
|
344 | 344 | $this->entityDeletions || |
345 | 345 | $this->entityUpdates || |
346 | 346 | $this->collectionUpdates || |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | // Entity deletions come last and need to be in reverse commit order |
400 | 400 | if ($this->entityDeletions) { |
401 | 401 | foreach (array_reverse($commitOrder) as $committedEntityName) { |
402 | - if (! $this->entityDeletions) { |
|
402 | + if ( ! $this->entityDeletions) { |
|
403 | 403 | break; // just a performance optimisation |
404 | 404 | } |
405 | 405 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | $oid = spl_object_id($entity); |
483 | 483 | $data = []; |
484 | 484 | |
485 | - if (! isset($this->entityChangeSets[$oid])) { |
|
485 | + if ( ! isset($this->entityChangeSets[$oid])) { |
|
486 | 486 | return $data; |
487 | 487 | } |
488 | 488 | |
@@ -562,12 +562,12 @@ discard block |
||
562 | 562 | || ! $class->getProperty($name) instanceof FieldMetadata |
563 | 563 | || ! $class->getProperty($name)->hasValueGenerator() |
564 | 564 | || $class->getProperty($name)->getValueGenerator()->getType() !== GeneratorType::IDENTITY |
565 | - ) && (! $class->isVersioned() || $name !== $class->versionProperty->getName())) { |
|
565 | + ) && ( ! $class->isVersioned() || $name !== $class->versionProperty->getName())) { |
|
566 | 566 | $actualData[$name] = $value; |
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | - if (! isset($this->originalEntityData[$oid])) { |
|
570 | + if ( ! isset($this->originalEntityData[$oid])) { |
|
571 | 571 | // Entity is either NEW or MANAGED but not yet fully persisted (only has an id). |
572 | 572 | // These result in an INSERT. |
573 | 573 | $this->originalEntityData[$oid] = $actualData; |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | |
595 | 595 | foreach ($actualData as $propName => $actualValue) { |
596 | 596 | // skip field, its a partially omitted one! |
597 | - if (! (isset($originalData[$propName]) || array_key_exists($propName, $originalData))) { |
|
597 | + if ( ! (isset($originalData[$propName]) || array_key_exists($propName, $originalData))) { |
|
598 | 598 | continue; |
599 | 599 | } |
600 | 600 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | if ($owner === null) { // cloned |
617 | 617 | $actualValue->setOwner($entity, $property); |
618 | 618 | } elseif ($owner !== $entity) { // no clone, we have to fix |
619 | - if (! $actualValue->isInitialized()) { |
|
619 | + if ( ! $actualValue->isInitialized()) { |
|
620 | 620 | $actualValue->initialize(); // we have to do this otherwise the cols share state |
621 | 621 | } |
622 | 622 | |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | // Check if original value exists |
655 | 655 | if ($orgValue instanceof PersistentCollection) { |
656 | 656 | // A PersistentCollection was de-referenced, so delete it. |
657 | - if (! $this->isCollectionScheduledForDeletion($orgValue)) { |
|
657 | + if ( ! $this->isCollectionScheduledForDeletion($orgValue)) { |
|
658 | 658 | $this->scheduleCollectionDeletion($orgValue); |
659 | 659 | |
660 | 660 | $changeSet[$propName] = $orgValue; // Signal changeset, to-many associations will be ignored |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | |
678 | 678 | // Look for changes in associations of the entity |
679 | 679 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
680 | - if (! $property instanceof AssociationMetadata) { |
|
680 | + if ( ! $property instanceof AssociationMetadata) { |
|
681 | 681 | continue; |
682 | 682 | } |
683 | 683 | |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | // Only MANAGED entities that are NOT SCHEDULED FOR INSERTION OR DELETION are processed here. |
745 | 745 | $oid = spl_object_id($entity); |
746 | 746 | |
747 | - if (! isset($this->entityInsertions[$oid]) && ! isset($this->entityDeletions[$oid]) && isset($this->entityStates[$oid])) { |
|
747 | + if ( ! isset($this->entityInsertions[$oid]) && ! isset($this->entityDeletions[$oid]) && isset($this->entityStates[$oid])) { |
|
748 | 748 | $this->computeChangeSet($class, $entity); |
749 | 749 | } |
750 | 750 | } |
@@ -781,13 +781,13 @@ discard block |
||
781 | 781 | $targetClass = $this->em->getClassMetadata($targetEntity); |
782 | 782 | |
783 | 783 | foreach ($unwrappedValue as $key => $entry) { |
784 | - if (! ($entry instanceof $targetEntity)) { |
|
784 | + if ( ! ($entry instanceof $targetEntity)) { |
|
785 | 785 | throw ORMInvalidArgumentException::invalidAssociation($targetClass, $association, $entry); |
786 | 786 | } |
787 | 787 | |
788 | 788 | $state = $this->getEntityState($entry, self::STATE_NEW); |
789 | 789 | |
790 | - if (! ($entry instanceof $targetEntity)) { |
|
790 | + if ( ! ($entry instanceof $targetEntity)) { |
|
791 | 791 | throw UnexpectedAssociationValue::create( |
792 | 792 | $association->getSourceEntity(), |
793 | 793 | $association->getName(), |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | |
799 | 799 | switch ($state) { |
800 | 800 | case self::STATE_NEW: |
801 | - if (! in_array('persist', $association->getCascade(), true)) { |
|
801 | + if ( ! in_array('persist', $association->getCascade(), true)) { |
|
802 | 802 | $this->nonCascadedNewDetectedEntities[spl_object_id($entry)] = [$association, $entry]; |
803 | 803 | |
804 | 804 | break; |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | $persister = $this->getEntityPersister($class->getClassName()); |
848 | 848 | $generationPlan->executeImmediate($this->em, $entity); |
849 | 849 | |
850 | - if (! $generationPlan->containsDeferred()) { |
|
850 | + if ( ! $generationPlan->containsDeferred()) { |
|
851 | 851 | $id = $this->em->getIdentifierFlattener()->flattenIdentifier($class, $persister->getIdentifier($entity)); |
852 | 852 | $this->entityIdentifiers[$oid] = $id; |
853 | 853 | } |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | { |
879 | 879 | $oid = spl_object_id($entity); |
880 | 880 | |
881 | - if (! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) { |
|
881 | + if ( ! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) { |
|
882 | 882 | throw ORMInvalidArgumentException::entityNotManaged($entity); |
883 | 883 | } |
884 | 884 | |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | break; |
901 | 901 | |
902 | 902 | case $property instanceof FieldMetadata: |
903 | - if (! $property->isPrimaryKey() |
|
903 | + if ( ! $property->isPrimaryKey() |
|
904 | 904 | || ! $property->getValueGenerator() |
905 | 905 | || $property->getValueGenerator()->getType() !== GeneratorType::IDENTITY) { |
906 | 906 | $actualData[$name] = $property->getValue($entity); |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | } |
915 | 915 | } |
916 | 916 | |
917 | - if (! isset($this->originalEntityData[$oid])) { |
|
917 | + if ( ! isset($this->originalEntityData[$oid])) { |
|
918 | 918 | throw new RuntimeException('Cannot call recomputeSingleEntityChangeSet before computeChangeSet on an entity.'); |
919 | 919 | } |
920 | 920 | |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | if ($changeSet) { |
933 | 933 | if (isset($this->entityChangeSets[$oid])) { |
934 | 934 | $this->entityChangeSets[$oid] = array_merge($this->entityChangeSets[$oid], $changeSet); |
935 | - } elseif (! isset($this->entityInsertions[$oid])) { |
|
935 | + } elseif ( ! isset($this->entityInsertions[$oid])) { |
|
936 | 936 | $this->entityChangeSets[$oid] = $changeSet; |
937 | 937 | $this->entityUpdates[$oid] = $entity; |
938 | 938 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | $this->recomputeSingleEntityChangeSet($class, $entity); |
1003 | 1003 | } |
1004 | 1004 | |
1005 | - if (! empty($this->entityChangeSets[$oid])) { |
|
1005 | + if ( ! empty($this->entityChangeSets[$oid])) { |
|
1006 | 1006 | // echo 'Update: '; |
1007 | 1007 | // \Doctrine\Common\Util\Debug::dump($this->entityChangeSets[$oid], 3); |
1008 | 1008 | |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | // Entity with this $oid after deletion treated as NEW, even if the $oid |
1046 | 1046 | // is obtained by a new entity because the old one went out of scope. |
1047 | 1047 | //$this->entityStates[$oid] = self::STATE_NEW; |
1048 | - if (! $class->isIdentifierComposite()) { |
|
1048 | + if ( ! $class->isIdentifierComposite()) { |
|
1049 | 1049 | $property = $class->getProperty($class->getSingleIdentifierFieldName()); |
1050 | 1050 | |
1051 | 1051 | if ($property instanceof FieldMetadata && $property->hasValueGenerator()) { |
@@ -1092,13 +1092,13 @@ discard block |
||
1092 | 1092 | // Calculate dependencies for new nodes |
1093 | 1093 | while ($class = array_pop($newNodes)) { |
1094 | 1094 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
1095 | - if (! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) { |
|
1095 | + if ( ! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) { |
|
1096 | 1096 | continue; |
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | $targetClass = $this->em->getClassMetadata($property->getTargetEntity()); |
1100 | 1100 | |
1101 | - if (! $calc->hasNode($targetClass->getClassName())) { |
|
1101 | + if ( ! $calc->hasNode($targetClass->getClassName())) { |
|
1102 | 1102 | $calc->addNode($targetClass->getClassName(), $targetClass); |
1103 | 1103 | |
1104 | 1104 | $newNodes[] = $targetClass; |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | |
1107 | 1107 | $weight = ! array_filter( |
1108 | 1108 | $property->getJoinColumns(), |
1109 | - static function (JoinColumnMetadata $joinColumn) { |
|
1109 | + static function(JoinColumnMetadata $joinColumn) { |
|
1110 | 1110 | return $joinColumn->isNullable(); |
1111 | 1111 | } |
1112 | 1112 | ); |
@@ -1114,14 +1114,14 @@ discard block |
||
1114 | 1114 | $calc->addDependency($targetClass->getClassName(), $class->getClassName(), $weight); |
1115 | 1115 | |
1116 | 1116 | // If the target class has mapped subclasses, these share the same dependency. |
1117 | - if (! $targetClass->getSubClasses()) { |
|
1117 | + if ( ! $targetClass->getSubClasses()) { |
|
1118 | 1118 | continue; |
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | foreach ($targetClass->getSubClasses() as $subClassName) { |
1122 | 1122 | $targetSubClass = $this->em->getClassMetadata($subClassName); |
1123 | 1123 | |
1124 | - if (! $calc->hasNode($subClassName)) { |
|
1124 | + if ( ! $calc->hasNode($subClassName)) { |
|
1125 | 1125 | $calc->addNode($targetSubClass->getClassName(), $targetSubClass); |
1126 | 1126 | |
1127 | 1127 | $newNodes[] = $targetSubClass; |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | { |
1198 | 1198 | $oid = spl_object_id($entity); |
1199 | 1199 | |
1200 | - if (! isset($this->entityIdentifiers[$oid])) { |
|
1200 | + if ( ! isset($this->entityIdentifiers[$oid])) { |
|
1201 | 1201 | throw ORMInvalidArgumentException::entityHasNoIdentity($entity, 'scheduling for update'); |
1202 | 1202 | } |
1203 | 1203 | |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | throw ORMInvalidArgumentException::entityIsRemoved($entity, 'schedule for update'); |
1206 | 1206 | } |
1207 | 1207 | |
1208 | - if (! isset($this->entityUpdates[$oid]) && ! isset($this->entityInsertions[$oid])) { |
|
1208 | + if ( ! isset($this->entityUpdates[$oid]) && ! isset($this->entityInsertions[$oid])) { |
|
1209 | 1209 | $this->entityUpdates[$oid] = $entity; |
1210 | 1210 | } |
1211 | 1211 | } |
@@ -1280,7 +1280,7 @@ discard block |
||
1280 | 1280 | return; // entity has not been persisted yet, so nothing more to do. |
1281 | 1281 | } |
1282 | 1282 | |
1283 | - if (! $this->isInIdentityMap($entity)) { |
|
1283 | + if ( ! $this->isInIdentityMap($entity)) { |
|
1284 | 1284 | return; |
1285 | 1285 | } |
1286 | 1286 | |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | |
1289 | 1289 | unset($this->entityUpdates[$oid]); |
1290 | 1290 | |
1291 | - if (! isset($this->entityDeletions[$oid])) { |
|
1291 | + if ( ! isset($this->entityDeletions[$oid])) { |
|
1292 | 1292 | $this->entityDeletions[$oid] = $entity; |
1293 | 1293 | $this->entityStates[$oid] = self::STATE_REMOVED; |
1294 | 1294 | } |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | $persister = $this->getEntityPersister($class->getClassName()); |
1391 | 1391 | $id = $persister->getIdentifier($entity); |
1392 | 1392 | |
1393 | - if (! $id) { |
|
1393 | + if ( ! $id) { |
|
1394 | 1394 | return self::STATE_NEW; |
1395 | 1395 | } |
1396 | 1396 | |
@@ -1750,7 +1750,7 @@ discard block |
||
1750 | 1750 | $class = $this->em->getClassMetadata(get_class($entity)); |
1751 | 1751 | |
1752 | 1752 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
1753 | - if (! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade(), true))) { |
|
1753 | + if ( ! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade(), true))) { |
|
1754 | 1754 | continue; |
1755 | 1755 | } |
1756 | 1756 | |
@@ -1797,7 +1797,7 @@ discard block |
||
1797 | 1797 | } |
1798 | 1798 | |
1799 | 1799 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
1800 | - if (! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade(), true))) { |
|
1800 | + if ( ! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade(), true))) { |
|
1801 | 1801 | continue; |
1802 | 1802 | } |
1803 | 1803 | |
@@ -1813,7 +1813,7 @@ discard block |
||
1813 | 1813 | |
1814 | 1814 | case $relatedEntities instanceof Collection: |
1815 | 1815 | case is_array($relatedEntities): |
1816 | - if (! ($association instanceof ToManyAssociationMetadata)) { |
|
1816 | + if ( ! ($association instanceof ToManyAssociationMetadata)) { |
|
1817 | 1817 | throw ORMInvalidArgumentException::invalidAssociation( |
1818 | 1818 | $this->em->getClassMetadata($targetEntity), |
1819 | 1819 | $association, |
@@ -1828,7 +1828,7 @@ discard block |
||
1828 | 1828 | break; |
1829 | 1829 | |
1830 | 1830 | case $relatedEntities !== null: |
1831 | - if (! $relatedEntities instanceof $targetEntity) { |
|
1831 | + if ( ! $relatedEntities instanceof $targetEntity) { |
|
1832 | 1832 | throw ORMInvalidArgumentException::invalidAssociation( |
1833 | 1833 | $this->em->getClassMetadata($targetEntity), |
1834 | 1834 | $association, |
@@ -1857,7 +1857,7 @@ discard block |
||
1857 | 1857 | $class = $this->em->getClassMetadata(get_class($entity)); |
1858 | 1858 | |
1859 | 1859 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
1860 | - if (! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade(), true))) { |
|
1860 | + if ( ! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade(), true))) { |
|
1861 | 1861 | continue; |
1862 | 1862 | } |
1863 | 1863 | |
@@ -1916,7 +1916,7 @@ discard block |
||
1916 | 1916 | |
1917 | 1917 | switch (true) { |
1918 | 1918 | case $lockMode === LockMode::OPTIMISTIC: |
1919 | - if (! $class->isVersioned()) { |
|
1919 | + if ( ! $class->isVersioned()) { |
|
1920 | 1920 | throw OptimisticLockException::notVersioned($class->getClassName()); |
1921 | 1921 | } |
1922 | 1922 | |
@@ -1939,7 +1939,7 @@ discard block |
||
1939 | 1939 | case $lockMode === LockMode::NONE: |
1940 | 1940 | case $lockMode === LockMode::PESSIMISTIC_READ: |
1941 | 1941 | case $lockMode === LockMode::PESSIMISTIC_WRITE: |
1942 | - if (! $this->em->getConnection()->isTransactionActive()) { |
|
1942 | + if ( ! $this->em->getConnection()->isTransactionActive()) { |
|
1943 | 1943 | throw TransactionRequiredException::transactionRequired(); |
1944 | 1944 | } |
1945 | 1945 | |
@@ -2097,7 +2097,7 @@ discard block |
||
2097 | 2097 | $entity->addPropertyChangedListener($this); |
2098 | 2098 | } |
2099 | 2099 | } else { |
2100 | - if (! isset($hints[Query::HINT_REFRESH]) |
|
2100 | + if ( ! isset($hints[Query::HINT_REFRESH]) |
|
2101 | 2101 | || (isset($hints[Query::HINT_REFRESH_ENTITY]) && $hints[Query::HINT_REFRESH_ENTITY] !== $entity)) { |
2102 | 2102 | return $entity; |
2103 | 2103 | } |
@@ -2145,7 +2145,7 @@ discard block |
||
2145 | 2145 | } |
2146 | 2146 | |
2147 | 2147 | foreach ($class->getDeclaredPropertiesIterator() as $field => $association) { |
2148 | - if (! ($association instanceof AssociationMetadata)) { |
|
2148 | + if ( ! ($association instanceof AssociationMetadata)) { |
|
2149 | 2149 | continue; |
2150 | 2150 | } |
2151 | 2151 | |
@@ -2194,7 +2194,7 @@ discard block |
||
2194 | 2194 | continue; |
2195 | 2195 | } |
2196 | 2196 | |
2197 | - if (! $association->isOwningSide()) { |
|
2197 | + if ( ! $association->isOwningSide()) { |
|
2198 | 2198 | // use the given entity association |
2199 | 2199 | if (isset($data[$field]) && is_object($data[$field]) && |
2200 | 2200 | isset($this->entityStates[spl_object_id($data[$field])])) { |
@@ -2244,7 +2244,7 @@ discard block |
||
2244 | 2244 | $associatedId[$targetField] = $joinColumnValue; |
2245 | 2245 | } |
2246 | 2246 | |
2247 | - if (! $associatedId) { |
|
2247 | + if ( ! $associatedId) { |
|
2248 | 2248 | // Foreign key is NULL |
2249 | 2249 | $association->setValue($entity, null); |
2250 | 2250 | $this->originalEntityData[$oid][$field] = null; |
@@ -2253,7 +2253,7 @@ discard block |
||
2253 | 2253 | } |
2254 | 2254 | |
2255 | 2255 | // @todo guilhermeblanco Can we remove the need of this somehow? |
2256 | - if (! isset($hints['fetchMode'][$class->getClassName()][$field])) { |
|
2256 | + if ( ! isset($hints['fetchMode'][$class->getClassName()][$field])) { |
|
2257 | 2257 | $hints['fetchMode'][$class->getClassName()][$field] = $association->getFetchMode(); |
2258 | 2258 | } |
2259 | 2259 | |
@@ -2270,7 +2270,7 @@ discard block |
||
2270 | 2270 | // If this is an uninitialized proxy, we are deferring eager loads, |
2271 | 2271 | // this association is marked as eager fetch, and its an uninitialized proxy (wtf!) |
2272 | 2272 | // then we can append this entity for eager loading! |
2273 | - if (! $targetClass->isIdentifierComposite() && |
|
2273 | + if ( ! $targetClass->isIdentifierComposite() && |
|
2274 | 2274 | $newValue instanceof GhostObjectInterface && |
2275 | 2275 | isset($hints[self::HINT_DEFEREAGERLOAD]) && |
2276 | 2276 | $hints['fetchMode'][$class->getClassName()][$field] === FetchMode::EAGER && |
@@ -2353,7 +2353,7 @@ discard block |
||
2353 | 2353 | |
2354 | 2354 | public function triggerEagerLoads() |
2355 | 2355 | { |
2356 | - if (! $this->eagerLoadingEntities) { |
|
2356 | + if ( ! $this->eagerLoadingEntities) { |
|
2357 | 2357 | return; |
2358 | 2358 | } |
2359 | 2359 | |
@@ -2362,7 +2362,7 @@ discard block |
||
2362 | 2362 | $this->eagerLoadingEntities = []; |
2363 | 2363 | |
2364 | 2364 | foreach ($eagerLoadingEntities as $entityName => $ids) { |
2365 | - if (! $ids) { |
|
2365 | + if ( ! $ids) { |
|
2366 | 2366 | continue; |
2367 | 2367 | } |
2368 | 2368 | |
@@ -2660,7 +2660,7 @@ discard block |
||
2660 | 2660 | { |
2661 | 2661 | $class = $this->em->getClassMetadata(get_class($entity)); |
2662 | 2662 | |
2663 | - if (! $class->getProperty($propertyName)) { |
|
2663 | + if ( ! $class->getProperty($propertyName)) { |
|
2664 | 2664 | return; // ignore non-persistent fields |
2665 | 2665 | } |
2666 | 2666 | |
@@ -2669,7 +2669,7 @@ discard block |
||
2669 | 2669 | // Update changeset and mark entity for synchronization |
2670 | 2670 | $this->entityChangeSets[$oid][$propertyName] = [$oldValue, $newValue]; |
2671 | 2671 | |
2672 | - if (! isset($this->scheduledForSynchronization[$class->getRootClassName()][$oid])) { |
|
2672 | + if ( ! isset($this->scheduledForSynchronization[$class->getRootClassName()][$oid])) { |
|
2673 | 2673 | $this->scheduleForSynchronization($entity); |
2674 | 2674 | } |
2675 | 2675 | } |
@@ -2751,7 +2751,7 @@ discard block |
||
2751 | 2751 | */ |
2752 | 2752 | private static function objToStr($obj) |
2753 | 2753 | { |
2754 | - return method_exists($obj, '__toString') ? (string) $obj : get_class($obj) . '@' . spl_object_id($obj); |
|
2754 | + return method_exists($obj, '__toString') ? (string) $obj : get_class($obj).'@'.spl_object_id($obj); |
|
2755 | 2755 | } |
2756 | 2756 | |
2757 | 2757 | /** |
@@ -2766,7 +2766,7 @@ discard block |
||
2766 | 2766 | */ |
2767 | 2767 | public function markReadOnly($object) |
2768 | 2768 | { |
2769 | - if (! is_object($object) || ! $this->isInIdentityMap($object)) { |
|
2769 | + if ( ! is_object($object) || ! $this->isInIdentityMap($object)) { |
|
2770 | 2770 | throw ORMInvalidArgumentException::readOnlyRequiresManagedEntity($object); |
2771 | 2771 | } |
2772 | 2772 | |
@@ -2784,7 +2784,7 @@ discard block |
||
2784 | 2784 | */ |
2785 | 2785 | public function isReadOnly($object) |
2786 | 2786 | { |
2787 | - if (! is_object($object)) { |
|
2787 | + if ( ! is_object($object)) { |
|
2788 | 2788 | throw ORMInvalidArgumentException::readOnlyRequiresManagedEntity($object); |
2789 | 2789 | } |
2790 | 2790 | |
@@ -2796,7 +2796,7 @@ discard block |
||
2796 | 2796 | */ |
2797 | 2797 | private function afterTransactionComplete() |
2798 | 2798 | { |
2799 | - $this->performCallbackOnCachedPersister(static function (CachedPersister $persister) { |
|
2799 | + $this->performCallbackOnCachedPersister(static function(CachedPersister $persister) { |
|
2800 | 2800 | $persister->afterTransactionComplete(); |
2801 | 2801 | }); |
2802 | 2802 | } |
@@ -2806,7 +2806,7 @@ discard block |
||
2806 | 2806 | */ |
2807 | 2807 | private function afterTransactionRolledBack() |
2808 | 2808 | { |
2809 | - $this->performCallbackOnCachedPersister(static function (CachedPersister $persister) { |
|
2809 | + $this->performCallbackOnCachedPersister(static function(CachedPersister $persister) { |
|
2810 | 2810 | $persister->afterTransactionRolledBack(); |
2811 | 2811 | }); |
2812 | 2812 | } |
@@ -2816,7 +2816,7 @@ discard block |
||
2816 | 2816 | */ |
2817 | 2817 | private function performCallbackOnCachedPersister(callable $callback) |
2818 | 2818 | { |
2819 | - if (! $this->hasCache) { |
|
2819 | + if ( ! $this->hasCache) { |
|
2820 | 2820 | return; |
2821 | 2821 | } |
2822 | 2822 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | if ($entityManager !== self::$entityManager) { |
82 | 82 | throw new RuntimeException( |
83 | - 'Trying to use PersistentObject with different EntityManager instances. ' . |
|
83 | + 'Trying to use PersistentObject with different EntityManager instances. '. |
|
84 | 84 | 'Was PersistentObject::setEntityManager() called?' |
85 | 85 | ); |
86 | 86 | } |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | |
106 | 106 | $property = $this->cm->getProperty($field); |
107 | 107 | |
108 | - if (! $property) { |
|
109 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
108 | + if ( ! $property) { |
|
109 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | switch (true) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $targetClassName = $property->getTargetEntity(); |
119 | 119 | |
120 | 120 | if ($args[0] !== null && ! ($args[0] instanceof $targetClassName)) { |
121 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
121 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $this->{$field} = $args[0]; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | |
145 | 145 | $property = $this->cm->getProperty($field); |
146 | 146 | |
147 | - if (! $property) { |
|
148 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
147 | + if ( ! $property) { |
|
148 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | return $this->{$field}; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $mappedByField = $property->getMappedBy(); |
168 | 168 | $targetMetadata = self::$entityManager->getClassMetadata($property->getTargetEntity()); |
169 | 169 | $targetProperty = $targetMetadata->getProperty($mappedByField); |
170 | - $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set') . $mappedByField; |
|
170 | + $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set').$mappedByField; |
|
171 | 171 | |
172 | 172 | $targetObject->{$setterMethodName}($this); |
173 | 173 | } |
@@ -189,21 +189,21 @@ discard block |
||
189 | 189 | |
190 | 190 | $property = $this->cm->getProperty($field); |
191 | 191 | |
192 | - if (! $property) { |
|
193 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
192 | + if ( ! $property) { |
|
193 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
194 | 194 | } |
195 | 195 | |
196 | - if (! ($property instanceof ToManyAssociationMetadata)) { |
|
197 | - throw new BadMethodCallException('There is no method add' . $field . '() on ' . $this->cm->getClassName()); |
|
196 | + if ( ! ($property instanceof ToManyAssociationMetadata)) { |
|
197 | + throw new BadMethodCallException('There is no method add'.$field.'() on '.$this->cm->getClassName()); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $targetClassName = $property->getTargetEntity(); |
201 | 201 | |
202 | - if (! ($args[0] instanceof $targetClassName)) { |
|
203 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
202 | + if ( ! ($args[0] instanceof $targetClassName)) { |
|
203 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
204 | 204 | } |
205 | 205 | |
206 | - if (! ($this->{$field} instanceof Collection)) { |
|
206 | + if ( ! ($this->{$field} instanceof Collection)) { |
|
207 | 207 | $this->{$field} = new ArrayCollection($this->{$field} ?: []); |
208 | 208 | } |
209 | 209 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | return; |
226 | 226 | } |
227 | 227 | |
228 | - if (! self::$entityManager) { |
|
228 | + if ( ! self::$entityManager) { |
|
229 | 229 | throw new RuntimeException('No runtime entity manager set. Call PersistentObject#setEntityManager().'); |
230 | 230 | } |
231 | 231 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | return $this->add($field, $args); |
259 | 259 | |
260 | 260 | default: |
261 | - throw new BadMethodCallException('There is no method ' . $method . ' on ' . $this->cm->getClassName()); |
|
261 | + throw new BadMethodCallException('There is no method '.$method.' on '.$this->cm->getClassName()); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $expectedLockVersion = $expectedLockVersion instanceof DateTime ? $expectedLockVersion->getTimestamp() : $expectedLockVersion; |
60 | 60 | $actualLockVersion = $actualLockVersion instanceof DateTime ? $actualLockVersion->getTimestamp() : $actualLockVersion; |
61 | 61 | |
62 | - return new self('The optimistic lock failed, version ' . $expectedLockVersion . ' was expected, but is actually ' . $actualLockVersion, $entity); |
|
62 | + return new self('The optimistic lock failed, version '.$expectedLockVersion.' was expected, but is actually '.$actualLockVersion, $entity); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -69,6 +69,6 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public static function notVersioned($entityName) |
71 | 71 | { |
72 | - return new self('Cannot obtain optimistic lock on unversioned entity ' . $entityName, null); |
|
72 | + return new self('Cannot obtain optimistic lock on unversioned entity '.$entityName, null); |
|
73 | 73 | } |
74 | 74 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function newDefaultAnnotationDriver(array $paths = []) : AnnotationDriver |
163 | 163 | { |
164 | - AnnotationRegistry::registerFile(__DIR__ . '/Annotation/DoctrineAnnotations.php'); |
|
164 | + AnnotationRegistry::registerFile(__DIR__.'/Annotation/DoctrineAnnotations.php'); |
|
165 | 165 | |
166 | 166 | $reader = new CachedReader(new AnnotationReader(), new ArrayCache()); |
167 | 167 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | $queryCacheImpl = $this->getQueryCacheImpl(); |
237 | 237 | |
238 | - if (! $queryCacheImpl) { |
|
238 | + if ( ! $queryCacheImpl) { |
|
239 | 239 | throw QueryCacheNotConfigured::create(); |
240 | 240 | } |
241 | 241 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | $metadataCacheImpl = $this->getMetadataCacheImpl(); |
247 | 247 | |
248 | - if (! $metadataCacheImpl) { |
|
248 | + if ( ! $metadataCacheImpl) { |
|
249 | 249 | throw MetadataCacheNotConfigured::create(); |
250 | 250 | } |
251 | 251 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | { |
454 | 454 | $reflectionClass = new ReflectionClass($repositoryClassName); |
455 | 455 | |
456 | - if (! $reflectionClass->implementsInterface(ObjectRepository::class)) { |
|
456 | + if ( ! $reflectionClass->implementsInterface(ObjectRepository::class)) { |
|
457 | 457 | throw InvalidEntityRepository::fromClassName($repositoryClassName); |
458 | 458 | } |
459 | 459 |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | : new DefaultRegion($regionName, $cacheAdapter, $lifetime); |
183 | 183 | |
184 | 184 | if ($cache->getUsage() === CacheUsage::READ_WRITE) { |
185 | - if (! $this->fileLockRegionDirectory) { |
|
185 | + if ( ! $this->fileLockRegionDirectory) { |
|
186 | 186 | throw new LogicException( |
187 | - 'If you want to use a "READ_WRITE" cache an implementation of "Doctrine\ORM\Cache\ConcurrentRegion" is required, ' . |
|
187 | + 'If you want to use a "READ_WRITE" cache an implementation of "Doctrine\ORM\Cache\ConcurrentRegion" is required, '. |
|
188 | 188 | 'The default implementation provided by doctrine is "Doctrine\ORM\Cache\Region\FileLockRegion" if you want to use it please provide a valid directory, DefaultCacheFactory#setFileLockRegionDirectory(). ' |
189 | 189 | ); |
190 | 190 | } |
191 | 191 | |
192 | - $directory = $this->fileLockRegionDirectory . DIRECTORY_SEPARATOR . $regionName; |
|
192 | + $directory = $this->fileLockRegionDirectory.DIRECTORY_SEPARATOR.$regionName; |
|
193 | 193 | $region = new FileLockRegion($region, $directory, $this->regionsConfig->getLockLifetime($regionName)); |
194 | 194 | } |
195 | 195 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | { |
206 | 206 | $cacheAdapter = clone $this->cache; |
207 | 207 | |
208 | - if (! $cacheAdapter instanceof CacheProvider) { |
|
208 | + if ( ! $cacheAdapter instanceof CacheProvider) { |
|
209 | 209 | return $cacheAdapter; |
210 | 210 | } |
211 | 211 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $namespace .= ':'; |
216 | 216 | } |
217 | 217 | |
218 | - $cacheAdapter->setNamespace($namespace . $name); |
|
218 | + $cacheAdapter->setNamespace($namespace.$name); |
|
219 | 219 | |
220 | 220 | return $cacheAdapter; |
221 | 221 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function getCacheEntryKey(CacheKey $key) |
103 | 103 | { |
104 | - return $this->name . self::REGION_KEY_SEPARATOR . $key->hash; |
|
104 | + return $this->name.self::REGION_KEY_SEPARATOR.$key->hash; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function evictAll() |
127 | 127 | { |
128 | - if (! $this->cache instanceof ClearableCache) { |
|
128 | + if ( ! $this->cache instanceof ClearableCache) { |
|
129 | 129 | throw new BadMethodCallException(sprintf( |
130 | 130 | 'Clearing all cache entries is not supported by the supplied cache adapter of type %s', |
131 | 131 | get_class($this->cache) |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function __construct(Region $region, $directory, $lockLifetime) |
54 | 54 | { |
55 | - if (! is_dir($directory) && ! @mkdir($directory, 0775, true)) { |
|
55 | + if ( ! is_dir($directory) && ! @mkdir($directory, 0775, true)) { |
|
56 | 56 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist and could not be created.', $directory)); |
57 | 57 | } |
58 | 58 | |
59 | - if (! is_writable($directory)) { |
|
59 | + if ( ! is_writable($directory)) { |
|
60 | 60 | throw new InvalidArgumentException(sprintf('The directory "%s" is not writable.', $directory)); |
61 | 61 | } |
62 | 62 | |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | { |
73 | 73 | $filename = $this->getLockFileName($key); |
74 | 74 | |
75 | - if (! is_file($filename)) { |
|
75 | + if ( ! is_file($filename)) { |
|
76 | 76 | return false; |
77 | 77 | } |
78 | 78 | |
79 | 79 | $time = $this->getLockTime($filename); |
80 | 80 | $content = $this->getLockContent($filename); |
81 | 81 | |
82 | - if (! $content || ! $time) { |
|
82 | + if ( ! $content || ! $time) { |
|
83 | 83 | @unlink($filename); |
84 | 84 | |
85 | 85 | return false; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | private function getLockFileName(CacheKey $key) |
106 | 106 | { |
107 | - return $this->directory . DIRECTORY_SEPARATOR . $key->hash . '.' . self::LOCK_EXTENSION; |
|
107 | + return $this->directory.DIRECTORY_SEPARATOR.$key->hash.'.'.self::LOCK_EXTENSION; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $lock = Lock::createLockRead(); |
226 | 226 | $filename = $this->getLockFileName($key); |
227 | 227 | |
228 | - if (! @file_put_contents($filename, $lock->value, LOCK_EX)) { |
|
228 | + if ( ! @file_put_contents($filename, $lock->value, LOCK_EX)) { |
|
229 | 229 | return null; |
230 | 230 | } |
231 | 231 | chmod($filename, 0664); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | return false; |
243 | 243 | } |
244 | 244 | |
245 | - if (! @unlink($this->getLockFileName($key))) { |
|
245 | + if ( ! @unlink($this->getLockFileName($key))) { |
|
246 | 246 | return false; |
247 | 247 | } |
248 | 248 |