Stephane Gosselin
Stephane Gosselin

Reputation: 9148

Symfony required arguments in console comand not working

I am using Symfony's console component, in a command with 1 required option and 1 required argument.

However, upon execution the option and argument are NOT required.

Am I missing something? Relevant code below.

protected function configure()
{
    $this->setName('foo:bar')
         ->setDescription('Some command')
         ->setDefinition(array(
             new InputOption('status', null, InputOption::VALUE_REQUIRED, 'Status to be applied'),
             new InputArgument('ids', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'ids to set status to, space seperated', null)
         ));

}

I expected setDefinition arguments to provide 2 required arguments. This does not seem to be the case.

Upvotes: 4

Views: 1651

Answers (0)

Related Questions