Exemple #1
0
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 private function _loadContextClassesIntoRegistry($contextClasses)
 {
     $registry = ZendL_Tool_Project_Structure_Context_Registry::getInstance();
     foreach ($contextClasses as $contextClass) {
         $registry->addContextClass($contextClass);
     }
 }
Exemple #3
0
 public function create($name, $viewincluded = true)
 {
     $structureGraph = $this->_getExistingStructureGraph();
     $controllersDirectoryNode = $structureGraph->findNodeByContext('controllersDirectory');
     $controllerFileContext = ZendL_Tool_Project_Structure_Context_Registry::getInstance()->getContext('controllerFile');
     $newNode = new ZendL_Tool_Project_Structure_Node($controllerFileContext);
     $newNode->setBaseDirectory($controllersDirectoryNode->getContext()->getPath());
     $newNode->setControllerName($name);
     echo 'Creating new controller named \'' . $name . '\'' . PHP_EOL;
     $newNode->create();
     $controllersDirectoryNode->append($newNode);
     $this->_storeLoadedStructureGraph();
     if ($viewincluded) {
         $viewProvider = ZendL_Tool_Rpc_Provider_Registry::getInstance()->getProvider('View');
         $viewProvider->create($name, 'index');
     }
 }
Exemple #4
0
 public function create($controllerName, $actionName)
 {
     $structureGraph = $this->_getExistingStructureGraph();
     $viewScriptsDirectoryNode = $structureGraph->findNodeByContext(array('viewsDirectory', 'viewScriptsDirectory'));
     $newViewControllerScriptsDirectoryContext = ZendL_Tool_Project_Structure_Context_Registry::getInstance()->getContext('ViewControllerScriptsDirectory');
     $newViewControllerScriptsDirectoryContext->setForControllerName($controllerName);
     $newViewScriptFileContext = ZendL_Tool_Project_Structure_Context_Registry::getInstance()->getContext('ViewScriptFile');
     $newViewScriptFileContext->setScriptName($actionName);
     $newViewControllerScriptsDirectoryNode = new ZendL_Tool_Project_Structure_Node($newViewControllerScriptsDirectoryContext);
     $newViewScriptFileNode = new ZendL_Tool_Project_Structure_Node($newViewScriptFileContext);
     $newViewControllerScriptsDirectoryNode->append($newViewScriptFileNode);
     $newViewControllerScriptsDirectoryNode->recursivelySetBaseDirectory($viewScriptsDirectoryNode->getPath());
     $newViewControllerScriptsDirectoryNode->recursivelyCreate();
     $viewScriptsDirectoryNode->append($newViewControllerScriptsDirectoryNode);
     echo 'Creating a view script.' . PHP_EOL;
     $this->_storeLoadedStructureGraph();
 }