From d91e5a26a27cc6d3575075beb4f573177a715957 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 25 Apr 2012 03:14:38 +0200 Subject: [PATCH] [Routing] fixed Route annotation for hostname (should be hostname_pattern instead of hostnamePattern) --- src/Symfony/Component/Routing/Annotation/Route.php | 2 +- src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Routing/Annotation/Route.php b/src/Symfony/Component/Routing/Annotation/Route.php index 84c15fc2f7..e593f97ff6 100644 --- a/src/Symfony/Component/Routing/Annotation/Route.php +++ b/src/Symfony/Component/Routing/Annotation/Route.php @@ -44,7 +44,7 @@ class Route } foreach ($data as $key => $value) { - $method = 'set'.$key; + $method = 'set'.str_replace('_', '', $key); if (!method_exists($this, $method)) { throw new \BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $key, get_class($this))); } diff --git a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php index ff3c20c26d..e1da002700 100644 --- a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php @@ -39,7 +39,8 @@ class RouteTest extends \PHPUnit_Framework_TestCase array('requirements', array('_method' => 'GET'), 'getRequirements'), array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults'), + array('hostname_pattern', array('{locale}.example.com'), 'getHostnamePattern') ); } }