コード例 #1
0
ファイル: RouterFactory.php プロジェクト: xelax90/xelax-admin
 public function createService(ServiceLocatorInterface $serviceLocator, $cName = null, $rName = null)
 {
     $router = parent::createService($serviceLocator, $cName, $rName);
     //get instance of the RoutePluginManager
     $routePluginManager = $router->getRoutePluginManager();
     //set the ServiceLocator for the RoutePluginManager so we can use it in the route
     $routePluginManager->setServiceLocator($serviceLocator);
     return $router;
 }
コード例 #2
0
 public function init($controllerName, $actionName = 'index', $lang = 'en')
 {
     $this->routeMatch = new RouteMatch(array('controller' => $controllerName, 'action' => $actionName, 'lang' => $lang));
     $this->event = new MvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     /** @var SimpleRouteStack $router */
     $routerFactory = new RouterFactory();
     $router = $routerFactory->createService(clone Bootstrap::getServiceManager());
     $router->setDefaultParam('lang', $lang);
     $this->event->setRouter($router);
 }
コード例 #3
0
ファイル: AclServiceTest.php プロジェクト: omusico/zf2-demo
 private function prepareEvent($forApi = false)
 {
     if ($forApi) {
         $controllerMock = $this->getMock(AbstractApiActionController::class);
     } else {
         $controllerMock = $this->getMock(AbstractActionController::class);
     }
     $routerFactory = new RouterFactory();
     $router = $routerFactory->createService(Bootstrap::getServiceManager());
     $event = new MvcEvent();
     $event->setTarget($controllerMock);
     $event->setRouter($router);
     $event->setResponse(new Response());
     return $event;
 }
コード例 #4
0
ファイル: RouterFactory.php プロジェクト: Ellipizle/dotscms
 public function createService(ServiceLocatorInterface $serviceLocator, $cName = null, $rName = null)
 {
     $router = parent::createService($serviceLocator, $cName, $rName);
     $router->getRoutePluginManager()->setServiceLocator($serviceLocator);
     return $router;
 }