Category: oop

How can I create a new MyService() with autowire?

I love autowiring, it’s definitely the most elegant dependency management solution I’ve ever seen. I would love to also use it when instantiating new objects. Consider the following service: class MyService() { public function __construct(Dependency1 $var1, Dependency99 $var99) { ……

Is this a good or a bad practice to use parent construct method on each child? [closed]

I am trying to create a Widget service. I have Widget class and his his children: ContactWidget, TestimonialWidget etc. They are depend from TemplateService and from User class. So using OOP features i can do it this way: Class Widget…