@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | protected function getReflectionService() : ReflectionService |
20 | 20 | { |
21 | - if (! $this->reflectionService) { |
|
21 | + if ( ! $this->reflectionService) { |
|
22 | 22 | $this->reflectionService = new StaticReflectionService(); |
23 | 23 | } |
24 | 24 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | protected function getReflectionService() : ReflectionService |
20 | 20 | { |
21 | - if (! $this->reflectionService) { |
|
21 | + if ( ! $this->reflectionService) { |
|
22 | 22 | $this->reflectionService = new RuntimeReflectionService(); |
23 | 23 | } |
24 | 24 |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | return $this->classNames; |
212 | 212 | } |
213 | 213 | |
214 | - if (! $this->paths) { |
|
214 | + if ( ! $this->paths) { |
|
215 | 215 | throw Mapping\MappingException::pathRequired(); |
216 | 216 | } |
217 | 217 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $includedFiles = []; |
220 | 220 | |
221 | 221 | foreach ($this->paths as $path) { |
222 | - if (! is_dir($path)) { |
|
222 | + if ( ! is_dir($path)) { |
|
223 | 223 | throw Mapping\MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
224 | 224 | } |
225 | 225 | |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), |
229 | 229 | RecursiveIteratorIterator::LEAVES_ONLY |
230 | 230 | ), |
231 | - '/^.+' . preg_quote($this->fileExtension) . '$/i', |
|
231 | + '/^.+'.preg_quote($this->fileExtension).'$/i', |
|
232 | 232 | RecursiveRegexIterator::GET_MATCH |
233 | 233 | ); |
234 | 234 | |
235 | 235 | foreach ($iterator as $file) { |
236 | 236 | $sourceFile = $file[0]; |
237 | 237 | |
238 | - if (! preg_match('(^phar:)i', $sourceFile)) { |
|
238 | + if ( ! preg_match('(^phar:)i', $sourceFile)) { |
|
239 | 239 | $sourceFile = realpath($sourceFile); |
240 | 240 | } |
241 | 241 | |
@@ -557,15 +557,15 @@ discard block |
||
557 | 557 | $fieldMetadata->setVersioned($isVersioned); |
558 | 558 | $fieldMetadata->setColumnName($columnName); |
559 | 559 | |
560 | - if (! $metadata->isMappedSuperclass) { |
|
560 | + if ( ! $metadata->isMappedSuperclass) { |
|
561 | 561 | $fieldMetadata->setTableName($metadata->getTableName()); |
562 | 562 | } |
563 | 563 | |
564 | - if (! empty($columnAnnot->columnDefinition)) { |
|
564 | + if ( ! empty($columnAnnot->columnDefinition)) { |
|
565 | 565 | $fieldMetadata->setColumnDefinition($columnAnnot->columnDefinition); |
566 | 566 | } |
567 | 567 | |
568 | - if (! empty($columnAnnot->length)) { |
|
568 | + if ( ! empty($columnAnnot->length)) { |
|
569 | 569 | $fieldMetadata->setLength($columnAnnot->length); |
570 | 570 | } |
571 | 571 | |
@@ -626,13 +626,13 @@ discard block |
||
626 | 626 | 'arguments' => $customGeneratorAnnot->arguments, |
627 | 627 | ]; |
628 | 628 | |
629 | - if (! isset($idGeneratorDefinition['class'])) { |
|
629 | + if ( ! isset($idGeneratorDefinition['class'])) { |
|
630 | 630 | throw new Mapping\MappingException( |
631 | 631 | sprintf('Cannot instantiate custom generator, no class has been defined') |
632 | 632 | ); |
633 | 633 | } |
634 | 634 | |
635 | - if (! class_exists($idGeneratorDefinition['class'])) { |
|
635 | + if ( ! class_exists($idGeneratorDefinition['class'])) { |
|
636 | 636 | throw new Mapping\MappingException( |
637 | 637 | sprintf('Cannot instantiate custom generator : %s', var_export($idGeneratorDefinition, true)) |
638 | 638 | ); |
@@ -676,12 +676,12 @@ discard block |
||
676 | 676 | $assocMetadata->setOrphanRemoval($oneToOneAnnot->orphanRemoval); |
677 | 677 | $assocMetadata->setFetchMode($this->getFetchMode($className, $oneToOneAnnot->fetch)); |
678 | 678 | |
679 | - if (! empty($oneToOneAnnot->mappedBy)) { |
|
679 | + if ( ! empty($oneToOneAnnot->mappedBy)) { |
|
680 | 680 | $assocMetadata->setMappedBy($oneToOneAnnot->mappedBy); |
681 | 681 | $assocMetadata->setOwningSide(false); |
682 | 682 | } |
683 | 683 | |
684 | - if (! empty($oneToOneAnnot->inversedBy)) { |
|
684 | + if ( ! empty($oneToOneAnnot->inversedBy)) { |
|
685 | 685 | $assocMetadata->setInversedBy($oneToOneAnnot->inversedBy); |
686 | 686 | } |
687 | 687 | |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | $assocMetadata->setCascade($this->getCascade($className, $fieldName, $manyToOneAnnot->cascade)); |
740 | 740 | $assocMetadata->setFetchMode($this->getFetchMode($className, $manyToOneAnnot->fetch)); |
741 | 741 | |
742 | - if (! empty($manyToOneAnnot->inversedBy)) { |
|
742 | + if ( ! empty($manyToOneAnnot->inversedBy)) { |
|
743 | 743 | $assocMetadata->setInversedBy($manyToOneAnnot->inversedBy); |
744 | 744 | } |
745 | 745 | |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $assocMetadata->setOwningSide(false); |
801 | 801 | $assocMetadata->setMappedBy($oneToManyAnnot->mappedBy); |
802 | 802 | |
803 | - if (! empty($oneToManyAnnot->indexBy)) { |
|
803 | + if ( ! empty($oneToManyAnnot->indexBy)) { |
|
804 | 804 | $assocMetadata->setIndexedBy($oneToManyAnnot->indexBy); |
805 | 805 | } |
806 | 806 | |
@@ -843,16 +843,16 @@ discard block |
||
843 | 843 | $assocMetadata->setOrphanRemoval($manyToManyAnnot->orphanRemoval); |
844 | 844 | $assocMetadata->setFetchMode($this->getFetchMode($className, $manyToManyAnnot->fetch)); |
845 | 845 | |
846 | - if (! empty($manyToManyAnnot->mappedBy)) { |
|
846 | + if ( ! empty($manyToManyAnnot->mappedBy)) { |
|
847 | 847 | $assocMetadata->setMappedBy($manyToManyAnnot->mappedBy); |
848 | 848 | $assocMetadata->setOwningSide(false); |
849 | 849 | } |
850 | 850 | |
851 | - if (! empty($manyToManyAnnot->inversedBy)) { |
|
851 | + if ( ! empty($manyToManyAnnot->inversedBy)) { |
|
852 | 852 | $assocMetadata->setInversedBy($manyToManyAnnot->inversedBy); |
853 | 853 | } |
854 | 854 | |
855 | - if (! empty($manyToManyAnnot->indexBy)) { |
|
855 | + if ( ! empty($manyToManyAnnot->indexBy)) { |
|
856 | 856 | $assocMetadata->setIndexedBy($manyToManyAnnot->indexBy); |
857 | 857 | } |
858 | 858 | |
@@ -894,15 +894,15 @@ discard block |
||
894 | 894 | $fieldMetadata->setType(Type::getType($columnAnnot->type)); |
895 | 895 | $fieldMetadata->setVersioned($isVersioned); |
896 | 896 | |
897 | - if (! empty($columnAnnot->name)) { |
|
897 | + if ( ! empty($columnAnnot->name)) { |
|
898 | 898 | $fieldMetadata->setColumnName($columnAnnot->name); |
899 | 899 | } |
900 | 900 | |
901 | - if (! empty($columnAnnot->columnDefinition)) { |
|
901 | + if ( ! empty($columnAnnot->columnDefinition)) { |
|
902 | 902 | $fieldMetadata->setColumnDefinition($columnAnnot->columnDefinition); |
903 | 903 | } |
904 | 904 | |
905 | - if (! empty($columnAnnot->length)) { |
|
905 | + if ( ! empty($columnAnnot->length)) { |
|
906 | 906 | $fieldMetadata->setLength($columnAnnot->length); |
907 | 907 | } |
908 | 908 | |
@@ -925,11 +925,11 @@ discard block |
||
925 | 925 | Annotation\Table $tableAnnot, |
926 | 926 | Mapping\TableMetadata $tableMetadata |
927 | 927 | ) : Mapping\TableMetadata { |
928 | - if (! empty($tableAnnot->name)) { |
|
928 | + if ( ! empty($tableAnnot->name)) { |
|
929 | 929 | $tableMetadata->setName($tableAnnot->name); |
930 | 930 | } |
931 | 931 | |
932 | - if (! empty($tableAnnot->schema)) { |
|
932 | + if ( ! empty($tableAnnot->schema)) { |
|
933 | 933 | $tableMetadata->setSchema($tableAnnot->schema); |
934 | 934 | } |
935 | 935 | |
@@ -967,11 +967,11 @@ discard block |
||
967 | 967 | ) : Mapping\JoinTableMetadata { |
968 | 968 | $joinTable = new Mapping\JoinTableMetadata(); |
969 | 969 | |
970 | - if (! empty($joinTableAnnot->name)) { |
|
970 | + if ( ! empty($joinTableAnnot->name)) { |
|
971 | 971 | $joinTable->setName($joinTableAnnot->name); |
972 | 972 | } |
973 | 973 | |
974 | - if (! empty($joinTableAnnot->schema)) { |
|
974 | + if ( ! empty($joinTableAnnot->schema)) { |
|
975 | 975 | $joinTable->setSchema($joinTableAnnot->schema); |
976 | 976 | } |
977 | 977 | |
@@ -999,22 +999,22 @@ discard block |
||
999 | 999 | $joinColumn = new Mapping\JoinColumnMetadata(); |
1000 | 1000 | |
1001 | 1001 | // @todo Remove conditionals for name and referencedColumnName once naming strategy is brought into drivers |
1002 | - if (! empty($joinColumnAnnot->name)) { |
|
1002 | + if ( ! empty($joinColumnAnnot->name)) { |
|
1003 | 1003 | $joinColumn->setColumnName($joinColumnAnnot->name); |
1004 | 1004 | } |
1005 | 1005 | |
1006 | - if (! empty($joinColumnAnnot->referencedColumnName)) { |
|
1006 | + if ( ! empty($joinColumnAnnot->referencedColumnName)) { |
|
1007 | 1007 | $joinColumn->setReferencedColumnName($joinColumnAnnot->referencedColumnName); |
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | $joinColumn->setNullable($joinColumnAnnot->nullable); |
1011 | 1011 | $joinColumn->setUnique($joinColumnAnnot->unique); |
1012 | 1012 | |
1013 | - if (! empty($joinColumnAnnot->fieldName)) { |
|
1013 | + if ( ! empty($joinColumnAnnot->fieldName)) { |
|
1014 | 1014 | $joinColumn->setAliasedName($joinColumnAnnot->fieldName); |
1015 | 1015 | } |
1016 | 1016 | |
1017 | - if (! empty($joinColumnAnnot->columnDefinition)) { |
|
1017 | + if ( ! empty($joinColumnAnnot->columnDefinition)) { |
|
1018 | 1018 | $joinColumn->setColumnDefinition($joinColumnAnnot->columnDefinition); |
1019 | 1019 | } |
1020 | 1020 | |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | $fieldName = null |
1037 | 1037 | ) : Mapping\CacheMetadata { |
1038 | 1038 | $baseRegion = strtolower(str_replace('\\', '_', $metadata->getRootClassName())); |
1039 | - $defaultRegion = $baseRegion . ($fieldName ? '__' . $fieldName : ''); |
|
1039 | + $defaultRegion = $baseRegion.($fieldName ? '__'.$fieldName : ''); |
|
1040 | 1040 | |
1041 | 1041 | $usage = constant(sprintf('%s::%s', Mapping\CacheUsage::class, $cacheAnnot->usage)); |
1042 | 1042 | $region = $cacheAnnot->region ?: $defaultRegion; |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | if ($parent && $parent->inheritanceType === Mapping\InheritanceType::SINGLE_TABLE) { |
1059 | 1059 | // Handle the case where a middle mapped super class inherits from a single table inheritance tree. |
1060 | 1060 | do { |
1061 | - if (! $parent->isMappedSuperclass) { |
|
1061 | + if ( ! $parent->isMappedSuperclass) { |
|
1062 | 1062 | $metadata->setTable($parent->table); |
1063 | 1063 | |
1064 | 1064 | break; |
@@ -1114,11 +1114,11 @@ discard block |
||
1114 | 1114 | $discriminatorColumn->setType(Type::getType($typeName)); |
1115 | 1115 | $discriminatorColumn->setColumnName($discriminatorColumnAnnotation->name); |
1116 | 1116 | |
1117 | - if (! empty($discriminatorColumnAnnotation->columnDefinition)) { |
|
1117 | + if ( ! empty($discriminatorColumnAnnotation->columnDefinition)) { |
|
1118 | 1118 | $discriminatorColumn->setColumnDefinition($discriminatorColumnAnnotation->columnDefinition); |
1119 | 1119 | } |
1120 | 1120 | |
1121 | - if (! empty($discriminatorColumnAnnotation->length)) { |
|
1121 | + if ( ! empty($discriminatorColumnAnnotation->length)) { |
|
1122 | 1122 | $discriminatorColumn->setLength($discriminatorColumnAnnotation->length); |
1123 | 1123 | } |
1124 | 1124 | } |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | $entityListenersAnnot = $classAnnotations[Annotation\EntityListeners::class]; |
1171 | 1171 | |
1172 | 1172 | foreach ($entityListenersAnnot->value as $listenerClassName) { |
1173 | - if (! class_exists($listenerClassName)) { |
|
1173 | + if ( ! class_exists($listenerClassName)) { |
|
1174 | 1174 | throw Mapping\MappingException::entityListenerClassNotFound( |
1175 | 1175 | $listenerClassName, |
1176 | 1176 | $metadata->getClassName() |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | $fieldName = $associationOverride->name; |
1209 | 1209 | $property = $metadata->getProperty($fieldName); |
1210 | 1210 | |
1211 | - if (! $property) { |
|
1211 | + if ( ! $property) { |
|
1212 | 1212 | throw Mapping\MappingException::invalidOverrideFieldName($metadata->getClassName(), $fieldName); |
1213 | 1213 | } |
1214 | 1214 | |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | // Check for fetch |
1243 | 1243 | if ($associationOverride->fetch) { |
1244 | 1244 | $override->setFetchMode( |
1245 | - constant(Mapping\FetchMode::class . '::' . $associationOverride->fetch) |
|
1245 | + constant(Mapping\FetchMode::class.'::'.$associationOverride->fetch) |
|
1246 | 1246 | ); |
1247 | 1247 | } |
1248 | 1248 | |
@@ -1331,7 +1331,7 @@ discard block |
||
1331 | 1331 | { |
1332 | 1332 | $fetchModeConstant = sprintf('%s::%s', Mapping\FetchMode::class, $fetchMode); |
1333 | 1333 | |
1334 | - if (! defined($fetchModeConstant)) { |
|
1334 | + if ( ! defined($fetchModeConstant)) { |
|
1335 | 1335 | throw Mapping\MappingException::invalidFetchMode($className, $fetchMode); |
1336 | 1336 | } |
1337 | 1337 | |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | $classAnnotations = $this->reader->getClassAnnotations($reflectionClass); |
1378 | 1378 | |
1379 | 1379 | foreach ($classAnnotations as $key => $annot) { |
1380 | - if (! is_numeric($key)) { |
|
1380 | + if ( ! is_numeric($key)) { |
|
1381 | 1381 | continue; |
1382 | 1382 | } |
1383 | 1383 | |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | $propertyAnnotations = $this->reader->getPropertyAnnotations($reflectionProperty); |
1396 | 1396 | |
1397 | 1397 | foreach ($propertyAnnotations as $key => $annot) { |
1398 | - if (! is_numeric($key)) { |
|
1398 | + if ( ! is_numeric($key)) { |
|
1399 | 1399 | continue; |
1400 | 1400 | } |
1401 | 1401 | |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | $methodAnnotations = $this->reader->getMethodAnnotations($reflectionMethod); |
1414 | 1414 | |
1415 | 1415 | foreach ($methodAnnotations as $key => $annot) { |
1416 | - if (! is_numeric($key)) { |
|
1416 | + if ( ! is_numeric($key)) { |
|
1417 | 1417 | continue; |
1418 | 1418 | } |
1419 | 1419 |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | 'arguments' => [], |
280 | 280 | ]; |
281 | 281 | |
282 | - if (! isset($idGeneratorDefinition['class'])) { |
|
282 | + if ( ! isset($idGeneratorDefinition['class'])) { |
|
283 | 283 | throw new Mapping\MappingException( |
284 | 284 | sprintf('Cannot instantiate custom generator, no class has been defined') |
285 | 285 | ); |
286 | 286 | } |
287 | 287 | |
288 | - if (! class_exists($idGeneratorDefinition['class'])) { |
|
288 | + if ( ! class_exists($idGeneratorDefinition['class'])) { |
|
289 | 289 | throw new Mapping\MappingException( |
290 | 290 | sprintf('Cannot instantiate custom generator : %s', var_export($idGeneratorDefinition, true)) |
291 | 291 | ); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | |
441 | 441 | if (isset($manyToOneElement['fetch'])) { |
442 | 442 | $association->setFetchMode( |
443 | - constant('Doctrine\ORM\Mapping\FetchMode::' . (string) $manyToOneElement['fetch']) |
|
443 | + constant('Doctrine\ORM\Mapping\FetchMode::'.(string) $manyToOneElement['fetch']) |
|
444 | 444 | ); |
445 | 445 | } |
446 | 446 | |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | $fieldName = (string) $overrideElement['name']; |
596 | 596 | $property = $metadata->getProperty($fieldName); |
597 | 597 | |
598 | - if (! $property) { |
|
598 | + if ( ! $property) { |
|
599 | 599 | throw Mapping\MappingException::invalidOverrideFieldName($metadata->getClassName(), $fieldName); |
600 | 600 | } |
601 | 601 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | // Check for fetch |
654 | 654 | if (isset($overrideElement['fetch'])) { |
655 | 655 | $override->setFetchMode( |
656 | - constant('Doctrine\ORM\Mapping\FetchMode::' . (string) $overrideElement['fetch']) |
|
656 | + constant('Doctrine\ORM\Mapping\FetchMode::'.(string) $overrideElement['fetch']) |
|
657 | 657 | ); |
658 | 658 | } |
659 | 659 | |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | // Evaluate <lifecycle-callbacks...> |
665 | 665 | if (isset($xmlRoot->{'lifecycle-callbacks'})) { |
666 | 666 | foreach ($xmlRoot->{'lifecycle-callbacks'}->{'lifecycle-callback'} as $lifecycleCallback) { |
667 | - $eventName = constant(Events::class . '::' . (string) $lifecycleCallback['type']); |
|
667 | + $eventName = constant(Events::class.'::'.(string) $lifecycleCallback['type']); |
|
668 | 668 | $methodName = (string) $lifecycleCallback['method']; |
669 | 669 | |
670 | 670 | $metadata->addLifecycleCallback($methodName, $eventName); |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | foreach ($xmlRoot->{'entity-listeners'}->{'entity-listener'} as $listenerElement) { |
677 | 677 | $listenerClassName = (string) $listenerElement['class']; |
678 | 678 | |
679 | - if (! class_exists($listenerClassName)) { |
|
679 | + if ( ! class_exists($listenerClassName)) { |
|
680 | 680 | throw Mapping\MappingException::entityListenerClassNotFound( |
681 | 681 | $listenerClassName, |
682 | 682 | $metadata->getClassName() |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | $fieldName = null |
855 | 855 | ) { |
856 | 856 | $baseRegion = strtolower(str_replace('\\', '_', $metadata->getRootClassName())); |
857 | - $defaultRegion = $baseRegion . ($fieldName ? '__' . $fieldName : ''); |
|
857 | + $defaultRegion = $baseRegion.($fieldName ? '__'.$fieldName : ''); |
|
858 | 858 | |
859 | 859 | $region = (string) ($cacheMapping['region'] ?? $defaultRegion); |
860 | 860 | $usage = isset($cacheMapping['usage']) |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | Events::preFlush, |
883 | 883 | ]; |
884 | 884 | |
885 | - return array_filter($events, static function ($eventName) use ($method) { |
|
885 | + return array_filter($events, static function($eventName) use ($method) { |
|
886 | 886 | return $eventName === $method->getName(); |
887 | 887 | }); |
888 | 888 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | string $className, |
84 | 84 | ClassMetadataBuildingContext $metadataBuildingContext |
85 | 85 | ) : ?ClassMetadata { |
86 | - if (! $this->evm->hasListeners(Events::onClassMetadataNotFound)) { |
|
86 | + if ( ! $this->evm->hasListeners(Events::onClassMetadataNotFound)) { |
|
87 | 87 | return null; |
88 | 88 | } |
89 | 89 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | protected function completeRuntimeMetadata(ClassMetadata $class, ?ClassMetadata $parent = null) : void |
126 | 126 | { |
127 | - if (! $parent || ! $parent->isMappedSuperclass) { |
|
127 | + if ( ! $parent || ! $parent->isMappedSuperclass) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | continue; |
143 | 143 | } |
144 | 144 | |
145 | - if (! ($property instanceof ToOneAssociationMetadata)) { |
|
145 | + if ( ! ($property instanceof ToOneAssociationMetadata)) { |
|
146 | 146 | continue; |
147 | 147 | } |
148 | 148 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function validateRuntimeMetadata(ClassMetadata $class, ?ClassMetadata $parent = null) : void |
163 | 163 | { |
164 | - if (! $class->getReflectionClass()) { |
|
164 | + if ( ! $class->getReflectionClass()) { |
|
165 | 165 | // only validate if there is a reflection class instance |
166 | 166 | return; |
167 | 167 | } |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | $class->validateLifecycleCallbacks($this->getReflectionService()); |
172 | 172 | |
173 | 173 | // verify inheritance |
174 | - if (! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) { |
|
175 | - if (! $parent) { |
|
176 | - if (! $class->discriminatorMap) { |
|
174 | + if ( ! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) { |
|
175 | + if ( ! $parent) { |
|
176 | + if ( ! $class->discriminatorMap) { |
|
177 | 177 | throw MappingException::missingDiscriminatorMap($class->getClassName()); |
178 | 178 | } |
179 | 179 | |
180 | - if (! $class->discriminatorColumn) { |
|
180 | + if ( ! $class->discriminatorColumn) { |
|
181 | 181 | throw MappingException::missingDiscriminatorColumn($class->getClassName()); |
182 | 182 | } |
183 | 183 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | private function completeIdentifierGeneratorMappings(ClassMetadata $class) : void |
245 | 245 | { |
246 | 246 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
247 | - if (! $property instanceof FieldMetadata /*&& ! $property instanceof AssocationMetadata*/) { |
|
247 | + if ( ! $property instanceof FieldMetadata /*&& ! $property instanceof AssocationMetadata*/) { |
|
248 | 248 | continue; |
249 | 249 | } |
250 | 250 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | |
255 | 255 | private function completeFieldIdentifierGeneratorMapping(FieldMetadata $field) |
256 | 256 | { |
257 | - if (! $field->hasValueGenerator()) { |
|
257 | + if ( ! $field->hasValueGenerator()) { |
|
258 | 258 | return; |
259 | 259 | } |
260 | 260 | |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | case GeneratorType::CUSTOM: |
305 | 305 | $definition = $generator->getDefinition(); |
306 | 306 | |
307 | - if (! isset($definition['class'])) { |
|
307 | + if ( ! isset($definition['class'])) { |
|
308 | 308 | throw InvalidCustomGenerator::onClassNotConfigured(); |
309 | 309 | } |
310 | 310 | |
311 | - if (! class_exists($definition['class'])) { |
|
311 | + if ( ! class_exists($definition['class'])) { |
|
312 | 312 | throw InvalidCustomGenerator::onMissingClass($definition); |
313 | 313 | } |
314 | 314 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | private function getTargetPlatform() : Platforms\AbstractPlatform |
343 | 343 | { |
344 | - if (! $this->targetPlatform) { |
|
344 | + if ( ! $this->targetPlatform) { |
|
345 | 345 | $this->targetPlatform = $this->em->getConnection()->getDatabasePlatform(); |
346 | 346 | } |
347 | 347 |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->setCache(clone $parent->cache); |
241 | 241 | } |
242 | 242 | |
243 | - if (! empty($parent->entityListeners)) { |
|
243 | + if ( ! empty($parent->entityListeners)) { |
|
244 | 244 | $this->entityListeners = $parent->entityListeners; |
245 | 245 | } |
246 | 246 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function __toString() |
309 | 309 | { |
310 | - return self::class . '@' . spl_object_id($this); |
|
310 | + return self::class.'@'.spl_object_id($this); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | // Restore ReflectionClass and properties |
395 | 395 | $this->reflectionClass = $reflectionService->getClass($this->className); |
396 | 396 | |
397 | - if (! $this->reflectionClass) { |
|
397 | + if ( ! $this->reflectionClass) { |
|
398 | 398 | return; |
399 | 399 | } |
400 | 400 | |
@@ -423,11 +423,11 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public function isIdentifier(string $fieldName) : bool |
425 | 425 | { |
426 | - if (! $this->identifier) { |
|
426 | + if ( ! $this->identifier) { |
|
427 | 427 | return false; |
428 | 428 | } |
429 | 429 | |
430 | - if (! $this->isIdentifierComposite()) { |
|
430 | + if ( ! $this->isIdentifierComposite()) { |
|
431 | 431 | return $fieldName === $this->identifier[0]; |
432 | 432 | } |
433 | 433 | |
@@ -451,11 +451,11 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | // Verify & complete identifier mapping |
454 | - if (! $this->identifier) { |
|
454 | + if ( ! $this->identifier) { |
|
455 | 455 | throw MappingException::identifierRequired($this->className); |
456 | 456 | } |
457 | 457 | |
458 | - $explicitlyGeneratedProperties = array_filter($this->declaredProperties, static function (Property $property) : bool { |
|
458 | + $explicitlyGeneratedProperties = array_filter($this->declaredProperties, static function(Property $property) : bool { |
|
459 | 459 | return $property instanceof FieldMetadata |
460 | 460 | && $property->isPrimaryKey() |
461 | 461 | && $property->hasValueGenerator(); |
@@ -474,14 +474,14 @@ discard block |
||
474 | 474 | public function validateAssociations() : void |
475 | 475 | { |
476 | 476 | array_map( |
477 | - function (Property $property) { |
|
478 | - if (! ($property instanceof AssociationMetadata)) { |
|
477 | + function(Property $property) { |
|
478 | + if ( ! ($property instanceof AssociationMetadata)) { |
|
479 | 479 | return; |
480 | 480 | } |
481 | 481 | |
482 | 482 | $targetEntity = $property->getTargetEntity(); |
483 | 483 | |
484 | - if (! class_exists($targetEntity)) { |
|
484 | + if ( ! class_exists($targetEntity)) { |
|
485 | 485 | throw MappingException::invalidTargetEntityClass($targetEntity, $this->className, $property->getName()); |
486 | 486 | } |
487 | 487 | }, |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | foreach ($this->lifecycleCallbacks as $callbacks) { |
500 | 500 | /** @var array $callbacks */ |
501 | 501 | foreach ($callbacks as $callbackFuncName) { |
502 | - if (! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) { |
|
502 | + if ( ! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) { |
|
503 | 503 | throw MappingException::lifecycleCallbackMethodNotFound($this->className, $callbackFuncName); |
504 | 504 | } |
505 | 505 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | $fieldName = $property->getName(); |
549 | 549 | $targetEntity = $property->getTargetEntity(); |
550 | 550 | |
551 | - if (! $targetEntity) { |
|
551 | + if ( ! $targetEntity) { |
|
552 | 552 | throw MappingException::missingTargetEntity($fieldName); |
553 | 553 | } |
554 | 554 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | throw MappingException::illegalToManyIdentifierAssociation($this->className, $property->getName()); |
578 | 578 | } |
579 | 579 | |
580 | - if (! in_array($property->getName(), $this->identifier, true)) { |
|
580 | + if ( ! in_array($property->getName(), $this->identifier, true)) { |
|
581 | 581 | $this->identifier[] = $property->getName(); |
582 | 582 | } |
583 | 583 | } |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | /** @var JoinColumnMetadata $joinColumn */ |
624 | 624 | if ($property instanceof OneToOneAssociationMetadata && $this->inheritanceType !== InheritanceType::SINGLE_TABLE) { |
625 | 625 | if (count($property->getJoinColumns()) === 1) { |
626 | - if (! $property->isPrimaryKey()) { |
|
626 | + if ( ! $property->isPrimaryKey()) { |
|
627 | 627 | $joinColumn->setUnique(true); |
628 | 628 | } |
629 | 629 | } else { |
@@ -631,13 +631,13 @@ discard block |
||
631 | 631 | } |
632 | 632 | } |
633 | 633 | |
634 | - $joinColumn->setTableName(! $this->isMappedSuperclass ? $this->getTableName() : null); |
|
634 | + $joinColumn->setTableName( ! $this->isMappedSuperclass ? $this->getTableName() : null); |
|
635 | 635 | |
636 | - if (! $joinColumn->getColumnName()) { |
|
636 | + if ( ! $joinColumn->getColumnName()) { |
|
637 | 637 | $joinColumn->setColumnName($this->namingStrategy->joinColumnName($fieldName, $this->className)); |
638 | 638 | } |
639 | 639 | |
640 | - if (! $joinColumn->getReferencedColumnName()) { |
|
640 | + if ( ! $joinColumn->getReferencedColumnName()) { |
|
641 | 641 | $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName()); |
642 | 642 | } |
643 | 643 | |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | } |
646 | 646 | |
647 | 647 | if ($uniqueConstraintColumns) { |
648 | - if (! $this->table) { |
|
648 | + if ( ! $this->table) { |
|
649 | 649 | throw new RuntimeException( |
650 | 650 | 'ClassMetadata::setTable() has to be called before defining a one to one relationship.' |
651 | 651 | ); |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | if ($property->isOrphanRemoval()) { |
666 | 666 | $cascades = $property->getCascade(); |
667 | 667 | |
668 | - if (! in_array('remove', $cascades, true)) { |
|
668 | + if ( ! in_array('remove', $cascades, true)) { |
|
669 | 669 | $cascades[] = 'remove'; |
670 | 670 | |
671 | 671 | $property->setCascade($cascades); |
@@ -728,14 +728,14 @@ discard block |
||
728 | 728 | protected function validateAndCompleteOneToManyMapping(OneToManyAssociationMetadata $property) |
729 | 729 | { |
730 | 730 | // OneToMany MUST have mappedBy |
731 | - if (! $property->getMappedBy()) { |
|
731 | + if ( ! $property->getMappedBy()) { |
|
732 | 732 | throw MappingException::oneToManyRequiresMappedBy($property->getName()); |
733 | 733 | } |
734 | 734 | |
735 | 735 | if ($property->isOrphanRemoval()) { |
736 | 736 | $cascades = $property->getCascade(); |
737 | 737 | |
738 | - if (! in_array('remove', $cascades, true)) { |
|
738 | + if ( ! in_array('remove', $cascades, true)) { |
|
739 | 739 | $cascades[] = 'remove'; |
740 | 740 | |
741 | 741 | $property->setCascade($cascades); |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | |
759 | 759 | $property->setJoinTable($joinTable); |
760 | 760 | |
761 | - if (! $joinTable->getName()) { |
|
761 | + if ( ! $joinTable->getName()) { |
|
762 | 762 | $joinTableName = $this->namingStrategy->joinTableName( |
763 | 763 | $property->getSourceEntity(), |
764 | 764 | $property->getTargetEntity(), |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | |
771 | 771 | $selfReferencingEntityWithoutJoinColumns = $property->getSourceEntity() === $property->getTargetEntity() && ! $joinTable->hasColumns(); |
772 | 772 | |
773 | - if (! $joinTable->getJoinColumns()) { |
|
773 | + if ( ! $joinTable->getJoinColumns()) { |
|
774 | 774 | $referencedColumnName = $this->namingStrategy->referenceColumnName(); |
775 | 775 | $sourceReferenceName = $selfReferencingEntityWithoutJoinColumns ? 'source' : $referencedColumnName; |
776 | 776 | $columnName = $this->namingStrategy->joinKeyColumnName($property->getSourceEntity(), $sourceReferenceName); |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | $joinTable->addJoinColumn($joinColumn); |
784 | 784 | } |
785 | 785 | |
786 | - if (! $joinTable->getInverseJoinColumns()) { |
|
786 | + if ( ! $joinTable->getInverseJoinColumns()) { |
|
787 | 787 | $referencedColumnName = $this->namingStrategy->referenceColumnName(); |
788 | 788 | $targetReferenceName = $selfReferencingEntityWithoutJoinColumns ? 'target' : $referencedColumnName; |
789 | 789 | $columnName = $this->namingStrategy->joinKeyColumnName($property->getTargetEntity(), $targetReferenceName); |
@@ -798,13 +798,13 @@ discard block |
||
798 | 798 | |
799 | 799 | foreach ($joinTable->getJoinColumns() as $joinColumn) { |
800 | 800 | /** @var JoinColumnMetadata $joinColumn */ |
801 | - if (! $joinColumn->getReferencedColumnName()) { |
|
801 | + if ( ! $joinColumn->getReferencedColumnName()) { |
|
802 | 802 | $joinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName()); |
803 | 803 | } |
804 | 804 | |
805 | 805 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
806 | 806 | |
807 | - if (! $joinColumn->getColumnName()) { |
|
807 | + if ( ! $joinColumn->getColumnName()) { |
|
808 | 808 | $columnName = $this->namingStrategy->joinKeyColumnName( |
809 | 809 | $property->getSourceEntity(), |
810 | 810 | $referencedColumnName |
@@ -816,13 +816,13 @@ discard block |
||
816 | 816 | |
817 | 817 | foreach ($joinTable->getInverseJoinColumns() as $inverseJoinColumn) { |
818 | 818 | /** @var JoinColumnMetadata $inverseJoinColumn */ |
819 | - if (! $inverseJoinColumn->getReferencedColumnName()) { |
|
819 | + if ( ! $inverseJoinColumn->getReferencedColumnName()) { |
|
820 | 820 | $inverseJoinColumn->setReferencedColumnName($this->namingStrategy->referenceColumnName()); |
821 | 821 | } |
822 | 822 | |
823 | 823 | $referencedColumnName = $inverseJoinColumn->getReferencedColumnName(); |
824 | 824 | |
825 | - if (! $inverseJoinColumn->getColumnName()) { |
|
825 | + if ( ! $inverseJoinColumn->getColumnName()) { |
|
826 | 826 | $columnName = $this->namingStrategy->joinKeyColumnName( |
827 | 827 | $property->getTargetEntity(), |
828 | 828 | $referencedColumnName |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | throw MappingException::singleIdNotAllowedOnCompositePrimaryKey($this->className); |
857 | 857 | } |
858 | 858 | |
859 | - if (! isset($this->identifier[0])) { |
|
859 | + if ( ! isset($this->identifier[0])) { |
|
860 | 860 | throw MappingException::noIdDefined($this->className); |
861 | 861 | } |
862 | 862 | |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | // Association defined as Id field |
916 | 916 | $targetClass = $em->getClassMetadata($property->getTargetEntity()); |
917 | 917 | |
918 | - if (! $property->isOwningSide()) { |
|
918 | + if ( ! $property->isOwningSide()) { |
|
919 | 919 | $property = $targetClass->getProperty($property->getMappedBy()); |
920 | 920 | $targetClass = $em->getClassMetadata($property->getTargetEntity()); |
921 | 921 | } |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | $columnName = $joinColumn->getColumnName(); |
930 | 930 | $referencedColumnName = $joinColumn->getReferencedColumnName(); |
931 | 931 | |
932 | - if (! $joinColumn->getType()) { |
|
932 | + if ( ! $joinColumn->getType()) { |
|
933 | 933 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $em)); |
934 | 934 | } |
935 | 935 | |
@@ -963,10 +963,10 @@ discard block |
||
963 | 963 | { |
964 | 964 | $schema = $this->getSchemaName() === null |
965 | 965 | ? '' |
966 | - : $this->getSchemaName() . '_'; |
|
966 | + : $this->getSchemaName().'_'; |
|
967 | 967 | |
968 | 968 | // replace dots with underscores because PostgreSQL creates temporary tables in a special schema |
969 | - return $schema . $this->getTableName() . '_id_tmp'; |
|
969 | + return $schema.$this->getTableName().'_id_tmp'; |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | /** |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | */ |
1001 | 1001 | public function setInheritanceType($type) : void |
1002 | 1002 | { |
1003 | - if (! $this->isInheritanceType($type)) { |
|
1003 | + if ( ! $this->isInheritanceType($type)) { |
|
1004 | 1004 | throw MappingException::invalidInheritanceType($this->className, $type); |
1005 | 1005 | } |
1006 | 1006 | |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | { |
1019 | 1019 | $fieldName = $property->getName(); |
1020 | 1020 | |
1021 | - if (! isset($this->declaredProperties[$fieldName])) { |
|
1021 | + if ( ! isset($this->declaredProperties[$fieldName])) { |
|
1022 | 1022 | throw MappingException::invalidOverrideFieldName($this->className, $fieldName); |
1023 | 1023 | } |
1024 | 1024 | |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | if ($inheritedProperty instanceof FieldMetadata) { |
1227 | - if (! $declaringClass->isMappedSuperclass) { |
|
1227 | + if ( ! $declaringClass->isMappedSuperclass) { |
|
1228 | 1228 | $inheritedProperty->setTableName($property->getTableName()); |
1229 | 1229 | } |
1230 | 1230 | |
@@ -1331,11 +1331,11 @@ discard block |
||
1331 | 1331 | 'method' => $method, |
1332 | 1332 | ]; |
1333 | 1333 | |
1334 | - if (! class_exists($class)) { |
|
1334 | + if ( ! class_exists($class)) { |
|
1335 | 1335 | throw MappingException::entityListenerClassNotFound($class, $this->className); |
1336 | 1336 | } |
1337 | 1337 | |
1338 | - if (! method_exists($class, $method)) { |
|
1338 | + if ( ! method_exists($class, $method)) { |
|
1339 | 1339 | throw MappingException::entityListenerMethodNotFound($class, $method, $this->className); |
1340 | 1340 | } |
1341 | 1341 | |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | return; |
1404 | 1404 | } |
1405 | 1405 | |
1406 | - if (! (class_exists($className) || interface_exists($className))) { |
|
1406 | + if ( ! (class_exists($className) || interface_exists($className))) { |
|
1407 | 1407 | throw MappingException::invalidClassInDiscriminatorMap($className, $this->className); |
1408 | 1408 | } |
1409 | 1409 |
@@ -25,11 +25,11 @@ |
||
25 | 25 | /** @var FieldMetadata $value */ |
26 | 26 | $variableExporter = new VariableExporter(); |
27 | 27 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
28 | - $objectReference = $indentation . self::VARIABLE; |
|
28 | + $objectReference = $indentation.self::VARIABLE; |
|
29 | 29 | |
30 | 30 | $lines = []; |
31 | 31 | $lines[] = parent::export($value, $indentationLevel); |
32 | - $lines[] = $objectReference . '->setVersioned(' . ltrim($variableExporter->export($value->isVersioned(), $indentationLevel + 1)) . ');'; |
|
32 | + $lines[] = $objectReference.'->setVersioned('.ltrim($variableExporter->export($value->isVersioned(), $indentationLevel + 1)).');'; |
|
33 | 33 | |
34 | 34 | return implode(PHP_EOL, $lines); |
35 | 35 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | |
340 | 340 | $this->computeChangeSets(); |
341 | 341 | |
342 | - if (! ($this->entityInsertions || |
|
342 | + if ( ! ($this->entityInsertions || |
|
343 | 343 | $this->entityDeletions || |
344 | 344 | $this->entityUpdates || |
345 | 345 | $this->collectionUpdates || |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | // Entity deletions come last and need to be in reverse commit order |
401 | 401 | if ($this->entityDeletions) { |
402 | 402 | foreach (array_reverse($commitOrder) as $committedEntityName) { |
403 | - if (! $this->entityDeletions) { |
|
403 | + if ( ! $this->entityDeletions) { |
|
404 | 404 | break; // just a performance optimisation |
405 | 405 | } |
406 | 406 | |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | $oid = spl_object_id($entity); |
485 | 485 | $data = []; |
486 | 486 | |
487 | - if (! isset($this->entityChangeSets[$oid])) { |
|
487 | + if ( ! isset($this->entityChangeSets[$oid])) { |
|
488 | 488 | return $data; |
489 | 489 | } |
490 | 490 | |
@@ -564,12 +564,12 @@ discard block |
||
564 | 564 | || ! $class->getProperty($name) instanceof FieldMetadata |
565 | 565 | || ! $class->getProperty($name)->hasValueGenerator() |
566 | 566 | || $class->getProperty($name)->getValueGenerator()->getType() !== GeneratorType::IDENTITY |
567 | - ) && (! $class->isVersioned() || $name !== $class->versionProperty->getName())) { |
|
567 | + ) && ( ! $class->isVersioned() || $name !== $class->versionProperty->getName())) { |
|
568 | 568 | $actualData[$name] = $value; |
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | - if (! isset($this->originalEntityData[$oid])) { |
|
572 | + if ( ! isset($this->originalEntityData[$oid])) { |
|
573 | 573 | // Entity is either NEW or MANAGED but not yet fully persisted (only has an id). |
574 | 574 | // These result in an INSERT. |
575 | 575 | $this->originalEntityData[$oid] = $actualData; |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | |
597 | 597 | foreach ($actualData as $propName => $actualValue) { |
598 | 598 | // skip field, its a partially omitted one! |
599 | - if (! (isset($originalData[$propName]) || array_key_exists($propName, $originalData))) { |
|
599 | + if ( ! (isset($originalData[$propName]) || array_key_exists($propName, $originalData))) { |
|
600 | 600 | continue; |
601 | 601 | } |
602 | 602 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | if ($owner === null) { // cloned |
619 | 619 | $actualValue->setOwner($entity, $property); |
620 | 620 | } elseif ($owner !== $entity) { // no clone, we have to fix |
621 | - if (! $actualValue->isInitialized()) { |
|
621 | + if ( ! $actualValue->isInitialized()) { |
|
622 | 622 | $actualValue->initialize(); // we have to do this otherwise the cols share state |
623 | 623 | } |
624 | 624 | |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | // Check if original value exists |
657 | 657 | if ($orgValue instanceof PersistentCollection) { |
658 | 658 | // A PersistentCollection was de-referenced, so delete it. |
659 | - if (! $this->isCollectionScheduledForDeletion($orgValue)) { |
|
659 | + if ( ! $this->isCollectionScheduledForDeletion($orgValue)) { |
|
660 | 660 | $this->scheduleCollectionDeletion($orgValue); |
661 | 661 | |
662 | 662 | $changeSet[$propName] = $orgValue; // Signal changeset, to-many associations will be ignored |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | |
680 | 680 | // Look for changes in associations of the entity |
681 | 681 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
682 | - if (! $property instanceof AssociationMetadata) { |
|
682 | + if ( ! $property instanceof AssociationMetadata) { |
|
683 | 683 | continue; |
684 | 684 | } |
685 | 685 | |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | // Only MANAGED entities that are NOT SCHEDULED FOR INSERTION OR DELETION are processed here. |
747 | 747 | $oid = spl_object_id($entity); |
748 | 748 | |
749 | - if (! isset($this->entityInsertions[$oid]) && ! isset($this->entityDeletions[$oid]) && isset($this->entityStates[$oid])) { |
|
749 | + if ( ! isset($this->entityInsertions[$oid]) && ! isset($this->entityDeletions[$oid]) && isset($this->entityStates[$oid])) { |
|
750 | 750 | $this->computeChangeSet($class, $entity); |
751 | 751 | } |
752 | 752 | } |
@@ -783,13 +783,13 @@ discard block |
||
783 | 783 | $targetClass = $this->em->getClassMetadata($targetEntity); |
784 | 784 | |
785 | 785 | foreach ($unwrappedValue as $key => $entry) { |
786 | - if (! ($entry instanceof $targetEntity)) { |
|
786 | + if ( ! ($entry instanceof $targetEntity)) { |
|
787 | 787 | throw ORMInvalidArgumentException::invalidAssociation($targetClass, $association, $entry); |
788 | 788 | } |
789 | 789 | |
790 | 790 | $state = $this->getEntityState($entry, self::STATE_NEW); |
791 | 791 | |
792 | - if (! ($entry instanceof $targetEntity)) { |
|
792 | + if ( ! ($entry instanceof $targetEntity)) { |
|
793 | 793 | throw UnexpectedAssociationValue::create( |
794 | 794 | $association->getSourceEntity(), |
795 | 795 | $association->getName(), |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | |
801 | 801 | switch ($state) { |
802 | 802 | case self::STATE_NEW: |
803 | - if (! in_array('persist', $association->getCascade(), true)) { |
|
803 | + if ( ! in_array('persist', $association->getCascade(), true)) { |
|
804 | 804 | $this->nonCascadedNewDetectedEntities[spl_object_id($entry)] = [$association, $entry]; |
805 | 805 | |
806 | 806 | break; |
@@ -849,12 +849,12 @@ discard block |
||
849 | 849 | $persister = $this->getEntityPersister($class->getClassName()); |
850 | 850 | $generationPlan->executeImmediate($this->em, $entity); |
851 | 851 | |
852 | - if (! $generationPlan->containsDeferred()) { |
|
852 | + if ( ! $generationPlan->containsDeferred()) { |
|
853 | 853 | $id = $this->em->getIdentifierFlattener()->flattenIdentifier($class, $persister->getIdentifier($entity)); |
854 | 854 | |
855 | 855 | // Some identifiers may be foreign keys to new entities. |
856 | 856 | // In this case, we don't have the value yet and should treat it as if we have a post-insert generator |
857 | - if (! $this->hasMissingIdsWhichAreForeignKeys($class, $id)) { |
|
857 | + if ( ! $this->hasMissingIdsWhichAreForeignKeys($class, $id)) { |
|
858 | 858 | $this->entityIdentifiers[$oid] = $id; |
859 | 859 | } |
860 | 860 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | { |
900 | 900 | $oid = spl_object_id($entity); |
901 | 901 | |
902 | - if (! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) { |
|
902 | + if ( ! isset($this->entityStates[$oid]) || $this->entityStates[$oid] !== self::STATE_MANAGED) { |
|
903 | 903 | throw ORMInvalidArgumentException::entityNotManaged($entity); |
904 | 904 | } |
905 | 905 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | break; |
923 | 923 | } |
924 | 924 | |
925 | - if (! $property->isPrimaryKey() |
|
925 | + if ( ! $property->isPrimaryKey() |
|
926 | 926 | || ! $property->getValueGenerator() |
927 | 927 | || $property->getValueGenerator()->getType() !== GeneratorType::IDENTITY) { |
928 | 928 | $actualData[$name] = $property->getValue($entity); |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | } |
937 | 937 | } |
938 | 938 | |
939 | - if (! isset($this->originalEntityData[$oid])) { |
|
939 | + if ( ! isset($this->originalEntityData[$oid])) { |
|
940 | 940 | throw new RuntimeException('Cannot call recomputeSingleEntityChangeSet before computeChangeSet on an entity.'); |
941 | 941 | } |
942 | 942 | |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | if ($changeSet) { |
955 | 955 | if (isset($this->entityChangeSets[$oid])) { |
956 | 956 | $this->entityChangeSets[$oid] = array_merge($this->entityChangeSets[$oid], $changeSet); |
957 | - } elseif (! isset($this->entityInsertions[$oid])) { |
|
957 | + } elseif ( ! isset($this->entityInsertions[$oid])) { |
|
958 | 958 | $this->entityChangeSets[$oid] = $changeSet; |
959 | 959 | $this->entityUpdates[$oid] = $entity; |
960 | 960 | } |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | $this->recomputeSingleEntityChangeSet($class, $entity); |
1025 | 1025 | } |
1026 | 1026 | |
1027 | - if (! empty($this->entityChangeSets[$oid])) { |
|
1027 | + if ( ! empty($this->entityChangeSets[$oid])) { |
|
1028 | 1028 | $persister->update($entity); |
1029 | 1029 | } |
1030 | 1030 | |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | |
1064 | 1064 | // Entity with this $oid after deletion treated as NEW, even if the $oid |
1065 | 1065 | // is obtained by a new entity because the old one went out of scope. |
1066 | - if (! $class->isIdentifierComposite()) { |
|
1066 | + if ( ! $class->isIdentifierComposite()) { |
|
1067 | 1067 | $property = $class->getProperty($class->getSingleIdentifierFieldName()); |
1068 | 1068 | |
1069 | 1069 | if ($property instanceof FieldMetadata && $property->hasValueGenerator()) { |
@@ -1110,13 +1110,13 @@ discard block |
||
1110 | 1110 | // Calculate dependencies for new nodes |
1111 | 1111 | while ($class = array_pop($newNodes)) { |
1112 | 1112 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
1113 | - if (! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) { |
|
1113 | + if ( ! ($property instanceof ToOneAssociationMetadata && $property->isOwningSide())) { |
|
1114 | 1114 | continue; |
1115 | 1115 | } |
1116 | 1116 | |
1117 | 1117 | $targetClass = $this->em->getClassMetadata($property->getTargetEntity()); |
1118 | 1118 | |
1119 | - if (! $calc->hasNode($targetClass->getClassName())) { |
|
1119 | + if ( ! $calc->hasNode($targetClass->getClassName())) { |
|
1120 | 1120 | $calc->addNode($targetClass->getClassName(), $targetClass); |
1121 | 1121 | |
1122 | 1122 | $newNodes[] = $targetClass; |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | $weight = ! array_filter( |
1126 | 1126 | $property->getJoinColumns(), |
1127 | - static function (JoinColumnMetadata $joinColumn) { |
|
1127 | + static function(JoinColumnMetadata $joinColumn) { |
|
1128 | 1128 | return $joinColumn->isNullable(); |
1129 | 1129 | } |
1130 | 1130 | ); |
@@ -1132,14 +1132,14 @@ discard block |
||
1132 | 1132 | $calc->addDependency($targetClass->getClassName(), $class->getClassName(), $weight); |
1133 | 1133 | |
1134 | 1134 | // If the target class has mapped subclasses, these share the same dependency. |
1135 | - if (! $targetClass->getSubClasses()) { |
|
1135 | + if ( ! $targetClass->getSubClasses()) { |
|
1136 | 1136 | continue; |
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | foreach ($targetClass->getSubClasses() as $subClassName) { |
1140 | 1140 | $targetSubClass = $this->em->getClassMetadata($subClassName); |
1141 | 1141 | |
1142 | - if (! $calc->hasNode($subClassName)) { |
|
1142 | + if ( ! $calc->hasNode($subClassName)) { |
|
1143 | 1143 | $calc->addNode($targetSubClass->getClassName(), $targetSubClass); |
1144 | 1144 | |
1145 | 1145 | $newNodes[] = $targetSubClass; |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | { |
1216 | 1216 | $oid = spl_object_id($entity); |
1217 | 1217 | |
1218 | - if (! isset($this->entityIdentifiers[$oid])) { |
|
1218 | + if ( ! isset($this->entityIdentifiers[$oid])) { |
|
1219 | 1219 | throw ORMInvalidArgumentException::entityHasNoIdentity($entity, 'scheduling for update'); |
1220 | 1220 | } |
1221 | 1221 | |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | throw ORMInvalidArgumentException::entityIsRemoved($entity, 'schedule for update'); |
1224 | 1224 | } |
1225 | 1225 | |
1226 | - if (! isset($this->entityUpdates[$oid]) && ! isset($this->entityInsertions[$oid])) { |
|
1226 | + if ( ! isset($this->entityUpdates[$oid]) && ! isset($this->entityInsertions[$oid])) { |
|
1227 | 1227 | $this->entityUpdates[$oid] = $entity; |
1228 | 1228 | } |
1229 | 1229 | } |
@@ -1298,7 +1298,7 @@ discard block |
||
1298 | 1298 | return; // entity has not been persisted yet, so nothing more to do. |
1299 | 1299 | } |
1300 | 1300 | |
1301 | - if (! $this->isInIdentityMap($entity)) { |
|
1301 | + if ( ! $this->isInIdentityMap($entity)) { |
|
1302 | 1302 | return; |
1303 | 1303 | } |
1304 | 1304 | |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | |
1307 | 1307 | unset($this->entityUpdates[$oid]); |
1308 | 1308 | |
1309 | - if (! isset($this->entityDeletions[$oid])) { |
|
1309 | + if ( ! isset($this->entityDeletions[$oid])) { |
|
1310 | 1310 | $this->entityDeletions[$oid] = $entity; |
1311 | 1311 | $this->entityStates[$oid] = self::STATE_REMOVED; |
1312 | 1312 | } |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | $persister = $this->getEntityPersister($class->getClassName()); |
1409 | 1409 | $id = $persister->getIdentifier($entity); |
1410 | 1410 | |
1411 | - if (! $id) { |
|
1411 | + if ( ! $id) { |
|
1412 | 1412 | return self::STATE_NEW; |
1413 | 1413 | } |
1414 | 1414 | |
@@ -1766,7 +1766,7 @@ discard block |
||
1766 | 1766 | $class = $this->em->getClassMetadata(get_class($entity)); |
1767 | 1767 | |
1768 | 1768 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
1769 | - if (! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade(), true))) { |
|
1769 | + if ( ! ($association instanceof AssociationMetadata && in_array('refresh', $association->getCascade(), true))) { |
|
1770 | 1770 | continue; |
1771 | 1771 | } |
1772 | 1772 | |
@@ -1813,7 +1813,7 @@ discard block |
||
1813 | 1813 | } |
1814 | 1814 | |
1815 | 1815 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
1816 | - if (! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade(), true))) { |
|
1816 | + if ( ! ($association instanceof AssociationMetadata && in_array('persist', $association->getCascade(), true))) { |
|
1817 | 1817 | continue; |
1818 | 1818 | } |
1819 | 1819 | |
@@ -1829,7 +1829,7 @@ discard block |
||
1829 | 1829 | |
1830 | 1830 | case $relatedEntities instanceof Collection: |
1831 | 1831 | case is_array($relatedEntities): |
1832 | - if (! ($association instanceof ToManyAssociationMetadata)) { |
|
1832 | + if ( ! ($association instanceof ToManyAssociationMetadata)) { |
|
1833 | 1833 | throw ORMInvalidArgumentException::invalidAssociation( |
1834 | 1834 | $this->em->getClassMetadata($targetEntity), |
1835 | 1835 | $association, |
@@ -1844,7 +1844,7 @@ discard block |
||
1844 | 1844 | break; |
1845 | 1845 | |
1846 | 1846 | case $relatedEntities !== null: |
1847 | - if (! $relatedEntities instanceof $targetEntity) { |
|
1847 | + if ( ! $relatedEntities instanceof $targetEntity) { |
|
1848 | 1848 | throw ORMInvalidArgumentException::invalidAssociation( |
1849 | 1849 | $this->em->getClassMetadata($targetEntity), |
1850 | 1850 | $association, |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | $class = $this->em->getClassMetadata(get_class($entity)); |
1874 | 1874 | |
1875 | 1875 | foreach ($class->getDeclaredPropertiesIterator() as $association) { |
1876 | - if (! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade(), true))) { |
|
1876 | + if ( ! ($association instanceof AssociationMetadata && in_array('remove', $association->getCascade(), true))) { |
|
1877 | 1877 | continue; |
1878 | 1878 | } |
1879 | 1879 | |
@@ -1932,7 +1932,7 @@ discard block |
||
1932 | 1932 | |
1933 | 1933 | switch (true) { |
1934 | 1934 | case $lockMode === LockMode::OPTIMISTIC: |
1935 | - if (! $class->isVersioned()) { |
|
1935 | + if ( ! $class->isVersioned()) { |
|
1936 | 1936 | throw OptimisticLockException::notVersioned($class->getClassName()); |
1937 | 1937 | } |
1938 | 1938 | |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | case $lockMode === LockMode::NONE: |
1956 | 1956 | case $lockMode === LockMode::PESSIMISTIC_READ: |
1957 | 1957 | case $lockMode === LockMode::PESSIMISTIC_WRITE: |
1958 | - if (! $this->em->getConnection()->isTransactionActive()) { |
|
1958 | + if ( ! $this->em->getConnection()->isTransactionActive()) { |
|
1959 | 1959 | throw TransactionRequiredException::transactionRequired(); |
1960 | 1960 | } |
1961 | 1961 | |
@@ -2113,7 +2113,7 @@ discard block |
||
2113 | 2113 | $entity->addPropertyChangedListener($this); |
2114 | 2114 | } |
2115 | 2115 | } else { |
2116 | - if (! isset($hints[Query::HINT_REFRESH]) |
|
2116 | + if ( ! isset($hints[Query::HINT_REFRESH]) |
|
2117 | 2117 | || (isset($hints[Query::HINT_REFRESH_ENTITY]) && $hints[Query::HINT_REFRESH_ENTITY] !== $entity)) { |
2118 | 2118 | return $entity; |
2119 | 2119 | } |
@@ -2161,7 +2161,7 @@ discard block |
||
2161 | 2161 | } |
2162 | 2162 | |
2163 | 2163 | foreach ($class->getDeclaredPropertiesIterator() as $field => $association) { |
2164 | - if (! ($association instanceof AssociationMetadata)) { |
|
2164 | + if ( ! ($association instanceof AssociationMetadata)) { |
|
2165 | 2165 | continue; |
2166 | 2166 | } |
2167 | 2167 | |
@@ -2210,7 +2210,7 @@ discard block |
||
2210 | 2210 | continue; |
2211 | 2211 | } |
2212 | 2212 | |
2213 | - if (! $association->isOwningSide()) { |
|
2213 | + if ( ! $association->isOwningSide()) { |
|
2214 | 2214 | // use the given entity association |
2215 | 2215 | if (isset($data[$field]) && is_object($data[$field]) && |
2216 | 2216 | isset($this->entityStates[spl_object_id($data[$field])])) { |
@@ -2260,7 +2260,7 @@ discard block |
||
2260 | 2260 | $associatedId[$targetField] = $joinColumnValue; |
2261 | 2261 | } |
2262 | 2262 | |
2263 | - if (! $associatedId) { |
|
2263 | + if ( ! $associatedId) { |
|
2264 | 2264 | // Foreign key is NULL |
2265 | 2265 | $association->setValue($entity, null); |
2266 | 2266 | $this->originalEntityData[$oid][$field] = null; |
@@ -2269,7 +2269,7 @@ discard block |
||
2269 | 2269 | } |
2270 | 2270 | |
2271 | 2271 | // @todo guilhermeblanco Can we remove the need of this somehow? |
2272 | - if (! isset($hints['fetchMode'][$class->getClassName()][$field])) { |
|
2272 | + if ( ! isset($hints['fetchMode'][$class->getClassName()][$field])) { |
|
2273 | 2273 | $hints['fetchMode'][$class->getClassName()][$field] = $association->getFetchMode(); |
2274 | 2274 | } |
2275 | 2275 | |
@@ -2286,7 +2286,7 @@ discard block |
||
2286 | 2286 | // If this is an uninitialized proxy, we are deferring eager loads, |
2287 | 2287 | // this association is marked as eager fetch, and its an uninitialized proxy (wtf!) |
2288 | 2288 | // then we can append this entity for eager loading! |
2289 | - if (! $targetClass->isIdentifierComposite() && |
|
2289 | + if ( ! $targetClass->isIdentifierComposite() && |
|
2290 | 2290 | $newValue instanceof GhostObjectInterface && |
2291 | 2291 | isset($hints[self::HINT_DEFEREAGERLOAD]) && |
2292 | 2292 | $hints['fetchMode'][$class->getClassName()][$field] === FetchMode::EAGER && |
@@ -2369,7 +2369,7 @@ discard block |
||
2369 | 2369 | |
2370 | 2370 | public function triggerEagerLoads() |
2371 | 2371 | { |
2372 | - if (! $this->eagerLoadingEntities) { |
|
2372 | + if ( ! $this->eagerLoadingEntities) { |
|
2373 | 2373 | return; |
2374 | 2374 | } |
2375 | 2375 | |
@@ -2378,7 +2378,7 @@ discard block |
||
2378 | 2378 | $this->eagerLoadingEntities = []; |
2379 | 2379 | |
2380 | 2380 | foreach ($eagerLoadingEntities as $entityName => $ids) { |
2381 | - if (! $ids) { |
|
2381 | + if ( ! $ids) { |
|
2382 | 2382 | continue; |
2383 | 2383 | } |
2384 | 2384 | |
@@ -2676,7 +2676,7 @@ discard block |
||
2676 | 2676 | { |
2677 | 2677 | $class = $this->em->getClassMetadata(get_class($entity)); |
2678 | 2678 | |
2679 | - if (! $class->getProperty($propertyName)) { |
|
2679 | + if ( ! $class->getProperty($propertyName)) { |
|
2680 | 2680 | return; // ignore non-persistent fields |
2681 | 2681 | } |
2682 | 2682 | |
@@ -2685,7 +2685,7 @@ discard block |
||
2685 | 2685 | // Update changeset and mark entity for synchronization |
2686 | 2686 | $this->entityChangeSets[$oid][$propertyName] = [$oldValue, $newValue]; |
2687 | 2687 | |
2688 | - if (! isset($this->scheduledForSynchronization[$class->getRootClassName()][$oid])) { |
|
2688 | + if ( ! isset($this->scheduledForSynchronization[$class->getRootClassName()][$oid])) { |
|
2689 | 2689 | $this->scheduleForSynchronization($entity); |
2690 | 2690 | } |
2691 | 2691 | } |
@@ -2767,7 +2767,7 @@ discard block |
||
2767 | 2767 | */ |
2768 | 2768 | private static function objToStr($obj) |
2769 | 2769 | { |
2770 | - return method_exists($obj, '__toString') ? (string) $obj : get_class($obj) . '@' . spl_object_id($obj); |
|
2770 | + return method_exists($obj, '__toString') ? (string) $obj : get_class($obj).'@'.spl_object_id($obj); |
|
2771 | 2771 | } |
2772 | 2772 | |
2773 | 2773 | /** |
@@ -2782,7 +2782,7 @@ discard block |
||
2782 | 2782 | */ |
2783 | 2783 | public function markReadOnly($object) |
2784 | 2784 | { |
2785 | - if (! is_object($object) || ! $this->isInIdentityMap($object)) { |
|
2785 | + if ( ! is_object($object) || ! $this->isInIdentityMap($object)) { |
|
2786 | 2786 | throw ORMInvalidArgumentException::readOnlyRequiresManagedEntity($object); |
2787 | 2787 | } |
2788 | 2788 | |
@@ -2800,7 +2800,7 @@ discard block |
||
2800 | 2800 | */ |
2801 | 2801 | public function isReadOnly($object) |
2802 | 2802 | { |
2803 | - if (! is_object($object)) { |
|
2803 | + if ( ! is_object($object)) { |
|
2804 | 2804 | throw ORMInvalidArgumentException::readOnlyRequiresManagedEntity($object); |
2805 | 2805 | } |
2806 | 2806 | |
@@ -2812,7 +2812,7 @@ discard block |
||
2812 | 2812 | */ |
2813 | 2813 | private function afterTransactionComplete() |
2814 | 2814 | { |
2815 | - $this->performCallbackOnCachedPersister(static function (CachedPersister $persister) { |
|
2815 | + $this->performCallbackOnCachedPersister(static function(CachedPersister $persister) { |
|
2816 | 2816 | $persister->afterTransactionComplete(); |
2817 | 2817 | }); |
2818 | 2818 | } |
@@ -2822,7 +2822,7 @@ discard block |
||
2822 | 2822 | */ |
2823 | 2823 | private function afterTransactionRolledBack() |
2824 | 2824 | { |
2825 | - $this->performCallbackOnCachedPersister(static function (CachedPersister $persister) { |
|
2825 | + $this->performCallbackOnCachedPersister(static function(CachedPersister $persister) { |
|
2826 | 2826 | $persister->afterTransactionRolledBack(); |
2827 | 2827 | }); |
2828 | 2828 | } |
@@ -2832,7 +2832,7 @@ discard block |
||
2832 | 2832 | */ |
2833 | 2833 | private function performCallbackOnCachedPersister(callable $callback) |
2834 | 2834 | { |
2835 | - if (! $this->hasCache) { |
|
2835 | + if ( ! $this->hasCache) { |
|
2836 | 2836 | return; |
2837 | 2837 | } |
2838 | 2838 |