Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Structure] static method vs attribute #23

Open
GrinWay opened this issue Dec 19, 2024 · 0 comments
Open

[Structure] static method vs attribute #23

GrinWay opened this issue Dec 19, 2024 · 0 comments

Comments

@GrinWay
Copy link

GrinWay commented Dec 19, 2024

As I noticed you decided to describe from and to classes in the AsMapper attribute
But instead of it you could also define abstract static methods (getFrom, getTo) where you return the same static info

abstract static protected function getFrom(): string;
abstract static protected function getTo(): string;

😏I just was wondering if there is a special idea to use AsMapper instead of describing in in the static mehtods of the interface?
I really hope you'll answer to me😁

Maybe because you assign "micro_mapper.mapper" to the created service. And particularly cuz of this you made up your mind to use the attribute called As*

But as we all know we could use thr following to assign a tag relying on the interface:

ContainerBuilder::registerForAutoconfiguration(
    \Symfonycasts\MicroMapper\MapperInterface::class
)->addTag('micro_mapper.mapper')

Or it's just a question of humans' taste

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant