This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php

83 lines
2.0 KiB
PHP
Raw Normal View History

<?php
namespace Symfony\Bundle\FrameworkBundle\Console;
use Symfony\Component\Console\Application as BaseApplication;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
removed Symfony\Framework Things have been moved to Symfony\Component\HttpKernel and Symfony\Bundle\FrameworkBundle The kernel configuration namespace was removed and merged with the main web configuration namespace (kernel:config => web:config, kernel:test => web:test, and kernel:session => web:session): Before: <kernel:config charset="UTF-8" error_handler="null" /> <web:config csrf-secret="xxxxxxxxxx"> <web:router resource="%kernel.root_dir%/config/routing.xml" /> <web:validation enabled="true" annotations="true" /> </web:config> After: <web:config csrf-secret="xxxxxxxxxx" charset="UTF-8" error-handler="null"> <web:router resource="%kernel.root_dir%/config/routing.xml" /> <web:validation enabled="true" annotations="true" /> </web:config> Renamed classes: Symfony\{Framework => Bundle\FrameworkBundle}\Cache\Cache Symfony\{Framework => Bundle\FrameworkBundle}\Client Symfony\{Framework => Bundle\FrameworkBundle}\Debug\EventDispatcher Symfony\{Framework => Bundle\FrameworkBundle}\Debug\EventDispatcherTraceableInterface Symfony\{Framework => Bundle\FrameworkBundle}\EventDispatcher Symfony\{Framework => Component\HttpFoundation}\UniversalClassLoader Symfony\{Framework => Component\HttpKernel}\Bundle\Bundle Symfony\{Framework => Component\HttpKernel}\Bundle\BundleInterface Symfony\{Framework => Component\HttpKernel}\ClassCollectionLoader Symfony\{Framework => Component\HttpKernel}\Debug\ErrorException Symfony\{Framework => Component\HttpKernel}\Debug\ErrorHandler Symfony\{Bundle\FrameworkBundle => Component\HttpKernel}\Debug\ExceptionListener Symfony\{Framework => Component\HttpKernel}\Kernel
2010-09-15 19:49:16 +01:00
use Symfony\Component\HttpKernel\Kernel;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* Application.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class Application extends BaseApplication
{
protected $kernel;
/**
* Constructor.
*/
public function __construct(Kernel $kernel)
{
$this->kernel = $kernel;
parent::__construct('Symfony', Kernel::VERSION.' - '.$kernel->getName());
$this->definition->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.'));
if (!$this->kernel->isBooted()) {
$this->kernel->boot();
}
$this->registerCommands();
}
/**
* Gets the Kernel associated with this Console.
*
* @return Kernel A Kernel instance
*/
public function getKernel()
{
return $this->kernel;
}
/**
* Runs the current application.
*
* @param InputInterface $input An Input instance
* @param OutputInterface $output An Output instance
*
* @return integer 0 if everything went fine, or an error code
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
if (true === $input->hasParameterOption(array('--shell', '-s'))) {
$shell = new Shell($this);
$shell->run();
return 0;
}
return parent::doRun($input, $output);
}
protected function registerCommands()
{
foreach ($this->kernel->getBundles() as $bundle) {
$bundle->registerCommands($this);
}
}
}