I\'m wondering how can I run Symfony 2 command from browser query or from controller.
Its because I don\'t have any possibility on hosting to run it
In my environment ( Symony 2.1 ) I had to do some modifications to @Reuven solution to make it work. Here they are:
Service definition - no changes.
In controller:
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
...
public function myAction() {
$command = $this->get('MyCommandService');
$input = new ArgvInput(array('arg1'=> 'value'));
$output = new ConsoleOutput();
$command->run($input, $output);
}