diff --git a/ContentAwareGenerator.php b/ContentAwareGenerator.php index 107b580e..d8d8545b 100644 --- a/ContentAwareGenerator.php +++ b/ContentAwareGenerator.php @@ -248,7 +248,7 @@ public function getRouteDebugMessage($name, array $parameters = array()) } if ($name instanceof RouteReferrersReadInterface) { - return 'Route aware content ' . $name; + return 'Route aware content ' . parent::getRouteDebugMessage($name, $parameters); } return parent::getRouteDebugMessage($name, $parameters); diff --git a/ProviderBasedGenerator.php b/ProviderBasedGenerator.php index a3947133..bbdc5f15 100644 --- a/ProviderBasedGenerator.php +++ b/ProviderBasedGenerator.php @@ -65,6 +65,14 @@ public function supports($name) */ public function getRouteDebugMessage($name, array $parameters = array()) { + if (is_scalar($name)) { + return $name; + } + + if (is_array($name)) { + return serialize($name); + } + if ($name instanceof RouteObjectInterface) { return 'Route with key ' . $name->getRouteKey(); } @@ -73,7 +81,7 @@ public function getRouteDebugMessage($name, array $parameters = array()) return 'Route with pattern ' . $name->getPattern(); } - return $name; + return get_class($name); } } diff --git a/Tests/Routing/ContentAwareGeneratorTest.php b/Tests/Routing/ContentAwareGeneratorTest.php index d6802fd3..66d7ff86 100644 --- a/Tests/Routing/ContentAwareGeneratorTest.php +++ b/Tests/Routing/ContentAwareGeneratorTest.php @@ -391,7 +391,7 @@ public function testSupports() public function testGetRouteDebugMessage() { $this->assertContains('/some/content', $this->generator->getRouteDebugMessage(null, array('content_id' => '/some/content'))); - $this->assertContains('/some/content', $this->generator->getRouteDebugMessage(new RouteAware())); + $this->assertContains('Route aware content Symfony\Cmf\Component\Routing\Tests\Routing\RouteAware', $this->generator->getRouteDebugMessage(new RouteAware())); $this->assertContains('/some/content', $this->generator->getRouteDebugMessage('/some/content')); } } @@ -413,8 +413,4 @@ public function getRoutes() { return array(); } - public function __toString() - { - return '/some/content'; - } }