get routing link by controller and action

Hello everyone.

I have a defined route like:

$router->add(
    "/login",
    array(
        "controller" => "auth",
        "action"     => "login"
    )
);

is it also possible to get the routing link by controller and action? that i have something like this: $route->getRouteByParams(array('controller'=>'auth','action'=>'login')); and i will get back

/login

Thanks you very much for your help. Patrick



64.2k
$router->add("/posts/{year}/{title}", "Posts::show")->setName("show-posts");


$this->response->redirect(array('for' => "show-posts"));
...
$this->response->redirect(array('for' => "show-posts", 'id' => $someId));

?

https://docs.phalconphp.com/en/latest/reference/url.html#generating-uris

$router->add(
    "/login",
    array(
        "controller" => "auth",
        "action"     => "login"
    )
)->setName("login");

$this->url->get(
    array(
        'for'   => 'login',
    )
);