Thank you. Regards, Norbert.
On 18 July 2013 18:23, Matthew Weier O'Phinney <[email protected]> wrote: > On Thu, Jul 18, 2013 at 9:01 AM, Norbert Máté <[email protected]> > wrote: > > I want to detect if the request is for a module and setup some thing > only > > that case. I have found a solution: > > > > $matched = $router->match($request); > > if ($matched && $matched->getMatchedRouteName() == 'rest-api') > > > > My problem with this is that it detects the route and not the module. If > I > > have to setup things for all the functions in a module than I will have > to > > add here all the routes. > > > > Is there a better way? > > Yes -- use events! > > Here's an example: https://gist.github.com/weierophinney/6030213 > > Essentially, you listen to the "route" event, after routing has > occurred. If the matched controller has the same namespace as your > module, you do something. > > -- > Matthew Weier O'Phinney > Project Lead | [email protected] > Zend Framework | http://framework.zend.com/ > PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc > > -- > List: [email protected] > Info: http://framework.zend.com/archives > Unsubscribe: [email protected] > > >
