Symfony\Bundle\FrameworkBundle\Console\Application::doRun PHP Method

doRun() public method

Runs the current application.
public doRun ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : integer
$input Symfony\Component\Console\Input\InputInterface An Input instance
$output Symfony\Component\Console\Output\OutputInterface An Output instance
return integer 0 if everything went fine, or an error code
    public function doRun(InputInterface $input, OutputInterface $output)
    {
        $this->kernel->boot();
        $container = $this->kernel->getContainer();
        foreach ($this->all() as $command) {
            if ($command instanceof ContainerAwareInterface) {
                $command->setContainer($container);
            }
        }
        $this->setDispatcher($container->get('event_dispatcher'));
        return parent::doRun($input, $output);
    }

Usage Example

Example #1
0
 public function testBundleCommandsAreRegistered()
 {
     $bundle = $this->createBundleMock(array());
     $kernel = $this->getKernel(array($bundle), true);
     $application = new Application($kernel);
     $application->doRun(new ArrayInput(array('list')), new NullOutput());
     // Calling twice: registration should only be done once.
     $application->doRun(new ArrayInput(array('list')), new NullOutput());
 }
All Usage Examples Of Symfony\Bundle\FrameworkBundle\Console\Application::doRun