Example #1
0
 protected function createRouter()
 {
     $route = new RegexRoute('/assets/(?<resourcePath>.*)', '/assets/%resourcePath%');
     $router = new TreeRouteStack();
     $router->addRoute('asset', $route);
     return $router;
 }
Example #2
0
 public function setUp()
 {
     $this->router = $router = new TreeRouteStack();
     $route = new Segment('/resource[/[:id]]');
     $router->addRoute('resource', $route);
     $route2 = new Segment('/help');
     $router->addRoute('docs', $route2);
     $router->addRoute('hostname', ['type' => 'hostname', 'options' => ['route' => 'localhost.localdomain'], 'child_routes' => ['resource' => ['type' => 'segment', 'options' => ['route' => '/resource[/:id]'], 'may_terminate' => true, 'child_routes' => ['children' => ['type' => 'literal', 'options' => ['route' => '/children']]]], 'users' => ['type' => 'segment', 'options' => ['route' => '/users[/:id]']], 'contacts' => ['type' => 'segment', 'options' => ['route' => '/contacts[/:id]']], 'embedded' => ['type' => 'segment', 'options' => ['route' => '/embedded[/:id]']], 'embedded_custom' => ['type' => 'segment', 'options' => ['route' => '/embedded_custom[/:custom_id]']]]]);
     $this->event = $event = new MvcEvent();
     $event->setRouter($router);
     $router->setRequestUri(new Http('http://localhost.localdomain/resource'));
     $controller = $this->controller = $this->getMock('Zend\\Mvc\\Controller\\AbstractRestfulController');
     $controller->expects($this->any())->method('getEvent')->will($this->returnValue($event));
     $this->urlHelper = $urlHelper = new UrlHelper();
     $urlHelper->setRouter($router);
     $this->serverUrlHelper = $serverUrlHelper = new ServerUrlHelper();
     $serverUrlHelper->setScheme('http');
     $serverUrlHelper->setHost('localhost.localdomain');
     $this->plugin = $plugin = new HalHelper();
     $plugin->setController($controller);
     $plugin->setUrlHelper($urlHelper);
     $plugin->setServerUrlHelper($serverUrlHelper);
     $linkExtractor = new LinkExtractor($serverUrlHelper, $urlHelper);
     $linkCollectionExtractor = new LinkCollectionExtractor($linkExtractor);
     $plugin->setLinkCollectionExtractor($linkCollectionExtractor);
 }
Example #3
0
 /**
  * Create and return the router
  *
  * Retrieves the "router" key of the Config service, and uses it
  * to instantiate the router. Uses the TreeRouteStack implementation by
  * default.
  *
  * @param  ServiceLocatorInterface        $serviceLocator
  * @param  string|null                     $cName
  * @param  string|null                     $rName
  * @return \Zend\Mvc\Router\RouteStackInterface
  */
 public function createService(ServiceLocatorInterface $serviceLocator, $cName = null, $rName = null)
 {
     $config = $serviceLocator->get('Config');
     $routePluginManager = $serviceLocator->get('RoutePluginManager');
     if ($rName === 'ConsoleRouter' || $cName === 'router' && Console::isConsole()) {
         // We are in a console, use console router.
         if (isset($config['console']) && isset($config['console']['router'])) {
             $routerConfig = $config['console']['router'];
         } else {
             $routerConfig = array();
         }
         $router = new ConsoleRouter($routePluginManager);
     } else {
         // This is an HTTP request, so use HTTP router
         $router = new HttpRouter($routePluginManager);
         $routerConfig = isset($config['router']) ? $config['router'] : array();
     }
     if (isset($routerConfig['route_plugins'])) {
         $router->setRoutePluginManager($routerConfig['route_plugins']);
     }
     if (isset($routerConfig['routes'])) {
         $router->addRoutes($routerConfig['routes']);
     }
     if (isset($routerConfig['default_params'])) {
         $router->setDefaultParams($routerConfig['default_params']);
     }
     return $router;
 }
Example #4
0
 public function testIsActiveReturnsTrueWhenMatchingRoute()
 {
     $page = new Page\Mvc(array('label' => 'spiffyjrwashere', 'route' => 'lolfish'));
     $route = new LiteralRoute('/lolfish');
     $router = new TreeRouteStack();
     $router->addRoute('lolfish', $route);
     $routeMatch = new RouteMatch(array());
     $routeMatch->setMatchedRouteName('lolfish');
     $page->setRouter($router);
     $page->setRouteMatch($routeMatch);
     $this->assertEquals(true, $page->isActive());
 }
