I've had some problems to understand how to work with Router annotations.

There is my repo for reference https://github.com/valVk/ph-test

I have multi module application.

In tutorial for I found next

$di['router'] = function() {

    //Use the annotations router
    $router = new \Phalcon\Mvc\Router\Annotations(false);

    //Read the annotations from Backend\Controllers\ProductsController if the uri starts with /api/products
    $router->addModuleResource('backend', 'Index', '/admin');

    return $router;
};

And for the controller I have to do next:

<?php

namespace App\Backend\Controllers;

/**
 * @RoutePrefix("/admin")
 */
class IndexController extends ControllerBase
{

    /**
     * @Get('/')
     */
    public function indexAction()
    {
    }

}

But in result I got the exception that class IndexController not found.

Than I slightly change my routes configuration


/**
 * The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
 */
$di = new FactoryDefault();

/**
 * Registering a router
 */
$di['router'] = function () {

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

    $router->setDefaultModule("frontend");
    $router->setDefaultNamespace("App\\Frontend\\Controllers");
    $router->setDefaultController('index');
    $router->setDefaultAction('index');
    $router->setUriSource(\Phalcon\Mvc\Router::URI_SOURCE_SERVER_REQUEST_URI);

    //Read the annotations from ProductsController if the uri starts with /api/products
    $router->addModuleResource('backend', 'App\\Backend\\Controllers\\Index', '/admin');

    return $router;
};

In result I got another exception that refers to the name for the name of the template folder. Application search template for the backend's action in the folder Index/index.phtml but I have folder index/index.phtml in result view is not rendered. In the same time frontend works as expected with folders names in lower case.

So I see the problem with the names conventions in the framework. When we use default settings than all fine, but once we decided use namespaces in routes than we get another unexpected behavior. I want to know answers to the next questions:

  1. Is this common behavior or it's some kind of bug?
  2. Can I convert controllers whether to all lowercase or CamelCase type to have posibility organize folder structure to one type?

Thanks