How to do Dependency Injection in PHP vs Java.
Plain PHP:
$helper_sales = new HelperSales();
// no type information!
$helper_sales = Mage::helper('sales');
Java / CDI :
@Inject
private HelperSales helperSales;
Java / get bean from Spring context :
HelperSales helperSales = appCtx.getBean(HelperSales.class);
The Java examples apply to Scala as well, of course.
Still envy PHP?
No comments:
Post a Comment