cphalcon
cphalcon copied to clipboard
URL with dashes "-" Not Routing
Hey Guys,
I tried updating the default router to handle "-" dashes the same way it handles "_" underscores. I overwrote the default routes with the following patterns fine and Phalcon finds the matches.
// set default routes with dashes
$router->add('#^/([a-zA-Z0-9\_\-]+)[/]{0,1}$#', array(
'controller' => 1,
));
$router->add('#^/([a-zA-Z0-9\_\-]+)/([a-zA-Z0-9\_\-]+)(/.*)*$#', array(
'controller' => 1,
'action' => 2,
'params' => 3,
));
But Phalcon does not translate the url segments to the expected controllers and actions:
Current:
/controller-dash -> Controller-dashController
Excepted:
/controller-dash -> ControllerDashController
/controller-dash/action-dash -> ControllerDashController::actionDashAction
It would be nice if this was possible.
Thanks in advance!
Actually, this needs to be implemented in Phalcon\Text::camelize. Thanks for the suggestion