We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

what is the standard for routing annotattions?

I've been working with annotations routing and sometimes i have problems route.

  1. if the prefix is not equal to the controller I can not access prefix
  2. change the folder view and declare according to the controller or its prefix (camelcase?)
  3. problem between dispatcher and redirect
    //Don't work
    return $this->dispatcher->forward(array(
        'controller' => 'IncidenceSv',
        'action' => 'create'
    ));

        //Work
    return $this->dispatcher->forward(array(
        'controller' => 'incidence_sv',
        'action' => 'create'
    ));

actually I have a special case and is a controller called IncidenceSv

<?php

    $router = new \Phalcon\Mvc\Router\Annotations(false);

    $router->removeExtraSlashes(true);
    $router->setUriSource(\Phalcon\Mvc\Router::URI_SOURCE_SERVER_REQUEST_URI);

    // addResource(Controller,Prefix)
    $router->addResource('Index', '/');
    $router->addResource('Login', '/login');
    $router->addResource('CallsSv', '/calls');  //prefix is not equal to the controller
    $router->addResource('Users', '/users');
                                            // incidencesv don't work 
    $router->addResource('IncidenceSv', '/incidence_sv');//work 
    $router->addResource('Error', '/error');

    $router->notFound([
        "controller"    => "Error",
        "action"        => "page404"
    ]);

    return $router;

and the route in the i can access is

incorrect

views/incidence_sv 

and the other routes have camelcase (correct)

views/Users

views/Login

some can orient me?

edited Jun '15

by default phalcon uncamelize all controllers with '_'. Seems like '-' works too as long you set the controller view folder with one of those names. If you want to change how the action/controller to look like you can control that from the event manager

https://docs.phalcon.io/en/latest/reference/dispatching.html#camelize-action-names