[FEATURE]

- Added support for custom ExceptionHandlers on group level.
- Routes now contain parent group, if any.
- Fixed wrong usage of required parameter.
This commit is contained in:
Simon Sessingø
2015-11-22 20:24:43 +01:00
parent a9e7a33ff8
commit 8efec07a8b
5 changed files with 63 additions and 29 deletions
+7 -2
View File
@@ -39,12 +39,16 @@ class RouterBase {
}
}
protected function processRoutes(array $routes, array $settings = array(), array $prefixes = array(), $backstack = false) {
protected function processRoutes(array $routes, array $settings = array(), array $prefixes = array(), $backstack = false, $group = null) {
// Loop through each route-request
$activeGroup = null;
/* @var $route RouterEntry */
foreach($routes as $route) {
$route->setGroup($group);
if($this->defaultNamespace && !$route->getNamespace()) {
$namespace = null;
if ($route->getNamespace()) {
@@ -75,6 +79,7 @@ class RouterBase {
$this->currentRoute = $route;
if($route instanceof RouterGroup && is_callable($route->getCallback())) {
$route->renderRoute($this->request);
$activeGroup = $route;
}
$this->currentRoute = null;
@@ -83,7 +88,7 @@ class RouterBase {
$this->backstack = array();
// Route any routes added to the backstack
$this->processRoutes($backstack, $mergedSettings, $newPrefixes, true);
$this->processRoutes($backstack, $mergedSettings, $newPrefixes, true, $activeGroup);
}
}
}