File tree 2 files changed +19
-3
lines changed
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ protected function setTypeToIncrements(bool $supportUnsigned): void
333
333
return ;
334
334
}
335
335
336
- $ this ->type = ColumnType::from (str_replace ('Integer ' , 'Increments ' , $ this ->type ));
336
+ $ this ->type = ColumnType::fromValue (str_replace ('Integer ' , 'Increments ' , $ this ->type ));
337
337
}
338
338
339
339
/**
@@ -357,7 +357,7 @@ protected function setTypeToUnsigned(): void
357
357
return ;
358
358
}
359
359
360
- $ this ->type = ColumnType::from ('unsigned ' . ucfirst ($ this ->type ));
360
+ $ this ->type = ColumnType::fromValue ('unsigned ' . ucfirst ($ this ->type ));
361
361
}
362
362
363
363
/**
Original file line number Diff line number Diff line change @@ -134,6 +134,22 @@ final class ColumnType extends Enum
134
134
public static function fromDBALType (Type $ dbalType ): self
135
135
{
136
136
$ map = Types::BUILTIN_TYPES_MAP + Types::ADDITIONAL_TYPES_MAP ;
137
- return self ::from ($ map [get_class ($ dbalType )]);
137
+ return self ::fromValue ($ map [get_class ($ dbalType )]);
138
+ }
139
+
140
+ /**
141
+ * Initiate an instance from value.
142
+ *
143
+ * @param mixed $value
144
+ * @return static
145
+ */
146
+ public static function fromValue ($ value ): self
147
+ {
148
+ if (method_exists (Enum::class, 'from ' )) {
149
+ return parent ::from ($ value );
150
+ }
151
+
152
+ $ key = self ::search ($ value );
153
+ return self ::__callStatic ($ key , []);
138
154
}
139
155
}
You can’t perform that action at this time.
0 commit comments