N
N
Narek2014-04-04 00:51:29
Zend Framework
Narek, 2014-04-04 00:51:29

ZF2, bjyauthorize, Restful module - how to get method name (get, getList, delete...) before executing it?

So I get only the controller:

$sm = $e->getApplication()->getServiceManager();
        /** @var \Zend\Mvc\Application $application */
        $application = $e->getApplication();
        $eventManager = $application->getEventManager();
        $eventManager->attach('route', function(MvcEvent $mvcEvent){
             $params = $mvcEvent->getRouteMatch()->getParams();
        });

And so:
$sm = $e->getApplication()->getServiceManager();
        /** @var \Zend\Mvc\Application $application */
        $application = $e->getApplication();
        $eventManager = $application->getEventManager();
        $eventManager->attach('dispatch', function(MvcEvent $mvcEvent){
             $params = $mvcEvent->getRouteMatch()->getParams();
        });

the event does not fire at all =(
I need this to check if the user has access to the called method or not, because bjyauthorize, as I understand it, only works with regular controllers.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question