You need to do that after routing. You can attach an event listener to your
application, listening to `\Zend\Mvc\MvcEvent::EVENT_ROUTE` with low
priority (so it happens after routing). Then you should be able to access a
RouteMatch instance. It may be null anyway if nothing has been matched.
To do what I described above, I think you can do something like following:
public function onBoostrap($e)
{
$e->getEventManager()->attach(
\Zend\Mvc\MvcEvent::EVENT_ROUTE,
function($e) {
/* $e is the MvcEvent here, so do whatever you want here,
$e->getRouteMatch() will work if a route was matched */
},
-1000
);
}
Marco Pivetta
http://twitter.com/Ocramius
http://marco-pivetta.com
On 6 August 2012 10:08, sina miandashti <[email protected]> wrote:
> hi
>
> im wondering
>
> why this returned null in my onBootstrap method in module.php
>
> $e->getRouteMatch();
>
>
> i want to get requested controller and action in module.php
>