I have the following command, which successfully prints styled messages to the bash terminal when called:
class DoSomethingCommand extends Command
{
protected function configure()
{
$this->setName('do:something')
->setDescription('Does a thing');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('About to do something ... ');
$io->success('Done doing something.');
}
}
... but when I add the following in services.yml in order to try to define my command as a service ...
services:
console_command.do_something:
class: AppBundle\Command\DoSomethingCommand
arguments:
- "@doctrine.orm.entity_manager"
tags:
- { name: console.command }
... I get this error:
Warning: preg_match() expects parameter 2 to be string, object given in src/app/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:665
What am I doing wrong here?