Example #5
0
 /**
  * Attempt to match an incoming request to a registered route.
  *
  * @param PsrRequest $request
  * @return RouteResult
  */
 public function match(PsrRequest $request)
 {
     $match = $this->zf2Router->match(Psr7ServerRequest::toZend($request, true));
     if (null === $match) {
         return RouteResult::fromRouteFailure();
     }
     $allowedMethods = $this->getAllowedMethods($match->getMatchedRouteName());
     if (!$this->methodIsAllowed($request->getMethod(), $allowedMethods)) {
         return RouteResult::fromRouteFailure($allowedMethods);
     }
     return $this->marshalSuccessResultFromRouteMatch($match);
 }
Example #6
0
 public function testHrefGeneratedIsRouteAware()
 {
     $page = new Page\Mvc(array('label' => 'foo', 'action' => 'myaction', 'controller' => 'mycontroller', 'route' => 'myroute', 'params' => array('page' => 1337)));
     $route = new RegexRoute('(lolcat/(?<action>[^/]+)/(?<page>\\d+))', '/lolcat/%action%/%page%', array('controller' => 'foobar', 'action' => 'bazbat', 'page' => 1));
     $router = new TreeRouteStack();
     $router->addRoute('myroute', $route);
     $routeMatch = new RouteMatch(array('controller' => 'foobar', 'action' => 'bazbat', 'page' => 1));
     $urlHelper = new UrlHelper();
     $urlHelper->setRouter($router);
     $urlHelper->setRouteMatch($routeMatch);
     $page->setUrlHelper($urlHelper);
     $page->setRouteMatch($routeMatch);
     $this->assertEquals('/lolcat/myaction/1337', $page->getHref());
 }
 private function matchUrl($url, $urlHelper)
 {
     $url = 'http://localhost.localdomain' . $url;
     $request = new Request();
     $request->setUri($url);
     $router = new TreeRouteStack();
     $router->addRoute('hostname', ['type' => 'hostname', 'options' => ['route' => 'localhost.localdomain'], 'child_routes' => ['resource' => ['type' => 'segment', 'options' => ['route' => '/resource[/:id]']]]]);
     $match = $router->match($request);
     if ($match instanceof RouteMatch) {
         $urlHelper->setRouter($router);
         $urlHelper->setRouteMatch($match);
     }
     return $match;
 }
 public function setUpRouter()
 {
     if (isset($this->router)) {
         return;
     }
     $this->setUpRequest();
     $routes = ['resource' => ['type' => 'Segment', 'options' => ['route' => '/api/resource[/:id]', 'defaults' => ['controller' => 'Api\\RestController']]]];
     $this->router = $router = new TreeRouteStack();
     $router->addRoutes($routes);
     $matches = $router->match($this->request);
     if (!$matches instanceof RouteMatch) {
         $this->fail('Failed to route!');
     }
     $this->matches = $matches;
 }
