News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Kevin Schroeder's Blog:
Handling ZF2 FQ Dependency Setter Injections
May 02, 2012 @ 09:54:09

Kevin Schroeder has a new post in his series looking at dependency injection in Zend Framework v2 applications. In this new post he shows how to work with setter injections that coordinate to properties in the class.

In a previous article I showed how you could pass in a fully qualified parameter name into the Dependency Injection Container (DiC) if you needed to be specific about where you need to have something injected. There is an alternate method here that is cleaner than what I did before.

He illustrates with a "Test" class that has a "$test" property and shows how to, using the ZendDi component, inject the class into the container. Using the "injections" configuration value, he uses the "setTest" method to push a value into the "Test" class instance in the "$test" variable.

0 comments voice your opinion now!
dependency injection container zendframework2 setter injection configuration


blog comments powered by Disqus

Similar Posts

MaltBlue.com: Are TableGateways Worth it in Zend Framework 2?

Kevin Schroeder's Blog: ZF2 Dependency Injection: Managing Configuration - Part 1

Martin Shwalbe: Getting Started with REST and Zend Framework 2

Migrating to ZF2: Integrating Composer and DoctrineORMModule

Hardened-PHP Project: Dotdeb PHP Email Header Injection Vulnerability


Community Events





Don't see your event here?
Let us know!


opinion refactor laravel code interview series install podcast wordpress developer configure language list testing community unittest release framework introduction threedevsandamaybe

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework