Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

Is it possible to "auto" register the transformer without manual register it? #22

@fd6130

Description

@fd6130

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions