Jiew Meng
Jiew Meng

Reputation: 88197

Zend Framework : Get bootstrap resource from anywhere in application

i wonder how do i get any bootstrap resource from anywhere in the application. eg. Zend_Validate, Zend_Auth_Adapter etc?

Upvotes: 12

Views: 7909

Answers (2)

homelessDevOps
homelessDevOps

Reputation: 20726

$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
$resource = $bootstrap->getResource('whatEver')

Upvotes: 25

Daniel Egeberg
Daniel Egeberg

Reputation: 8382

Have a look at this: http://weierophinney.net/matthew/archives/235-A-Simple-Resource-Injector-for-ZF-Action-Controllers.html

That will make it easy passing it to the controller. From the controller you can then pass individual resources to the other things you need.

Upvotes: 2

Related Questions