0

what's the diff:

$application = new Zend_Application(...);
$application->bootstrap()->run();

$application = new Zend_Application(...);
$application->run();

why we need call ->bootstrape then call ->run? why not just call application->run ?

1 Answer 1

2

from the Zend Sources class:Zend_Application, file:application.php

public function bootstrap($resource = null)
{
    $this->getBootstrap()->bootstrap($resource);
    return $this;
}

public function run()
{
    $this->getBootstrap()->run();
}

The first sample

$application = new Zend_Application(...);
$application->bootstrap()->run();

calls Zend_Application_Bootstrap_Bootstrap::bootstrap method which ends up loading all the resources.
Then it calls Zend_Application_Bootstrap_Bootstrap::run() which actually dispatches the request.

The second sample

$application = new Zend_Application(...);
$application->run();

according to the code above is skipping the first step, so it will try to run (dispatch the request) without actually loading the resources. This is how Zend describes bootstrapping and resources.

Sign up to request clarification or add additional context in comments.

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.