Re: [fw-general] zf2 matched route getParam controller get the module instead

2013-04-10 Thread Marco Pivetta
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  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: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>


[fw-general] zf2 matched route getParam controller get the module instead

2013-04-10 Thread whisher
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: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com