I'm working on a Symfony2 Command
, and I have an error when I try to run the command in prod
environment, but it work perfectly in dev
:
Everything is fine if I run :
php app/console mycommand:start
When I run
php app/console mycommand:start --env=prod
I get this error :
[LogicException]
The command defined in "NameSpace\Of\MyClassCommand" cannot have an empty name.
Command definition :
services:
my_service.command:
class: NameSpace\Of\MyClassCommand
arguments:
name: mycommand:start
tags:
- { name: console.command }
Command :
class MyClassCommand extends Command
{
/**
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
// logic
}
...
}
As you may notice, I don't overload the __construct
or the configure
methods. I tried but it didn't change anything. Same thing if I clean the cache.
Does anyone have an idea of what could be the difference between the prod
and the dev
environment, to cause this problem ?
Thank you
I finally found the solution, Ruslan you were right : clear the cache.
But I had to manually nuke the cache folder, the cache:clear
command was not enough.