diff --git a/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/src/Symfony/Component/Routing/Generator/UrlGenerator.php index b9e294362d..5c02f2f69d 100644 --- a/src/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -50,6 +50,16 @@ class UrlGenerator implements UrlGeneratorInterface $this->context = $context; } + /** + * Gets the request context. + * + * @return RequestContext The context + */ + public function getContext() + { + return $this->context; + } + /** * Generates a URL from the given parameters. * diff --git a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php index 41660584dd..aa1ddf4db6 100644 --- a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -50,6 +50,16 @@ class UrlMatcher implements UrlMatcherInterface $this->context = $context; } + /** + * Gets the request context. + * + * @return RequestContext The context + */ + public function getContext() + { + return $this->context; + } + /** * Tries to match a URL with a set of routes. * diff --git a/src/Symfony/Component/Routing/Router.php b/src/Symfony/Component/Routing/Router.php index 74a6889b70..6459fc658e 100644 --- a/src/Symfony/Component/Routing/Router.php +++ b/src/Symfony/Component/Routing/Router.php @@ -106,10 +106,22 @@ class Router implements RouterInterface */ public function setContext(RequestContext $context) { + $this->context = $context; + $this->getMatcher()->setContext($context); $this->getGenerator()->setContext($context); } + /** + * Gets the request context. + * + * @return RequestContext The context + */ + public function getContext() + { + return $this->context; + } + /** * Generates a URL from the given parameters. *