0

This is how its supposed to be done according to the documentation

protected function execute(InputInterface $input, OutputInterface $output)
{
    $command = $this->getApplication()->find('demo:greet');

    $arguments = array(
        'command' => 'demo:greet',
        'name'    => 'Fabien',
        '--yell'  => true,
    );

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

    // ...
}

What I want to do is call the command: "php app/console cjw:check-symlinks --vendor=Acme"

but it doesn't work, here's the code:

$command = $this->getApplication()->find('cjw:check-symlinks');

$arguments = array(
    '--vendor'=>'Jac',
);

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

It interrupts the execution and throws the following error:

[RuntimeException] Not enough arguments.

1 Answer 1

2

You need to provide all arguments. Command name at least:

$command = $this->getApplication()->find('cjw:check-symlinks');

$arguments = array(
    'command' => 'cjw:check-symlinks',
    // other arguments, depending on cjw:check-symlinks definition 
    '--vendor'=>'Jac',
);

$Input = new ArrayInput($arguments);
$returnCode = $command->run($Input, $output);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.