I want to use beforeMatch() callback to add some parameters into Dispatcher.
$router->add("/(value1)/(value2)/{param3}.+", [
'controller' => 'search',
'action' => 'search',
'param1' => 1,
'param2' => 2,
])->beforeMatch(function($uri, $route) {
///.... some conditions and actions
$additionalParams = ['addParam1' => 111, 'addParams2' => 222];
$route->reConfigure($route->getPattern(), array_merge($route->getPaths(), $additionalParams));
});
I see these extra parameters in var_dump($route)
inside callback, but after I get "Warning: Illegal offset type in /var/www/phalcon//htdocs/project/public/index.php on line 44"
44: echo $application->handle()->getContent();