Skip to content

[Structure] static method vs attribute #23

Open
@GrinWay

Description

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions