Marco Pivetta wrote
> Yes, this is what routing looks like in the MVC. What's the question
> exactly though? You don't "route" to modules, you route to controllers.
> After bootstrap, the module is blurred into the MVC and is not to be
> considered a self-standing context :)
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>
>
> On 10 April 2013 23:04, whisher <
> whisher06@
> > wrote:
>
>> Hi,
>> I'm wondering if it's the wanted behaviour
>> public function onBootstrap(MvcEvent $e)
>> {
>> $eventManager = $e->getApplication()->getEventManager();
>> $eventManager->attach('route', array($this, 'loadConfiguration'),
>> 2);
>> //you can attach other function need here...
>> }
>>
>> public function loadConfiguration(MvcEvent $e)
>> {
>> $application = $e->getApplication();
>> $sm = $application->getServiceManager();
>> $sharedManager =
>> $application->getEventManager()->getSharedManager();
>> $router = $sm->get('router');
>> $request = $sm->get('request');
>> $matchedRoute = $router->match($request);
>> if (null !== $matchedRoute) {
>> // I get module name instead of the controller name
>> var_dump($matchedRoute->getParam('controller'));
>> // do something
>> }
>> }
>>
>>
>>
>> --
>> View this message in context:
>> http://zend-framework-community.634137.n4.nabble.com/zf2-matched-route-getParam-controller-get-the-module-instead-tp4659689.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>> --
>> List:
> [email protected]
>> Info: http://framework.zend.com/archives
>> Unsubscribe:
> [email protected]
>>
>>
>>
Thanks Marco
I'm tied to zf1 yet ^^
I get the point
in my module.config
I've got
'controllers' => array(
'invokables' => array(
'zfbtituser' => 'ZfBtitUser\Controller\UserController',
),
),
and doing a dump of $matchedRoute
I can see
protected 'params' =>
array (size=2)
'controller' => string 'zfbtituser' (length=10)
'action' => string 'login' (length=5)
protected 'matchedRouteName' => string 'zfbtituser/login' (length=16)
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/zf2-matched-route-getParam-controller-get-the-module-instead-tp4659689p4659693.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]