-
-
Notifications
You must be signed in to change notification settings - Fork 462
Open
Labels
Description
Since doctrine/orm#10313 we now have a way to extend the automatic mapping of DBAL types.
Similar to \Doctrine\ORM\Configuration::setNamingStrategy
there is now \Doctrine\ORM\Configuration::setTypedFieldMapper
, which is not yet configurable by this bundle afaik.
It would be nice to have it configurable with a service, so we can extend it, like we have for the naming_strategy.
My current workaround to get custom types injected is rather cumbersome, and I'm not even sure if my way is to complicated and there is a much easier way to achieve this. I had to circumvent a lot of private service dependencies to get near the configuration stuff, while preserving all injections:
# services.php
$services->set('app.typed_field_mapper', DefaultTypedFieldMapper::class)
->args([[CustomField::class => 'customfield']]);
$services->set(Doctrine\ORM\Configuration::class)
->public()
->decorate('doctrine.orm.default_configuration', 'doctrine.orm.default_configuration.inner')
->parent('doctrine.orm.default_configuration')
->call('setTypedFieldMapper', [service('app.typed_field_mapper')]);
juliusstoerrle, 0x346e3730 and garak