コード例 #1
0
 /**
  * Execute a resource and apply custom configurations
  *
  * @param string $resource
  * @return void
  * @throws Zend_Application_Bootstrap_Exception When resource not found
  */
 protected function _executeResource($resource)
 {
     $resourceLower = strtolower($resource);
     // Check if it haven't been yet initialized
     if (!in_array($resourceLower, $this->_run)) {
         // Setup resource in the container
         parent::_executeResource($resource);
         // Check if we have a config method for this resource
         $configMethod = '_config' . $resource;
         if (method_exists($this, $configMethod)) {
             // Get resource from container
             $r = parent::getResource($resource);
             // Flag resource to avoid circular dependencies
             $this->_started[$resourceLower] = true;
             // Configure resource
             $override = $this->{$configMethod}($r);
             if ($override) {
                 $this->setResource($resource, $override);
             }
             // Unflag circular protection
             unset($this->_started[$resourceLower]);
         }
     }
 }