40 lines
1.1 KiB
Twig
40 lines
1.1 KiB
Twig
<?php
|
|
|
|
namespace {{ namespace }}\Command;
|
|
|
|
{% block use_statements %}
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
{% endblock use_statements %}
|
|
|
|
{% block class_definition %}
|
|
class {{ class_name }} extends ContainerAwareCommand
|
|
{% endblock class_definition %}
|
|
{
|
|
{% block class_body %}
|
|
protected function configure()
|
|
{
|
|
$this
|
|
->setName('{{ name }}')
|
|
->setDescription('...')
|
|
->addArgument('argument', InputArgument::OPTIONAL, 'Argument description')
|
|
->addOption('option', null, InputOption::VALUE_NONE, 'Option description')
|
|
;
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$argument = $input->getArgument('argument');
|
|
|
|
if ($input->getOption('option')) {
|
|
// ...
|
|
}
|
|
|
|
$output->writeln('Command result.');
|
|
}
|
|
|
|
{% endblock class_body %}
|
|
}
|