Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Kevin Schroeder’s Blog: ZF2 Dependency Injection: Managing Configuration – Part 1

Kevin Schroeder’s Blog: ZF2 Dependency Injection: Managing Configuration – Part 1

Kevin Schroeder has a new post talking about dependency injection in a Zend Framework v2-based application and managing your configurations.

In my previous blog post I showed how you could provide parameters to object that you’re pulling from a DiC and have them populated in the resulting object. As cool as that is, it’s not a massive saving as you need to manually inject the parameters into the DiC. You can often do the same thing by setting up the DiC ahead of time to get the object with those parameters pre-set.

He defines a class (Test) and shows how you can replace the DI container example with a ZendDiConfiguration object that contains the config options. He shows how to use this newly created container to access an instance of this “Test” class.

Source: http://www.phpdeveloper.org/news/17868

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Posted Kwiecień 30th, 2012 in WEB and PHP Development.

Leave a response: