diff -r 000000000000 -r 4eba9c11703f web/Zend/Tool/Project/Context/Zf/BootstrapFile.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/Zend/Tool/Project/Context/Zf/BootstrapFile.php Mon Dec 13 18:29:26 2010 +0100 @@ -0,0 +1,119 @@ +_applicationConfigFile = $this->_resource->getProfile()->search('ApplicationConfigFile'); + $this->_applicationDirectory = $this->_resource->getProfile()->search('ApplicationDirectory'); + + if (($this->_applicationConfigFile === false) || ($this->_applicationDirectory === false)) { + throw new Exception('To use the BootstrapFile context, your project requires the use of both the "ApplicationConfigFile" and "ApplicationDirectory" contexts.'); + } + + + } + + /** + * getContents() + * + * @return array + */ + public function getContents() + { + + $codeGenFile = new Zend_CodeGenerator_Php_File(array( + 'classes' => array( + new Zend_CodeGenerator_Php_Class(array( + 'name' => 'Bootstrap', + 'extendedClass' => 'Zend_Application_Bootstrap_Bootstrap', + )), + ) + )); + + return $codeGenFile->generate(); + } + + public function getApplicationInstance() + { + if ($this->_applicationInstance == null) { + if ($this->_applicationConfigFile->getContext()->exists()) { + define('APPLICATION_PATH', $this->_applicationDirectory->getPath()); + $applicationOptions = array(); + $applicationOptions['config'] = $this->_applicationConfigFile->getPath(); + + $this->_applicationInstance = new Zend_Application( + 'development', + $applicationOptions + ); + } + } + + return $this->_applicationInstance; + } +}