P
P
part_os2020-10-18 22:08:14
symfony
part_os, 2020-10-18 22:08:14

How to pass an argument to a command received from a DI container when executing symfony?

There are commands to run migrations for different connections, I can’t pass an argument that the confirmation command would not ask for execution:
the command to execute:
->setName('tenant:migration')

tried to do this, it doesn’t help, migrations all ask for confirmation.

$command = $this->getApplication()->find('doctrine:migrations:migrate');

        $arguments = [
            '-n' => '-n'
        ];

        $greetInput = new ArrayInput($arguments);
        $returnCode = $command->run($greetInput, $this->output);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2020-10-19
@part_os

$greetInput = new ArrayInput($arguments);
$greetInput->setInteractive(false);

$returnCode = $command->run($greetInput, $this->output);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question