Example #9
0
 /**
  * Create and return the router
  *
  * Retrieves the "router" key of the Configuration service, and uses it
  * to instantiate the router. Uses the TreeRouteStack implementation by
  * default.
  * 
  * @param  ServiceLocatorInterface $serviceLocator 
  * @return TreeRouteStack
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Configuration');
     $routes = isset($config['router']) ? $config['router'] : array();
     $router = Router::factory($routes);
     return $router;
 }
 protected function setUp()
 {
     //check if child class implements the correct interface
     if (!$this instanceof TestCaseAdapterInterface) {
         throw new \Exception(__CLASS__ . " : Line " . __LINE__ . " : Test Case could not executed. It must implement FrontCore\\TestsConfig\\TestCaseAdapterInterface", 500);
     }
     //end if
     //check if bootstrap instance has been set
     if (!$this->bootstrap) {
         throw new \Exception(__CLASS__ . " : Line " . __LINE__ . " : Test Case could not executed. Bootstrap instance is not set", 500);
     }
     //end if
     $this->serviceManager = $this->bootstrap->getServiceManager();
     //$this->controller = new IndexController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $config = $this->serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     //$this->controller->setEvent($this->event);
     //$this->controller->setServiceLocator($serviceManager);
     //create logged in user
     $arr_user_data = array("id" => "1", "uname" => "user", "pword" => "5f4dcc3b5aa765d61d8327deb882cf99", "api_key" => "2c0f-828c-b184-f33f-2944-ad2d-f51c-e17a-7a13-ef2a-f581-8e2b", "phpunit" => TRUE);
     $objUserSession = $this->serviceManager->get("FrontUserLogin\\Models\\FrontUserSession")->createUserSession((object) $arr_user_data);
 }
Example #11
0
 public function setUp()
 {
     $this->request = new Request();
     $this->helper = new QueryUrl($this->request);
     $this->router = TreeRouteStack::factory(['routes' => ['route-name' => new Literal('/foo/bar')]]);
     $this->helper->setRouter($this->router);
 }
Example #12
0
 protected function setUpController(\Zend\Mvc\Controller\AbstractActionController $controller)
 {
     $config = (include 'config/application.config.php');
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     $serviceManager->setAllowOverride(true);
     $this->controller = $controller;
     $this->request = new Request();
     $this->response = new Response();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $this->event->setRequest($this->request)->setResponse($this->response);
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
     $this->setupForwardPlugin();
     $this->setupParamsPlugin();
     $this->setupFormPlugin();
     $this->setupGridControllerPlugin();
     $this->setupControllerFilePlugin();
 }
Example #13
0
 public function setUp()
 {
     $basePath = __DIR__ . '/../../../../../';
     $this->setApplicationConfig(include $basePath . 'config/application.config.php');
     $serviceManager = Bootstrap::getServiceManager();
     $this->controller = new \Galaxy\Controller\IndexController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
     $mockAuth = $this->getMock('ZfcUser\\Entity\\UserInterface');
     $ZfcUserMock = $this->getMock('User\\Entity\\User');
     $ZfcUserMock->expects($this->any())->method('getId')->will($this->returnValue('3'));
     $authMock = $this->getMock('ZfcUser\\Controller\\Plugin\\ZfcUserAuthentication');
     $authMock->expects($this->any())->method('hasIdentity')->will($this->returnValue(true));
     $authMock->expects($this->any())->method('getIdentity')->will($this->returnValue($ZfcUserMock));
     $this->controller->getPluginManager()->setService('zfcUserAuthentication', $authMock);
     parent::setUp();
 }
Example #14
0
 public function testIsActiveReturnsTrueWhenMatchingRouteWhileUsingModuleRouteListener()
 {
     $page = new Page\Mvc(array('label' => 'mpinkstonwashere', 'route' => 'roflcopter', 'controller' => 'index'));
     $route = new LiteralRoute('/roflcopter');
     $router = new TreeRouteStack();
     $router->addRoute('roflcopter', $route);
     $routeMatch = new RouteMatch(array(ModuleRouteListener::MODULE_NAMESPACE => 'Application\\Controller', 'controller' => 'index'));
     $routeMatch->setMatchedRouteName('roflcopter');
     $event = new MvcEvent();
     $event->setRouter($router)->setRouteMatch($routeMatch);
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->onRoute($event);
     $page->setRouter($event->getRouter());
     $page->setRouteMatch($event->getRouteMatch());
     $this->assertEquals(true, $page->isActive());
 }
 /**
  * Inject route into the underlying router implemetation.
  *
  * @param Route $route
  */
 private function injectRoute(Route $route)
 {
     $name = $route->getName();
     $path = $route->getPath();
     $options = $route->getOptions();
     $options = array_replace_recursive($options, ['route' => $path, 'defaults' => ['middleware' => $route->getMiddleware()]]);
     $allowedMethods = $route->getAllowedMethods();
     if (Route::HTTP_METHOD_ANY === $allowedMethods) {
         $this->zendRouter->addRoute($name, ['type' => 'segment', 'options' => $options]);
         $this->routeNameMap[$name] = $name;
         return;
     }
     // Remove the middleware from the segment route in favor of method route
     unset($options['defaults']['middleware']);
     if (empty($options['defaults'])) {
         unset($options['defaults']);
     }
     $httpMethodRouteName = implode(':', $allowedMethods);
     $httpMethodRoute = $this->createHttpMethodRoute($route);
     $methodNotAllowedRoute = $this->createMethodNotAllowedRoute($path);
     $spec = ['type' => 'segment', 'options' => $options, 'may_terminate' => false, 'child_routes' => [$httpMethodRouteName => $httpMethodRoute, self::METHOD_NOT_ALLOWED_ROUTE => $methodNotAllowedRoute]];
     if (array_key_exists($path, $this->allowedMethodsByPath)) {
         $allowedMethods = array_merge($this->allowedMethodsByPath[$path], $allowedMethods);
         // Remove the method not allowed route as it is already present for the path
         unset($spec['child_routes'][self::METHOD_NOT_ALLOWED_ROUTE]);
     }
     $this->zendRouter->addRoute($name, $spec);
     $this->allowedMethodsByPath[$path] = $allowedMethods;
     $this->routeNameMap[$name] = sprintf('%s/%s', $name, $httpMethodRouteName);
 }
