예제 #1
0
 /**
  * 
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // get template maker
     $templateMaker = new TemplateMaker();
     // get controller name
     $overwrite = $input->getOption('overwrite');
     $create = ucfirst($input->getOption('create'));
     $delete = ucfirst($input->getOption('delete'));
     // create
     if ($create) {
         // set template
         $templateMaker->setTemplate('batch');
         $templateMaker->set('batch', $create);
         $templateMaker->create($this->container->getParameter('pcb.root_dir') . 'Libraries/Batch/' . $create . '.php', $overwrite ? true : false);
         // show grettings
         $output->writeln("<fg=green>Batch: <fg=white>{$create} created successfully.</fg=white></fg=green>");
     }
     // delete
     if ($delete) {
         // remove controller
         @unlink($this->container->getParameter('pcb.root_dir') . 'Libraries/Batch/' . $delete . '.php');
         // show grettings
         $output->writeln("<fg=green>Batch: <fg=white>{$delete} deleted successfully.</fg=white></fg=green>");
     }
 }
예제 #2
0
 /**
  * 
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // get template maker
     $templateMaker = new TemplateMaker();
     // get controller name
     $overwrite = $input->getOption('overwrite');
     $create = ucfirst($input->getOption('create'));
     $delete = ucfirst($input->getOption('delete'));
     // create a controller
     if ($create) {
         // set template
         $controller_loc = $this->container->getParameter('pcb.root_dir') . 'Controllers/' . $create . 'Controller.php';
         $templateMaker->setTemplate('controller');
         $templateMaker->set('namespace', $create);
         $templateMaker->set('controller', $create . 'Controller');
         $templateMaker->create($controller_loc, $overwrite ? true : false);
         // create a view file
         $templateMaker->setTemplate('view');
         $templateMaker->create($this->container->getParameter('pcb.root_dir') . 'Views/' . $create . '/index.php');
         // show grettings
         $output->writeln("<fg=green>Controller/View: <fg=white>{$create} created successfully.</fg=white></fg=green>");
     }
     // delete a controller
     if ($delete) {
         // remove controller
         @unlink($this->container->getParameter('pcb.root_dir') . 'Controllers/' . $delete . 'Controller.php');
         // loop though all view files and delete them
         foreach (glob($this->container->getParameter('pcb.root_dir') . 'Views/' . $delete . '/*.*') as $file) {
             @unlink($file);
         }
         // remove view folder
         @rmdir($this->container->getParameter('pcb.root_dir') . 'Views/' . $delete . '/');
         // show grettings
         $output->writeln("<fg=green>Controller/View: <fg=white>{$delete} deleted successfully.</fg=white></fg=green>");
     }
 }
예제 #3
0
 /**
  * 
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // get template maker
     $templateMaker = new TemplateMaker();
     // get controller name
     $overwrite = $input->getOption('overwrite');
     $create = ucfirst($input->getOption('create'));
     $delete = ucfirst($input->getOption('delete'));
     // create a controller
     if ($create) {
         // create a view file
         $templateMaker->setTemplate('view');
         $templateMaker->create($this->container->getParameter('pcb.root_dir') . 'Views/' . $create . '.php');
         // show grettings
         $output->writeln("<fg=green>View: <fg=white>{$create} created successfully.</fg=white></fg=green>");
     }
     // delete a controller
     if ($delete) {
         // remove view folder
         @unlink($this->container->getParameter('pcb.root_dir') . 'Views/' . $delete . '.php');
         // show grettings
         $output->writeln("<fg=green>View: <fg=white>{$delete} deleted successfully.</fg=white></fg=green>");
     }
 }