Action with characters (-) and (_)

Hello, all!

How to use such name in the actions: /site.name/controller/action-with-characters

it works with controllers:

Controller names are camelized, this means that characters (-) and (_) are removed and the next character is uppercased. For instance, some_controller is converted to SomeController.

default settings should work at this case

class ControllerController extends \Phalcon\Mvc\Controller
{
    public function actionWithCharactersAction()
    {
    }
}


27.0k

Unfortunately it does not work. if we use characters _, the error appears: Phalcon\Mvc\Dispatcher\Exception: Action 'action_with_characters' was not found on handler 'controller'

if we use the characters -, the dispatcher can find the controller 'index' and action 'index'

Hmm, look at http://forum.phalconphp.com/discussion/418/phalcon-1-2-beta-1-router-problem maybe you have't got fresh version of phalcon? please recompile or wait for Anders to fix it.



404

Just tried and it works with "_". And not working with "-", because you can't name variable/function/class/etc with operator in the middle of the name.

class ControllerController extends \Phalcon\Mvc\Controller
{
    public function action_with_charactersAction()
    {
    }
}

I found it. It looks like Phalcon 1.2.0 changed, (or always it works this way) controller action isn't camelized, only controller name is camelized, and @Firnis reply is correct. You can use eventManager to handle and calelize controller action. More about it is in @andresgutierrez reply here http://forum.phalconphp.com/discussion/355/camelcase-actions