PHP Classes

Then, PDI is now the unique superclass ?

Recommend this page to a friend!

      PHP Dependency Injection Container  >  PHP Dependency Injection Container package blog  >  Improving Your PHP Pr...  >  All threads  >  Then, PDI is now the unique superclass ?  >  (Un) Subscribe thread alerts  
Subject:Then, PDI is now the unique superclass ?
Summary:Then, PDI is now the unique superclass ?
Messages:2
Author:steven
Date:2015-11-09 09:43:00
 

  1. Then, PDI is now the unique superclass ?   Reply   Report abuse  
Picture of steven steven - 2015-11-09 09:43:00
Thank you for this article, it's clear now for me,
and I'm looking forward to read your final article about PDI and Pimple.
Meanwhile I was just wondering : PDI is now the unique superclass of any (injection) dependant class, that's it ?
For instance, the Car class cannot inherit any other class now, apart from PDI.
I can understand that it is not an issue because any other needed dependancy can be injected via PDI. It's a sort of multi-inheritance, but without coupling.
In a sense, it's as if you had modified the "extends" keyword meaning : with "extends PDI", now it means "weak coupled multi-inheritance"...

  2. Re: Then, PDI is now the unique superclass ?   Reply   Report abuse  
Picture of Samuel Adeshina Samuel Adeshina - 2015-11-09 11:28:10 - In reply to message 1 from steven
Yes, there is only one major flaw though and it'd be fixed in the next version of PDI, since PDI is being inherited (or extended as you called it), there's no longer any room for obeying the Single Responsibility Principle. The idea of Dependency Injectors (and service providers) are to enforce the SR principle. PDI follows this principle until its called by another class.

Anyway, the point is still obvious, PDI handles all the "extending" you need to do, it provides each and every objects that your current class (or object) needs so you don't have to do them yourself.

Thanks, can't wait to publish the final article myself :)