PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Zend_Application_Bootstrap_BootstrapAbstract

Zend_Application_Bootstrap_BootstrapAbstract is an abstract class which provides the base functionality of a common bootstrap. It implements both Zend_Application_Bootstrap_Bootstrapper and Zend_Application_Bootstrap_ResourceBootstrapper.

Table 6. Zend_Application_Bootstrap_BootstrapAbstract Methods

Method Return Value Parameters Description
__construct($application) Void
  • $application: required. Accepts either a Zend_Application or a Zend_Application_Bootstrap_Bootstrapper object as the sole argument.

Constructor. Accepts a single argument, which should be a Zend_Application object, or another bootstrap object.

setOptions(array $options) Zend_Application_Bootstrap_Bootstrapper
  • $options: required. Array of options to set.

Any option that has a matching setter will invoke that setter; otherwise, the option will simply be stored for later retrieval. As an example, if your extending class defined a setFoo() method, the option 'foo' would pass the value to that method.

Two additional, special options keys may also be used. pluginPaths may be used to specify prefix paths to plugin resources; it should be an array of class prefix to filesystem path pairs. resources may be used to specify plugin resources to use, and should consist of plugin resource to instantiation options pairs.

getOptions() Array N/A

Returns all options registered via setOptions().

hasOption($key) Boolean
  • $key: required. Option key to test.

Determine if an option key is present.

getOption($key) Mixed
  • $key: required. Option key to retrieve.

Retrieve the value associated with an option key; returns NULL if no option is registered with that key.

setApplication(Zend_Application | Zend_Application_Bootstrap_Bootstrapper $application) Zend_Application_Bootstrap_BootstrapAbstract
  • $application: required.

Register the parent application or bootstrap object.

getApplication() Zend_Application | Zend_Application_Bootstrap_Bootstrapper N/A

Retrieve the application or bootstrap object passed via the constructor.

getEnvironment() String N/A

Retrieve the environment string registered with the parent application or bootstrap object.

getClassResources() Array N/A

Retrieve a list of available resource initializer names as defined in the class. This may be implementation specific.

getContainer() Object N/A

Retrieves the container that stores resources. If no container is currently registered, it registers a Zend_Registry instance before returning it.

setContainer($container) Zend_Application_Bootstrap_BootstrapAbstract
  • $container, required. An object in which to store resources.

Provide a container in which to store resources. When a resource method or plugin returns a value, it will be stored in this container for later retrieval.

hasResource($name) Boolean
  • $name, required. Name of a resource to check.

When a resource method or plugin returns a value, it will be stored in the resource container (see getContainer() and setContainer(). This method will indicate whether or not a value for that resource has been set.

getResource($name) Mixed
  • $name, required. Name of a resource to fetch.

When a resource method or plugin returns a value, it will be stored in the resource container (see getContainer() and setContainer(). This method will retrieve a resources from the container.

bootstrap($resource = null) Mixed
  • $resource: optional.

If $resource is empty, execute all bootstrap resources. If a string, execute that single resource; if an array, execute each resource in the array.

This method can be used to run individual bootstraps either defined in the class itself or via resource plugin classes. A resource defined in the class will be run in preference over a resource plugin in the case of naming conflicts.

run() Void N/A

Defines what application logic to run after bootstrapping.

__call($method, $args) Mixed
  • $method: required. The method name to call.

  • $args: required. Array of arguments to use in the method call.

Provides convenience to bootstrapping individual resources by allowing you to call 'bootstrap<ResourceName>()' instead of using the bootstrap() method.


Zend Framework