I'm trying to replace my own routing module (pure php) with Phalcon. Example: "/catalog/catalog_name/param1-val1_val2_val3/param2-val4"
Here's how I got:
//Main route
$route = $router->add("/catalog/([a-zA-Z0-9\_\-]+)/([^\?]+)", [
"controller" => "catalog",
"action" => "show",
"name" => 1,
"params" => 2,
]);
$route->convert(
'params',
function ($string) {
return var_export(explode('-', $string),true);
});
As far as I understand $route->convert()
handler allow you to pass string and must return string. Is it?
So to get what i need i should redefine native convert function?