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

Routing trouble

Hey guys!

I added routes for admin panel on my site:

$router->add('/adm', 'admin::index');
$router->add('/adm/:action', ['controller' => 'admin', 'action' => 1]);
$router->add('/adm/market', ['controller' => 'adminmarket', 'action' => 'index']);
$router->add('/adm/market/:action', ['controller' => 'adminmarket', 'action' => 1]);

So... /adm/:action success found AdminController.php in /controllers dir. But /adm/market not found AdminMarketController.php in the same dir. Why? Routes hierarchy problem? Or what?

It should be adminMarket controller?

Exception: AdminmarketController handler class cannot be loaded

I fixed it. Solution: need rename AdminMarketController.php → AdminmarketController.php

P.S. I think it's not good "feature" in phalcon...



3.4k
edited Jun '17

if you want using AdminMarketController.php I think you should call your route :

$router->add('/adm/market', ['controller' => 'adminMarket', 'action' => 'index']);