I created a new Class in src/CollaboratorsBundle/Command, named it GenerateFormRemindersCommand.php and put the following code in it:
<?php
namespace Myproject\CollaboratorsBundle\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
class GenerateFormRemindersCommand extends ContainerAwareCommand{
protected function configure() {
$this->setName("generate:formReminders")
->setDescription('Send reminders by email to all collaborators with unanswered forms');
}
protected function execute(InputInterface $input, OutputInterface $output) {
//some code
}
}
Upon execution, i get the following message :
$ php app/console generate:formReminders
[InvalidArgumentException]
Command "generate:formReminders" is not defined.
I've checked in my AppKernel.php file that my bundle was registered in it and it was.
I've tried adding parent:configure(); to the configure method but without any results.
I've created a few other custom commands that work correctly. I don't get what I am doing wrong in this case. Do you ?
Thanks in advance
I had the same trouble because I named file without "Command" suffix. You have to name your file as 'GenerateFormRemindersCommand.php'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With