3

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

_initRoute()
_initLocale()
_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?

2 Answers 2

6

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;
}
Sign up to request clarification or add additional context in comments.

3 Comments

Indeed the correct answer explained well in the other question!
firstly thank you. well but where can i find all standard resources? for example i need to customize the database adapter, i need to customize layouts .. do i have to search Google every time i need such information? or there are standard methods or resources to be used??
@Ahmed I have updated the answer: The resources are located in library/Zend/Application/Resource/
3

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.