Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Camelize action

Hello,

I'm trying to access an url like 'www.example.com/controller/some-action' I'm using an event beforeDispatchLoop but is working only for 'www.example.com/controller/some_action' and as action it finds the default one 'index'. Seems like the router doesn't recognise it as an action.

$eventsManager->attach("dispatch:beforeDispatchLoop", function($event, $dispatcher) {
    $dispatcher->setActionName(Text::camelize($dispatcher->getActionName()));
});

Thanks



12.3k
Accepted
answer

I disabled the default routing behavior, defined the routes manually and now is finally working.