@@ -105,26 +105,6 @@ public function processNode(Node $node, Scope $scope): array
105105 $ writableToPropertyType = $ descriptor ->getWritableToPropertyType ();
106106 $ writableToDatabaseType = $ descriptor ->getWritableToDatabaseType ();
107107
108- if ($ fieldMapping ['type ' ] === 'enum ' ) {
109- $ values = $ fieldMapping ['options ' ]['values ' ] ?? null ;
110- if (is_array ($ values )) {
111- $ enumTypes = [];
112- foreach ($ values as $ value ) {
113- if (!is_string ($ value )) {
114- $ enumTypes = [];
115- break ;
116- }
117- 118- $ enumTypes [] = new ConstantStringType ($ value );
119- }
120- 121- if (count ($ enumTypes ) > 0 ) {
122- $ writableToPropertyType = new UnionType ($ enumTypes );
123- $ writableToDatabaseType = new UnionType ($ enumTypes );
124- }
125- }
126- }
127- 128108 $ enumTypeString = $ fieldMapping ['enumType ' ] ?? null ;
129109 if ($ enumTypeString !== null ) {
130110 if ($ writableToDatabaseType ->isArray ()->no () && $ writableToPropertyType ->isArray ()->no ()) {
@@ -179,6 +159,24 @@ public function processNode(Node $node, Scope $scope): array
179159 ), ...TypeUtils::getAccessoryTypes ($ writableToDatabaseType ));
180160
181161 }
162+ } elseif ($ fieldMapping ['type ' ] === 'enum ' ) {
163+ $ values = $ fieldMapping ['options ' ]['values ' ] ?? null ;
164+ if (is_array ($ values )) {
165+ $ enumTypes = [];
166+ foreach ($ values as $ value ) {
167+ if (!is_string ($ value )) {
168+ $ enumTypes = [];
169+ break ;
170+ }
171+ 172+ $ enumTypes [] = new ConstantStringType ($ value );
173+ }
174+ 175+ if (count ($ enumTypes ) > 0 ) {num
176+ $ writableToPropertyType = new UnionType ($ enumTypes );
177+ $ writableToDatabaseType = new UnionType ($ enumTypes );
178+ }
179+ }
182180 }
183181
184182 $ identifiers = [];
0 commit comments