Closed chEbba closed 10 years ago
:+1: I think that the best way to do is to use one of the powerful service container's features: tags !
Your bundle can register its custom types by prepending some config: http://symfony.com/doc/current/cookbook/bundles/prepend_extension.html
I don't like the idea of introducing a new concept of type providers in the bundle. And I don't like using fake services either as it would make people think they can inject other services in their types (you cannot)
It will be useful to have an availability defining maping types, ex. have a bundle with many custom types. For now it can be done with appending your types to
doctrine.dbal.connection_factory.types
parameter (it works only if your bundle is loaded after Doctrine one).Tags with CompilerPass are used for similar cases, but as
typesConfig
is just an array it doesn't seem so cool:Use some interface/class and tag it:
Or use some fake services which will be removed on compile
Another way is don't use tags but use some parameter pattern like
doctrine.dbal.types.bundle_name
, collect them with CompilerPass and add todoctrine.dbal.connection_factory.types
.Does anybody interesting in such feature? What implementation will be better?