Dieses Blog durchsuchen
Sonntag, 22. November 2015
Magento2 constructors are not realy fair
This is the constructor of
Magento\Customer\Model\Address
I know there are some disadvantages in usage of DI-Container. But a good architecture allows contextbased DI-Container, to prevent this kind of constructor mess. It could sound oldschool, but more then 3 parameter in a constructor is smelly.
This constrcutor contains 18 Parameters.
7 of the parameter are factories. I think its a good idea, to group the factories in a dedicated factory-di-container.
2 of are configobjects
2 are registries
1 Service
and so on.
Thats realy hard to learn and to refactore, if you have to change somethig in there.
What is best practice to prevent that?
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen