diff --git a/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php b/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php index fca0242929..5635f7f032 100644 --- a/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php +++ b/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php @@ -1125,12 +1125,13 @@ protected function addColumnToMappingArray(ORM\Column $columnAnnotation, array $ $mapping['fieldName'] = $fieldName; } - $mapping['type'] = ($columnAnnotation->type === 'string') ? null : $columnAnnotation->type; + $mapping['type'] = $columnAnnotation->type; $mapping['scale'] = $columnAnnotation->scale; $mapping['length'] = $columnAnnotation->length; $mapping['unique'] = $columnAnnotation->unique; $mapping['nullable'] = $columnAnnotation->nullable; $mapping['precision'] = $columnAnnotation->precision; + $mapping['enumType'] = $columnAnnotation->enumType; if ($columnAnnotation->options) { $mapping['options'] = $columnAnnotation->options; diff --git a/Neos.Flow/Tests/Functional/Persistence/FixturesPHP8/EnumForAProperty.php b/Neos.Flow/Tests/Functional/Persistence/FixturesPHP8/EnumForAProperty.php new file mode 100644 index 0000000000..e878136579 --- /dev/null +++ b/Neos.Flow/Tests/Functional/Persistence/FixturesPHP8/EnumForAProperty.php @@ -0,0 +1,9 @@ +embeddedValueObject; } + + public function getEnumForAProperty(): EnumForAProperty + { + return $this->enumForAProperty; + } + + public function setEnumForAProperty(EnumForAProperty $enumForAProperty): void + { + $this->enumForAProperty = $enumForAProperty; + } } diff --git a/Neos.Flow/Tests/Functional/Persistence/PersistenceTestPHP8.php b/Neos.Flow/Tests/Functional/Persistence/PersistenceTestPHP8.php index 32ae4b58dd..a255c180f8 100644 --- a/Neos.Flow/Tests/Functional/Persistence/PersistenceTestPHP8.php +++ b/Neos.Flow/Tests/Functional/Persistence/PersistenceTestPHP8.php @@ -18,6 +18,8 @@ use Neos\Flow\Persistence\Doctrine\QueryResult; use Neos\Flow\Persistence\Exception; use Neos\Flow\Persistence\Exception\ObjectValidationFailedException; +use Neos\Flow\Tests\Functional\Persistence\FixturesPHP8\EnumForAProperty; +use Neos\Flow\Tests\Functional\Persistence\FixturesPHP8\TestEntity; use Neos\Flow\Tests\FunctionalTestCase; use Neos\Utility\ObjectAccess; @@ -721,6 +723,19 @@ public function hasUnpersistedChangesReturnsTrueAfterObjectUpdate() self::assertTrue($this->persistenceManager->hasUnpersistedChanges()); } + public function enumPropertyCanBePersisted() + { + $testEntity = new TestEntity(); + $testEntity->setEnumForAProperty(EnumForAProperty::IS_B); + $this->testEntityRepository->add($testEntity); + $this->persistenceManager->persistAll(); + $this->persistenceManager->clearState(); + + /** @var FixturesPHP8\TestEntity $testEntity */ + $testEntity = $this->testEntityRepository->findAll()->getFirst(); + self::assertEquals(EnumForAProperty::IS_B, $testEntity->getEnumForAProperty()); + } + /** * Helper which inserts example data into the database. *