Skip to content

Commit

Permalink
add ctl cmd nocache option
Browse files Browse the repository at this point in the history
  • Loading branch information
aviggngyv committed Oct 5, 2017
1 parent 12c3ca3 commit cb074fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions core/command/ControllerCreateCmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Command\Command as BaseCommand;
use Hunter\Core\App\Application;
use Hunter\Core\Utility\StringConverter;
Expand Down Expand Up @@ -197,12 +198,16 @@ protected function interact(InputInterface $input, OutputInterface $output) {
$classMachineName = $this->stringConverter->createMachineName($class);
$routeName = $module . '.' . str_replace("controller", "", $classMachineName) . '_' . $method;

$nocache_question = new ConfirmationQuestion('Enable cache [No]? ', FALSE);
$nocache = $helper->ask($input, $output, $nocache_question);

$routes[] = [
'title' => $title,
'name' => $routeName,
'method' => $method,
'path' => $path,
'args' => $this->getArgumentsFromRoute($path)
'args' => $this->getArgumentsFromRoute($path),
'nocache' => $nocache
];
}

Expand Down
7 changes: 5 additions & 2 deletions core/command/templates/routing-controller.yml.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
defaults:
_controller: '\Hunter\<?php print $module; ?>\Controller\<?php print $class_name; ?>Controller::<?php print $route['method']; ?>'
_title: '<?php print $route['title']; ?>'

<?php endforeach; ?>
<?php if($route['nocache']): ?>
options:
nocache: TRUE
<?php endif; ?>
<?php endforeach; ?>

0 comments on commit cb074fc

Please sign in to comment.