Example #1
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');
     }
 }