2009年5月6日星期三

[fw-mvc] Zend_Application and bootstrap options

I'm going through the documentation on Zend_Application and am trying to figure out how to pass options from my application.ini file to my protected _init* methods.

According to the docs: "First, you can write methods prefixed with _init to specify discrete code to bootstrap. These methods will be called by bootstrap(), and can also be called as if they were public methods: bootstrap<resource>(). They should accept an optional array of options."

My question is about that last sentence. Where does this array of options come from?

I've tried updating my application.ini file with some options like this:

; autoload
resources.autoload.includeFileCache = APPLICATION_PATH "/data/pluginLoaderCache.php"

Then in my Bootstrap.php file I added this method:

protected function _initAutoload(array $options = array())
{
    Zend_Debug::dump($options); // empty array
    Zend_Debug::dump($this->_options['resources']['autoload']); // option exists
}

Is there a way to read that config setting without manually traversing $this->_options? I'm using the 1.8.0 tag of ZF.

-Hector

没有评论: