cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[NFR] dispatcher->getModuleName()

Open brandonlamb opened this issue 14 years ago • 5 comments

dispatcher has getActionName() and getControllerName(), seems logical to have getModuleName() ?

brandonlamb avatar Oct 14 '12 21:10 brandonlamb

the dispatcher is unique by each module, if you want to request the active module you can get it using $router->getModuleName()

kenjikobe avatar Oct 15 '12 01:10 kenjikobe

Why dispatcher can't be a common for all modules and have method getModuleName()? Is it so hard to implement?

trsrm avatar Oct 19 '12 16:10 trsrm

modules are initialized and managed by Phalcon\Mvc\Application, each module register different services that sometimes are incompatible between them. for example, the database connection, views service, etc.

since Phalcon\Mvc\Dispatcher doesn't have ability to start modules, it can't forward to other modules

kenjikobe avatar Oct 21 '12 04:10 kenjikobe

class PostController extends Phalcon\Mvc\Controller
{
     public function xAction()
     {
         $module = $this->router->getModuleName();   
     }
}

kenjikobe avatar Oct 21 '12 04:10 kenjikobe

Closed, as this feature is implemented in the router component

ghost avatar Nov 01 '12 15:11 ghost