Example #16
0
 public function setUp()
 {
     $config = (include __DIR__ . '/../../../config/module.config.php');
     $renderer = new PhpRenderer();
     $renderer->setResolver(new TemplateMapResolver($config['view_manager']['template_map']));
     $router = TreeRouteStack::factory($config['router']);
     $this->helper = new QrCodeHelper($renderer, $router, new QrCodeServiceMock('foobar'));
 }
Example #17
0
 /**
  * {@inheritDoc}
  */
 public function generateUri($name, array $substitutions = [])
 {
     if (!$this->zf2Router->hasRoute($name)) {
         throw new Exception\RuntimeException(sprintf('Cannot generate URI based on route "%s"; route not found', $name));
     }
     $name = isset($this->routeNameMap[$name]) ? $this->routeNameMap[$name] : $name;
     $options = ['name' => $name, 'only_return_path' => true];
     return $this->zf2Router->assemble($substitutions, $options);
 }
 /**
  * assemble(): defined by \Zend\Mvc\Router\RouteInterface interface.
  *
  * @see    \Zend\Mvc\Router\RouteInterface::assemble()
  * @param  array $params
  * @param  array $options
  * @return mixed
  * @throws Exception\InvalidArgumentException
  * @throws Exception\RuntimeException
  */
 public function assemble(array $params = array(), array $options = array())
 {
     if ($this->hasTranslator() && $this->isTranslatorEnabled() && !isset($options['translator'])) {
         $options['translator'] = $this->getTranslator();
     }
     if (!isset($options['text_domain'])) {
         $options['text_domain'] = $this->getTranslatorTextDomain();
     }
     return parent::assemble($params, $options);
 }
Example #19
0
 public function setUp()
 {
     $router = new TreeRouteStack();
     $router->addRoute('home', LiteralRoute::factory(array('route' => '/', 'defaults' => array('controller' => 'ZendTest\\Mvc\\Controller\\TestAsset\\SampleController'))));
     $router->addRoute('sub', SegmentRoute::factory(array('route' => '/foo/:param', 'defaults' => array('param' => 1))));
     $router->addRoute('ctl', SegmentRoute::factory(array('route' => '/ctl/:controller', 'defaults' => array('__NAMESPACE__' => 'ZendTest\\Mvc\\Controller\\TestAsset', 'controller' => 'sample'))));
     $this->controller = new SampleController();
     $this->request = new Request();
     $this->event = new MvcEvent();
     $this->routeMatch = new RouteMatch(array('controller' => 'controller-sample', 'action' => 'postPage'));
     $this->event->setRequest($this->request);
     $this->event->setRouteMatch($this->routeMatch);
     $this->event->setRouter($router);
     $this->sessionManager = new SessionManager();
     $this->sessionManager->destroy();
     $this->controller->setEvent($this->event);
     $plugins = $this->controller->getPluginManager();
     $plugins->get('flashmessenger')->setSessionManager($this->sessionManager);
 }
Example #20
0
 /**
  * {@inheritDoc}
  */
 public function getServiceConfig()
 {
     return array('factories' => array('Application' => function (ServiceLocatorInterface $sl) {
         return new App($sl->get('Config'), $sl);
     }, 'Router' => function () {
         return HttpRouter::factory(array());
     }, 'HttpRouter' => function (ServiceLocatorInterface $sl) {
         return $sl->get('Router');
     }));
 }
 public function getController($controllerClass, $controllerName, $action, $params = [])
 {
     $config = $this->getConfig();
     $controller = $this->getServiceManager()->get('ControllerLoader')->get($controllerClass);
     $event = new MvcEvent();
     $routerConfig = isset($config['router']) ? $config['router'] : [];
     $router = TreeRouteStack::factory($routerConfig);
     $event->setRouter($router);
     $event->setRouteMatch(new RouteMatch(['controller' => $controllerName, 'action' => $action] + $params));
     $controller->setEvent($event);
     return $controller;
 }
