[FrameworkBundle] Added isEnabled to Router commands, fixes #1467

This commit is contained in:
Jordi Boggiano 2011-06-29 00:18:41 +02:00
parent 536d9790c3
commit 35a9023b3e
2 changed files with 32 additions and 0 deletions

View File

@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper;
use Symfony\Component\Routing\RouterInterface;
/**
* RouterApacheDumperCommand.
@ -25,6 +26,21 @@ use Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper;
*/
class RouterApacheDumperCommand extends ContainerAwareCommand
{
/**
* {@inheritDoc}
*/
public function isEnabled()
{
if (!$this->getContainer()->has('router')) {
return false;
}
$router = $this->getContainer()->get('router');
if (!$router instanceof RouterInterface) {
return false;
}
return parent::isEnabled();
}
/**
* @see Command
*/

View File

@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper;
use Symfony\Component\Routing\RouterInterface;
/**
* A console command for retrieving information about routes
@ -25,6 +26,21 @@ use Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper;
*/
class RouterDebugCommand extends ContainerAwareCommand
{
/**
* {@inheritDoc}
*/
public function isEnabled()
{
if (!$this->getContainer()->has('router')) {
return false;
}
$router = $this->getContainer()->get('router');
if (!$router instanceof RouterInterface) {
return false;
}
return parent::isEnabled();
}
/**
* @see Command
*/