DEV Community

Discussion on: Domain-Driven Design - The Factory in PHP

 
coajaxial profile image
Fluttershy

Because the factory gets its dependencies through the constructor - the most used way to inject dependencies. You can see the factory more as a service. On the other hand, the factory method gets both dependencies and data. This is hard or even impossible to configure in a standard dependency injection container.