@@ -105,26 +105,6 @@ public function processNode(Node $node, Scope $scope): array
105
105
$ writableToPropertyType = $ descriptor ->getWritableToPropertyType ();
106
106
$ writableToDatabaseType = $ descriptor ->getWritableToDatabaseType ();
107
107
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
-
128
108
$ enumTypeString = $ fieldMapping ['enumType ' ] ?? null ;
129
109
if ($ enumTypeString !== null ) {
130
110
if ($ writableToDatabaseType ->isArray ()->no () && $ writableToPropertyType ->isArray ()->no ()) {
@@ -179,6 +159,24 @@ public function processNode(Node $node, Scope $scope): array
179
159
), ...TypeUtils::getAccessoryTypes ($ writableToDatabaseType ));
180
160
181
161
}
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
+ }
182
180
}
183
181
184
182
$ identifiers = [];
0 commit comments