[FrameworkBundle] Added isEnabled to Router commands, fixes #1467
This commit is contained in:
parent
536d9790c3
commit
35a9023b3e
@ -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
|
||||
*/
|
||||
|
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user