I have a Symfony2 application. In one bundle, I have a command class inside a Command folder; then, when I try to execute:
php app/console doctrine:database:[something]
I get:
[InvalidArgumentException]
There are no commands defined in the "doctrine:database" namespace.
BUT, if I rename the Command folder (Command_ for example), the exception does not appear and all runs well, the problem is that I cannot use the command if the Command folder's name isn't 'Command'.
Here's may code:
RunMigrationXCommand.php:
<?php
#!/usr/bin/env php
// app/console
use Symfony\Component\Console\Application;
use eCommerce\MigrationBundle\Command\MigrationXCommand;
$application = new Application();
$application->add(new MigrationXCommand);
$application->run();
And MigrationXCommand.php:
class MigrationXCommand extends ContainerAwareCommand {
protected function configure() {
parent::configure();
$this
->setName('migrationX')
->setDescription('Migration BBDD')
->addArgument(
'argument', InputArgument::OPTIONAL, 'What do you want to migrate?'
);
}
protected function execute(InputInterface $input, OutputInterface $output) {
// ...
}
Any fix?