T
T
theand12019-09-27 19:27:01
symfony
theand1, 2019-09-27 19:27:01

How to pass a parameter to a Symfony command?

I run a console command that takes the id parameter, how can I pass it there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Zemlyanoy, 2019-09-27
@theand1

In the team class

protected function configure()
    {
        $this
            ->setDescription('')
            ->addArgument(
                'id',
                InputArgument::REQUIRED,//InputArgument::OPTIONAL
                'help text'
            );
    }

protected function execute(InputInterface $input, OutputInterface $output) {
    $id = $input->getArgument('id');
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question