[BUGFIX] Bugfixes

- Made sure that urls are always presented in the correct order
- Ignored RouterGroup in controllerUrlMap
This commit is contained in:
Simon Sessingø
2015-10-11 11:35:56 +02:00
parent 3c3dcdf8df
commit 5c81da7b77
+11 -4
View File
@@ -61,11 +61,13 @@ class RouterBase {
}
$route->addSettings($mergedSettings);
if(!($route instanceof RouterGroup) && is_array($newPrefixes) && count($newPrefixes) && $backstack) {
$route->setUrl( join('/', $newPrefixes) . $route->getUrl() );
}
if(!($route instanceof RouterGroup)) {
if(is_array($newPrefixes) && count($newPrefixes) && $backstack) {
$route->setUrl( join('/', $newPrefixes) . $route->getUrl() );
}
$this->controllerUrlMap[] = $route;
$this->controllerUrlMap[] = $route;
}
$this->currentRoute = $route;
if($route instanceof RouterGroup && is_callable($route->getCallback())) {
@@ -88,6 +90,11 @@ class RouterBase {
$this->processRoutes($this->routes);
// Make sure the urls is in the right order when comparing
usort($this->controllerUrlMap, function($a, $b) {
return strcmp($b->getUrl(), $a->getUrl());
});
foreach($this->controllerUrlMap as $route) {
$routeMatch = $route->matchRoute($this->requestMethod, rtrim($this->requestUri, '/') . '/');