diff --git a/src/Application/Routers/Route.php b/src/Application/Routers/Route.php index bd374ed07..b58142f55 100644 --- a/src/Application/Routers/Route.php +++ b/src/Application/Routers/Route.php @@ -21,7 +21,6 @@ * @property-read string $mask * @property-read array $defaults * @property-read int $flags - * @property-read string|FALSE $targetPresenter */ class Route extends Nette\Object implements Application\IRouter { @@ -674,12 +673,12 @@ public function getFlags() /** * Proprietary cache aim. * @internal - * @return string|FALSE + * @return string[]|NULL */ - public function getTargetPresenter() + public function getTargetPresenters() { if ($this->flags & self::ONE_WAY) { - return FALSE; + return array(); } $m = $this->metadata; @@ -689,14 +688,14 @@ public function getTargetPresenter() if (isset($m[self::MODULE_KEY]['fixity']) && $m[self::MODULE_KEY]['fixity'] === self::CONSTANT) { $module = $m[self::MODULE_KEY][self::VALUE] . ':'; } else { - return NULL; + return; } } if (isset($m[self::PRESENTER_KEY]['fixity']) && $m[self::PRESENTER_KEY]['fixity'] === self::CONSTANT) { - return $module . $m[self::PRESENTER_KEY][self::VALUE]; + return array($module . $m[self::PRESENTER_KEY][self::VALUE]); } - return NULL; + return; } diff --git a/src/Application/Routers/RouteList.php b/src/Application/Routers/RouteList.php index d612bc97b..588776b2c 100644 --- a/src/Application/Routers/RouteList.php +++ b/src/Application/Routers/RouteList.php @@ -62,22 +62,14 @@ public function constructUrl(Nette\Application\Request $appRequest, Nette\Http\U $routes['*'] = array(); foreach ($this as $route) { - $presenter = $route instanceof Route ? $route->getTargetPresenter() : NULL; + $presenters = $route instanceof Route && is_array($tmp = $route->getTargetPresenters()) + ? $tmp : array_keys($routes); - if ($presenter === FALSE) { - continue; - } - - if (is_string($presenter)) { + foreach ($presenters as $presenter) { if (!isset($routes[$presenter])) { $routes[$presenter] = $routes['*']; } $routes[$presenter][] = $route; - - } else { - foreach ($routes as $id => $foo) { - $routes[$id][] = $route; - } } }