php - Zend Bootstrap class and Resource plugins -


i new zend framework , trying understand how bootstrapping works. far have understood zend_application loads php environment, sets include paths, configures autoloaders , calls bootstrap method of bootstrap class.

the bootstrap method executes resource methods (_init*()) , executes resource plugins.

my question happens if configure same resource using resource method , using resource plugin? example below:

//bootstrap resource method     protected function _initlayout(){           $this->bootstrap('layout');           $layout = $this->getresource('layout');           $layout->setlayout('index');     }  //bootstrap resource plugin resources.layout.layout = "main" 

at present resource plugin called after resource method should overwrite layout , set "main" doesn't happen.

shouldn't plugin resources overwrite settings of our resource methods?

and should use bootstrapping resource methods or resource plugins?

thanks help.

the bootstrap class won't bootstrap resources have been executed, in example resource plugin won't run because created 'layout' resource through class method. if change name of method work expect.

i avoid creating _init methods match plugin names, causes unpredictable problems.

what should use bootstrapping resource methods or resource plugins?

you can use either, it's down personal preference. i'd suggest sticking 1 approach, or perhaps have convention use resource plugins configure standard zf things , methods custom application resources.


Comments