News Feed
Sections




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

Matthew Weier O'Phinney's Blog:
A Simple Resource Injector for ZF Action Controllers
March 22, 2010 @ 15:17:50

Matthew Weier O'Phinney has posted an answer to a request a fellow PHP community member had about using bootstrap resources in actions in your Zend Framework application. This post shows how it can be done in a proof of concept.

Basically, he'd like to see any resource initialized by the bootstrap immediately available as simply a public member of his action controller. So, for instance, if you were using the "DB" resource in your application, your controller could access it via $this->db. I quickly drafted up a proof of concept for him using an action helper.

The resource injection helper extends the Zend_Controller_Action_Helper_Abstract and allows you to name the resources you'd like pushed into the controller as a part of the bootstrap process. There's an issue with the approach, though - lack of controller over what's actually injected so he modified it to push the dependency list in from the controller rather than limiting it to the bootstrap.

0 comments voice your opinion now!
zendframework resource injection action controller


blog comments powered by Disqus

Similar Posts

Stoimen.com: Iterate over YouTube Channel with Zend_Gdata_YouTube

MaltBlue.com: Hot to Use the Zend Form ViewScript Decorator in All Modules

Voices of the ElePHPant: Interview with Matthew Weier O’Phinney and Ralph Schindler

Zend Developer Zone: Using Zend_Tool to start up your ZF Project

Slawek Lukasiewicz's Blog: Zend Framework: Reflection


Community Events





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


api community language interview developer laravel zendserver series development tips release deployment application podcast code framework list threedevsandamaybe introduction conference

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