-
-
Notifications
You must be signed in to change notification settings - Fork 437
Closed
Description
Right now its hardcoded in
maker-bundle/src/Util/ClassSourceManipulator.php
Lines 1116 to 1163 in f76abb1
| private function getEntityTypeHint($doctrineType): ?string | |
| { | |
| switch ($doctrineType) { | |
| case 'string': | |
| case 'text': | |
| case 'guid': | |
| case 'bigint': | |
| case 'decimal': | |
| return 'string'; | |
| case 'array': | |
| case 'simple_array': | |
| case 'json': | |
| case 'json_array': | |
| return 'array'; | |
| case 'boolean': | |
| return 'bool'; | |
| case 'integer': | |
| case 'smallint': | |
| return 'int'; | |
| case 'float': | |
| return 'float'; | |
| case 'datetime': | |
| case 'datetimetz': | |
| case 'date': | |
| case 'time': | |
| return '\\'.\DateTimeInterface::class; | |
| case 'datetime_immutable': | |
| case 'datetimetz_immutable': | |
| case 'date_immutable': | |
| case 'time_immutable': | |
| return '\\'.\DateTimeImmutable::class; | |
| case 'dateinterval': | |
| return '\\'.\DateInterval::class; | |
| case 'object': | |
| case 'binary': | |
| case 'blob': | |
| default: | |
| return null; | |
| } | |
| } |
It would be useful to allow a configuration or any other way to allow user code to extend this type hint mappings. Right now for any fields of doctrine custom types, maker bundle does not generate any type hint for getter and setter methods. Which is expected as Doctrine\DBAL\Types\Type does not have any way to convey php object's type. Its cumbersome to manually add type hint to getter and setter, and its pointless as when regenerating entity (make:entity --regenerate --overwrite) its wiped out anyways.
anupdebnath, christoph-bessei, IndraGunawan, thsmrtone1, tip2tail and 5 more
Metadata
Metadata
Assignees
Labels
No labels