コード例 #1
0
 /**
  * Get Symfony container instead of default registry container.
  * Load container from cache if necessary.
  * {@inheritdoc}
  */
 public function getContainer()
 {
     $options = $this->getOption('bootstrap');
     if (null === $this->_container && $options['container']['type'] == 'symfony') {
         if ($this->_doCache() && $this->_cacheExists()) {
             $cacheFile = $this->_getCacheFile();
             $cacheName = pathinfo($cacheFile, PATHINFO_FILENAME);
             require_once $cacheFile;
             $this->_container = new $cacheName();
         } else {
             $this->_container = new \LoSo\Symfony\Component\DependencyInjection\ContainerBuilder();
             $this->_loadContainer();
             if ($this->_doCache() && !$this->_cacheExists()) {
                 $this->_cacheContainer();
             }
         }
         Zend_Registry::set(self::getRegistryIndex(), $this->_container);
         Zend_Controller_Action_HelperBroker::addHelper(new LoSo_Zend_Controller_Action_Helper_DependencyInjection());
     }
     return parent::getContainer();
 }