File tree Expand file tree Collapse file tree
tests/Doctrine/Tests/ORM/Tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -781,12 +781,18 @@ private function gatherRelationJoinColumns(
781781 */
782782 private function gatherColumnOptions (array $ mapping ): array
783783 {
784- if (! isset ($ mapping ['options ' ])) {
784+ $ mappingOptions = $ mapping ['options ' ] ?? [];
785+
786+ if (isset ($ mapping ['enumType ' ])) {
787+ $ mappingOptions ['enumType ' ] = $ mapping ['enumType ' ];
788+ }
789+
790+ if (empty ($ mappingOptions )) {
785791 return [];
786792 }
787793
788- $ options = array_intersect_key ($ mapping [ ' options ' ] , array_flip (self ::KNOWN_COLUMN_OPTIONS ));
789- $ options ['customSchemaOptions ' ] = array_diff_key ($ mapping [ ' options ' ] , $ options );
794+ $ options = array_intersect_key ($ mappingOptions , array_flip (self ::KNOWN_COLUMN_OPTIONS ));
795+ $ options ['customSchemaOptions ' ] = array_diff_key ($ mappingOptions , $ options );
790796
791797 return $ options ;
792798 }
Original file line number Diff line number Diff line change 3535use Doctrine \Tests \Models \CompositeKeyInheritance \JoinedDerivedChildClass ;
3636use Doctrine \Tests \Models \CompositeKeyInheritance \JoinedDerivedIdentityClass ;
3737use Doctrine \Tests \Models \CompositeKeyInheritance \JoinedDerivedRootClass ;
38+ use Doctrine \Tests \Models \Enums \Card ;
39+ use Doctrine \Tests \Models \Enums \Suit ;
3840use Doctrine \Tests \Models \Forum \ForumAvatar ;
3941use Doctrine \Tests \Models \Forum \ForumUser ;
4042use Doctrine \Tests \Models \NullDefault \NullDefaultColumn ;
@@ -189,6 +191,23 @@ public function testNullDefaultNotAddedToCustomSchemaOptions(): void
189191 self ::assertSame ([], $ customSchemaOptions );
190192 }
191193
194+ /**
195+ * @requires PHP 8.1
196+ */
197+ public function testEnumTypeAddedToCustomSchemaOptions (): void
198+ {
199+ $ em = $ this ->getTestEntityManager ();
200+ $ schemaTool = new SchemaTool ($ em );
201+
202+ $ customSchemaOptions = $ schemaTool ->getSchemaFromMetadata ([$ em ->getClassMetadata (Card::class)])
203+ ->getTable ('Card ' )
204+ ->getColumn ('suit ' )
205+ ->getCustomSchemaOptions ();
206+
207+ self ::assertArrayHasKey ('enumType ' , $ customSchemaOptions );
208+ self ::assertSame (Suit::class, $ customSchemaOptions ['enumType ' ]);
209+ }
210+
192211 /**
193212 * @group DDC-3671
194213 */
You can’t perform that action at this time.
0 commit comments