Example #22
0
 private function addRoute($routeName, $route, $routeOptions, $options)
 {
     if (isset($options['routeName'])) {
         $routeName = $options['routeName'];
         unset($options['routeName']);
     }
     if (isset($options['route'])) {
         $route = $options['route'];
         unset($options['route']);
     }
     $routeOptions = array_merge($routeOptions, $options);
     $routeSegment = Segment::factory(['route' => $route, 'defaults' => $routeOptions]);
     $this->router->addRoute($routeName, $routeSegment);
 }
 protected function setUp()
 {
     $this->controller = new ConfigurationRestController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'rest_configuration'));
     $this->event = new MvcEvent();
     $config = Bootstrap::getServiceManager()->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator(Bootstrap::getServiceManager());
 }
Example #24
0
 /**
  * routeFromArray(): defined by SimpleRouteStack.
  *
  * @param array|\Traversable $specs
  *
  * @throws \RuntimeException
  * @return RouteInterface
  */
 protected function routeFromArray($specs)
 {
     $route = parent::routeFromArray($specs);
     if (!$route instanceof RouteInterface) {
         throw new \RuntimeException('Given route does not implement HTTP route interface');
     }
     if (isset($specs['child_routes'])) {
         $options = array('route' => $route, 'may_terminate' => isset($specs['may_terminate']) && $specs['may_terminate'], 'child_routes' => $specs['child_routes'], 'route_plugins' => $this->routePluginManager);
         $priority = isset($route->priority) ? $route->priority : null;
         $route = $this->routePluginManager->get('part', $options);
         $route->priority = $priority;
     }
     return $route;
 }
Example #25
0
 protected function setUp()
 {
     $serviceManagerGrabber = new ServiceManagerGrabber();
     $this->serviceManager = $serviceManagerGrabber->getServiceManager();
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setService('doctrine.entitymanager.orm_default', $this->getEntityManagerMock());
     $config = $this->serviceManager->get('Config');
     $this->request = new PhpEnviromentRequest();
     $this->router = HttpRouter::factory(isset($config['router']) ? $config['router'] : array());
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->routeMatch->setParam('lang', 'it');
     $this->event = new MvcEvent();
     $this->event->setRouter($this->router);
     $this->event->setRouteMatch($this->routeMatch);
 }
 /**
  * @return ServiceLocatorInterface
  */
 private function createServiceLocator(MvcEvent $e = null)
 {
     $sm = new ServiceManager();
     $sm->setService('Request', new Request());
     $sm->setService('Response', new Response());
     $sm->setService('EventManager', new EventManager());
     $sm->setService('Router', TreeRouteStack::factory(['routes' => []]));
     $e = $e ?: new MvcEvent();
     $app = $this->prophesize('Zend\\Mvc\\Application');
     $app->getMvcEvent()->willReturn($e);
     $sm->setService('Application', $app->reveal());
     $helperManager = new HelperPluginManager();
     $helperManager->setServiceLocator($sm);
     return $helperManager;
 }
 protected function setUp()
 {
     $serviceManager = $this->getServiceManager();
     $this->controller = new IndexController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
 }
 protected function setUp()
 {
     $this->serviceManager = ServiceManagerFactory::getServiceManager();
     $this->controller = new IndexController();
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(['controller' => IndexController::class]);
     $this->event = new MvcEvent();
     $config = $this->serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : [];
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($this->serviceManager);
 }
Example #29
0
 /**
  * @return ServiceLocatorInterface
  */
 private function createServiceLocator(MvcEvent $e = null)
 {
     $sm = new ServiceManager();
     $sm->setService('Request', new Request());
     $sm->setService('Response', new Response());
     $sm->setService('EventManager', new EventManager());
     $sm->setService('Router', TreeRouteStack::factory(['routes' => []]));
     $e = $e ?: new MvcEvent();
     $app = $this->getMock('Zend\\Mvc\\Application', [], [[], $sm]);
     $app->expects($this->any())->method('getMvcEvent')->willReturn($e);
     $sm->setService('Application', $app);
     $helperManager = new HelperPluginManager();
     $helperManager->setServiceLocator($sm);
     return $helperManager;
 }
 protected function setUp()
 {
     $this->service = $this->getMockBuilder('OpsWay\\TocatBudget\\Service\\MyService')->disableOriginalConstructor()->getMock();
     $serviceManager = Bootstrap::getServiceManager();
     $this->controller = new MyController($this->service);
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'other'));
     $this->event = new MvcEvent();
     $config = $serviceManager->get('Config');
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     $router = HttpRouter::factory($routerConfig);
     $this->event->setRouter($router);
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setServiceLocator($serviceManager);
 }