Skip to content

InvalidLinkException when switching from Nette 2.4 to 3.0 #3

@milo

Description

@milo

Description

I'm migrating app to Nette v3 and I'm getting InvalidLinkException with No route for Auth:Sign:in(). The match() pass and presenter runs, but building links by constructUrl() fails.

Steps To Reproduce

Router factory looks like:

$router = new RouteList;
$router[] = new Route('auth/<presenter>[/<action>[/<id>]]', [
        'module' => 'Auth',
        'presenter' => 'Homepage',
        'action' => 'default',
]);
$router[] = new Route('<presenter>[/<action>[/<id>]]', [
        'module' => 'Default',
        'presenter' => 'Homepage',
        'action' => 'default',
]);

and I had to rewrite routes as follow to get it work.

$router = new RouteList;
$router->withModule('Auth')->addRoute('auth/<presenter>[/<action>[/<id>]]', [
        'presenter' => 'Homepage',
        'action' => 'default',
]);
$router->withModule('Default')->addRoute('<presenter>[/<action>[/<id>]]', [
        'presenter' => 'Homepage',
        'action' => 'default',
]);

I digged out to

$key = $params[$this->cacheKey] ?? null;
if (!is_scalar($key) || !isset($this->ranks[$key])) {
$key = '*';
}
and found, that $key = null because $params['module'] is not set and $params['presenter'] === 'Auth:Sign' for example.

Not sure it is an intention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions