Zend\Mvc\MvcEvent::setRouter PHP Méthode

setRouter() public méthode

Set router
public setRouter ( Zend\Router\RouteStackInterface $router ) : MvcEvent
$router Zend\Router\RouteStackInterface
Résultat MvcEvent
    public function setRouter(RouteStackInterface $router)
    {
        $this->setParam('router', $router);
        $this->router = $router;
        return $this;
    }

Usage Example

 public function init($controllerName, $actionName = 'index')
 {
     $this->routeMatch = new RouteMatch(['controller' => $controllerName, 'action' => $actionName]);
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->event->setRouter((new RouterFactory())->createService(Bootstrap::getServiceManager()));
     $this->prepareAuthenticateMock();
 }
All Usage Examples Of Zend\Mvc\MvcEvent::setRouter