[Routing] added setContext() method to both matchers and generators
This commit is contained in:
parent
49793c22d4
commit
ca8c7907e2
@ -41,6 +41,16 @@ class UrlGenerator implements UrlGeneratorInterface
|
||||
$this->cache = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the request context.
|
||||
*
|
||||
* @param array $context The context
|
||||
*/
|
||||
public function setContext(array $context = array())
|
||||
{
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a URL from the given parameters.
|
||||
*
|
||||
|
@ -36,6 +36,16 @@ class ApacheUrlMatcher extends UrlMatcher
|
||||
$this->defaults = $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the request context.
|
||||
*
|
||||
* @param array $context The context
|
||||
*/
|
||||
public function setContext(array $context = array())
|
||||
{
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to match a URL based on Apache mod_rewrite matching.
|
||||
*
|
||||
|
@ -39,6 +39,16 @@ class UrlMatcher implements UrlMatcherInterface
|
||||
$this->defaults = $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the request context.
|
||||
*
|
||||
* @param array $context The context
|
||||
*/
|
||||
public function setContext(array $context = array())
|
||||
{
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to match a URL with a set of routes.
|
||||
*
|
||||
|
@ -94,17 +94,8 @@ class Router implements RouterInterface
|
||||
*/
|
||||
public function setContext(array $context = array())
|
||||
{
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the defaults.
|
||||
*
|
||||
* @param array $defaults The defaults
|
||||
*/
|
||||
public function setDefaults(array $defaults = array())
|
||||
{
|
||||
$this->defaults = $defaults;
|
||||
$this->getMatcher()->setContext($context);
|
||||
$this->getGenerator()->setContext($context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user