Commit 3d70e833 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

template utilisable + facilement

parent c6d0eb87
Loading
Loading
Loading
Loading
Loading
+8 −13
Changes for code/template/Command.php: 8 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ namespace <namespace>;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

/**
 * Description of <classname>
@@ -13,23 +14,17 @@ use Symfony\Component\Console\Output\OutputInterface;
 */
class <classname> extends SymfonyCommand
{
    protected function execute(InputInterface $input, OutputInterface $output): int
    protected function configure(): void
    {
        // ... put here the code to create the user
        $this->setDescription('... description à adapter ...');
    }

        // this method must return an integer number with the "exit status code"
        // of the command. You can also use these constants to make code more readable

        // return this if there was no problem running the command
        // (it's equivalent to returning int(0))
        return SymfonyCommand::SUCCESS;

        // or return this if some error happened during the execution
        // (it's equivalent to returning int(1))
        // return Command::FAILURE;
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io  = new SymfonyStyle($input, $output);

        // or return this to indicate incorrect command usage; e.g. invalid options
        // or missing arguments (it's equivalent to returning int(2))
        // return Command::INVALID
        return SymfonyCommand::SUCCESS;
    }
}
 No newline at end of file