开发者

Zend Framework Bootstrap functions from where to get

I find many functions used in Bootstrap class in Zend Framework applications like:

_initRoute()
_initLocal开发者_C百科e()
_initLayout()
.......

but i searched for it's reference but I fond nothing

Zend_Application_Bootstrap_BootstrapAbstract
Zend_Application_Bootstrap_Bootstrap

none of them contains any of these functions.

Where can i find the full reference of that functions?


Basically, these are resource plugins located in library/Zend/Application/Resource/. You may create also your custom ones.

See My detailed answer to very similar question which should fit also to this one.

Also, see BootstrapAbstract.php:

/**
 * Get class resources (as resource/method pairs)
 *
 * Uses get_class_methods() by default, reflection on prior to 5.2.6,
 * as a bug prevents the usage of get_class_methods() there.
 *
 * @return array
 */
public function getClassResources()
{
    if (null === $this->_classResources) {
        if (version_compare(PHP_VERSION, '5.2.6') === -1) {
            $class        = new ReflectionObject($this);
            $classMethods = $class->getMethods();
            $methodNames  = array();

            foreach ($classMethods as $method) {
                $methodNames[] = $method->getName();
            }
        } else {
            $methodNames = get_class_methods($this);
        }

        $this->_classResources = array();
        foreach ($methodNames as $method) {
            if (5 < strlen($method) && '_init' === substr($method, 0, 5)) {
                $this->_classResources[strtolower(substr($method, 5))] = $method;
            }
        }
    }

    return $this->_classResources;
}


These function aren't defined anywhere, just in Bootstrap.php - these are called resource methods. At the bootstraping process, ZF automatically calls each function defined in Bootstrap.php which starts with _init.

Read more here: http://framework.zend.com/manual/en/zend.application.theory-of-operation.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