FractalBundle
FractalBundle copied to clipboard
Is it possible to "auto" register the transformer without manual register it?
Not sure does anybody notice this kind of issue or not...
We have to manual register the transformer as a service otherwise we can't use it like this:
$resource = new Collection($users, 'app.transformer.user');
The registeration is kind of redundant cause you need to register for each transformer.
To avoid creating a service definition for each transformer, my alternative way is to make Transformer/ public in config/services.yaml:
config/services.yaml
App\Transformer\:
resource: '../src/Transformer'
public: true
and use class name instead of service id:
$resource = new Collection($users, UserTransformer:class);
But what i am thinking is, it is possible for us to somehow "auto" register it without adding those config by ourself?