Example #1
0
 /**
  * Create indexController file
  *
  * @return $this
  */
 private function createControllerFile()
 {
     $namespace = $this->options->get('name');
     if (strtolower(trim($namespace)) == 'default') {
         $namespace = 'MyDefault';
     }
     $builder = new ControllerBuilder(array('name' => 'index', 'controllersDir' => $this->options->get('projectPath') . 'apps/frontend/controllers/', 'namespace' => ucfirst($namespace) . '\\Frontend\\Controllers', 'baseClass' => 'ControllerBase'));
     $builder->build();
     return $this;
 }
 /**
  * Generate controller
  */
 public function createAction()
 {
     if ($this->request->isPost()) {
         $force = $this->request->getPost('force', 'int');
         $controllerName = $this->request->getPost('name', 'string');
         $directory = $this->request->getPost('directory');
         $namespace = $this->request->getPost('namespace');
         $baseClass = $this->request->getPost('baseClass');
         try {
             $controllerBuilder = new ControllerBuilder(array('name' => $controllerName, 'directory' => $directory, 'namespace' => $namespace, 'baseClass' => $baseClass, 'force' => $force, 'controllersDir' => $this->controllersDir));
             $fileName = $controllerBuilder->build();
             $this->flash->success(sprintf('Model "%s" was created successfully', str_replace('.php', '', $fileName)));
             return $this->dispatcher->forward(array('controller' => 'controllers', 'action' => 'edit', 'params' => array($fileName)));
         } catch (BuilderException $e) {
             $this->flash->error($e->getMessage());
         }
     }
     return $this->dispatcher->forward(array('controller' => 'controllers', 'action' => 'index'));
 }
Example #3
0
 /**
  * Run the command
  */
 public function run($parameters)
 {
     $controllerName = $this->getOption(array('name', 1));
     $controllerBuilder = new ControllerBuilder(array('name' => $controllerName, 'directory' => $this->getOption('directory'), 'namespace' => $this->getOption('namespace'), 'baseClass' => $this->getOption('base-class'), 'force' => $this->isReceivedOption('force')));
     return $controllerBuilder->build();
 }
Example #4
0
 /**
  * Create indexController file
  *
  * @return $this
  */
 private function createControllerFile()
 {
     $builder = new ControllerBuilder(['name' => 'index', 'directory' => $this->options->get('projectPath'), 'controllersDir' => $this->options->get('projectPath') . 'app/controllers', 'baseClass' => 'ControllerBase']);
     $builder->build();
     return $this;
 }
Example #5
0
 /**
  * Create indexController file
  *
  * @return $this
  */
 private function createControllerFile()
 {
     $builder = new ControllerBuilder(array('name' => 'index', 'controllersDir' => $this->options->get('projectPath') . 'apps/frontend/controllers/', 'namespace' => ucfirst($this->options->get('name')) . '\\Frontend\\Controllers', 'baseClass' => 'ControllerBase'));
     $builder->build();
     return $this;
 }