I want to execute the command fos:elastica:populate from my controller.
I tried that code but it doesn't work, i get error = 1 the var_dump show ""
$command = 'fos:elastica:populate';
$app = new Application($this->get('kernel'));
$app->setAutoExit(false);
$input = new StringInput($command);
$output = new ConsoleOutput;
$error = $app->run($input, $output);
var_dump($error);
var_dump(stream_get_contents($output->getStream());
Any ideas ?
I try a different code.....
$command = $this->get('FosElasticaPopulateService');
$input = new StringInput('');
$output = new ConsoleOutput();
ladybug_dump($input);
// Run the command
$retval = $command->run($input, $output);
if(!$retval)
{
echo "Command executed successfully!\n";
}
else
{
echo "Command was not successful.\n";
}
var_dump(stream_get_contents($output->getStream()));
It say: 'The "no-interaction" option does not exist.' at Input ->getOption ('no-interaction') in the PopulateCommand.
if i change my code with:
$input = new StringInput('--no-interaction');
It say:
'The "--no-interaction" option does not exist.'
at
'ArgvInput ->addLongOption ('no-interaction', null) '