当前位置: 首页>>代码示例>>PHP>>正文


PHP ServiceLocatorInterface::getServiceLocator方法代码示例

本文整理汇总了PHP中Zend\ServiceManager\ServiceLocatorInterface::getServiceLocator方法的典型用法代码示例。如果您正苦于以下问题:PHP ServiceLocatorInterface::getServiceLocator方法的具体用法?PHP ServiceLocatorInterface::getServiceLocator怎么用?PHP ServiceLocatorInterface::getServiceLocator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\ServiceManager\ServiceLocatorInterface的用法示例。


在下文中一共展示了ServiceLocatorInterface::getServiceLocator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getServiceLocator

 /** 
  * Get the service locator. 
  * 
  * @return \Zend\ServiceManager\ServiceLocatorInterface 
  */
 public function getServiceLocator()
 {
     if (get_class($this->serviceLocator) !== 'Zend\\ServiceManager\\ServiceManager') {
         return $this->serviceLocator->getServiceLocator();
     }
     return $this->serviceLocator;
 }
开发者ID:thisismn,项目名称:responsiveimage,代码行数:12,代码来源:ResponsiveRoute.php

示例2: getConfig

 protected function getConfig()
 {
     if (!$this->config) {
         $this->config = $this->serviceLocator->getServiceLocator()->get('VuFind\\Config')->get('config');
     }
     return $this->config;
 }
开发者ID:htw-pk15,项目名称:vufind,代码行数:7,代码来源:Config.php

示例3: createService

 /**
  * {@inheritDoc}
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $validator = new VerifyEmailCode();
     $validator->setEntityManager($serviceLocator->getServiceLocator()->get('doctrine.entitymanager.orm_default'));
     $validator->setAuthenticationService($serviceLocator->getServiceLocator()->get(AuthenticationService::class));
     return $validator;
 }
开发者ID:zource,项目名称:zource,代码行数:10,代码来源:VerifyEmailCodeFactory.php

示例4: setName

 public function setName($name)
 {
     parent::setName(strtolower($name) . '-settings');
     $urlHelper = $this->formManager->getServiceLocator()->get('ViewHelperManager')->get('url');
     $url = $urlHelper('lang/settings', array('module' => $name), true);
     $this->setAttribute('action', $url);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:7,代码来源:AbstractSettingsForm.php

示例5: createService

 /**
  *
  * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  * @return object
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $options = $serviceLocator->getServiceLocator()->get('config')['sds']['identity']['forgot_credential_token_controller_options'];
     $options['service_locator'] = $serviceLocator->getServiceLocator()->get('doctrineExtensions.' . $options['manifest_name'] . '.servicemanager');
     $instance = new ForgotCredentialTokenController(new ForgotCredentialTokenControllerOptions($options));
     return $instance;
 }
开发者ID:superdweebie,项目名称:identity-module,代码行数:12,代码来源:ForgotCredentialTokenControllerFactory.php

示例6: setUri

 public function setUri()
 {
     $uri = $this->_sm->getServiceLocator()->get('application')->getMvcEvent()->getRequest()->getUri();
     $basePath = $currentHost = $uri->getScheme() . '://' . $uri->getHost() . $uri->getPath();
     $this->setBasePath($basePath);
     return $this;
 }
开发者ID:biialaborg,项目名称:budocu.com,代码行数:7,代码来源:PathString.php

示例7: createService

 public function createService(ServiceLocatorInterface $serviceManager)
 {
     $request = $serviceManager->getServiceLocator()->get('Request');
     $router = $serviceManager->getServiceLocator()->get('Router');
     $routeMatch = $router->match($request);
     return new Languages($serviceManager->getServiceLocator()->get('T4webTranslate\\Languages\\Service\\Finder'), $serviceManager->getServiceLocator()->get('MvcTranslator'), $routeMatch);
 }
开发者ID:sebaks,项目名称:Translate,代码行数:7,代码来源:LanguagesFactory.php

示例8: createService

 /**
  * Factory method.
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return PositionController
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $ctr = new PositionController();
     $ctr->setEntityManager($serviceLocator->getServiceLocator()->get('Doctrine\\ORM\\EntityManager'));
     $ctr->setSettingsService($serviceLocator->getServiceLocator()->get('Admin\\Service\\SettingsService'));
     return $ctr;
 }
开发者ID:Primetron,项目名称:Edusoft,代码行数:13,代码来源:PositionControllerFactory.php

示例9: createService

 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $authAdapter = $serviceLocator->getServiceLocator()->get('AuthAdapter');
     $authService = $serviceLocator->getServiceLocator()->get('AuthService');
     $authService->setAdapter($authAdapter);
     return new LoginController($authService);
 }
开发者ID:qbonaventure,项目名称:users,代码行数:14,代码来源:LoginControllerFactory.php

示例10: createService

 /**
  *
  * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  * @return object
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $options = new Options($serviceLocator->getServiceLocator()->get('config')['sds']['authentication']['authenticated_identity_controller_options']);
     $options->setServiceLocator($serviceLocator->getServiceLocator());
     $instance = new AuthenticatedIdentityController($options);
     return $instance;
 }
开发者ID:superdweebie,项目名称:authentication-module,代码行数:12,代码来源:AuthenticatedIdentityControllerFactory.php

示例11: createService

 /**
  * Factory method.
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return YearController
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $ctr = new YearController();
     $ctr->setEntityManager($serviceLocator->getServiceLocator()->get('Doctrine\\ORM\\EntityManager'));
     $ctr->setYearService($serviceLocator->getServiceLocator()->get('YearService'));
     return $ctr;
 }
开发者ID:Primetron,项目名称:Edusoft,代码行数:13,代码来源:YearControllerFactory.php

示例12: createService

 /**
  *
  * @param  \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  * @return object
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $options = new Options($serviceLocator->getServiceLocator()->get('config')['zoop']['gateway']['authenticated_user_controller_options']);
     $options->setServiceLocator($serviceLocator->getServiceLocator());
     $instance = new AuthenticatedUserController($options);
     return $instance;
 }
开发者ID:zoopcommerce,项目名称:gateway-module,代码行数:12,代码来源:AuthenticatedUserControllerFactory.php

示例13: __invoke

 public function __invoke($controllerName, $actionName, $params = array())
 {
     $controllerLoader = $this->serviceLocator->getServiceLocator()->get('ControllerLoader');
     $controllerLoader->setInvokableClass($controllerName, $controllerName);
     $controller = $controllerLoader->get($controllerName);
     return $controller->{$actionName}($params);
 }
开发者ID:ahyswang,项目名称:eva-engine,代码行数:7,代码来源:Action.php

示例14: createServiceWithName

 /**
  * Create a service for the specified name.
  *
  * @param ServiceLocatorInterface $serviceLocator Service locator
  * @param string                  $name           Name of service
  * @param string                  $requestedName  Unfiltered name of service
  *
  * @return object
  */
 public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
 {
     $options = $serviceLocator->getServiceLocator()->get('VuFind\\SearchOptionsPluginManager')->get($requestedName);
     if ($name === 'solr' || $name == 'solrauthor') {
         // Clone the options instance in case caller modifies it:
         return new \Finna\Search\Solr\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config'), $serviceLocator->getServiceLocator()->get('VuFind\\DateConverter'));
     } elseif ($name === 'primo') {
         // Clone the options instance in case caller modifies it:
         return new \Finna\Search\Primo\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config'));
     } elseif ($name === 'metalib') {
         // Clone the options instance in case caller modifies it:
         return new \Finna\Search\MetaLib\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config'));
     } elseif ($name === 'combined') {
         // Clone the options instance in case caller modifies it:
         return new \Finna\Search\Combined\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config'), $serviceLocator->getServiceLocator()->get('VuFind\\DateConverter'));
     } elseif ($name === 'mixedlist') {
         // Clone the options instance in case caller modifies it:
         return new \Finna\Search\MixedList\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config'));
     } elseif ($name === 'favorites') {
         // Clone the options instance in case caller modifies it:
         return new \Finna\Search\Favorites\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config'));
     } elseif ($name === 'emptyset') {
         // Clone the options instance in case caller modifies it:
         return new \Finna\Search\EmptySet\Params(clone $options, $serviceLocator->getServiceLocator()->get('VuFind\\Config'));
     }
     return parent::createServiceWithName($serviceLocator, $name, $requestedName);
 }
开发者ID:jlehmus,项目名称:NDL-VuFind2,代码行数:36,代码来源:PluginFactory.php

示例15: createServiceWithName

 /**
  * @param ServiceLocatorInterface $serviceLocator
  * @param                         $name
  * @param                         $requestedName
  *
  * @return mixed|object
  */
 public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
 {
     if ($serviceLocator instanceof \Zend\Mvc\Controller\ControllerManager) {
         $this->serviceManager = $serviceLocator->getServiceLocator();
         $this->controllerPluginManager = $serviceLocator;
         $this->formElementManager = $this->serviceManager->get('formElementManager');
         $this->viewHelperManager = $this->serviceManager->get('viewHelperManager');
     } elseif ($serviceLocator instanceof \Zend\View\HelperPluginManager) {
         $this->serviceManager = $serviceLocator->getServiceLocator();
         $this->controllerPluginManager = $this->serviceManager->get('controllerPluginManager');
         $this->formElementManager = $this->serviceManager->get('formElementManager');
         $this->viewHelperManager = $serviceLocator;
     } elseif ($serviceLocator instanceof \Zend\Form\FormElementManager) {
         $this->serviceManager = $serviceLocator->getServiceLocator();
         $this->controllerPluginManager = $this->serviceManager->get('controllerPluginManager');
         $this->formElementManager = $serviceLocator;
         $this->viewHelperManager = $this->serviceManager->get('viewHelperManager');
     } elseif ($serviceLocator instanceof \Zend\Mvc\Controller\PluginManager) {
         $this->serviceManager = $serviceLocator->getServiceLocator();
         $this->controllerPluginManager = $serviceLocator;
         $this->formElementManager = $this->serviceManager->get('formElementManager');
         $this->viewHelperManager = $this->serviceManager->get('viewHelperManager');
     } else {
         $this->serviceManager = $serviceLocator;
         $this->controllerPluginManager = $this->serviceManager->get('controllerPluginManager');
         $this->formElementManager = $this->serviceManager->get('formElementManager');
         $this->viewHelperManager = $this->serviceManager->get('viewHelperManager');
     }
     if (FALSE !== strstr($requestedName, 'Controller')) {
         $requestedName = $requestedName . 'Controller';
     }
     return $this->buildGraph($requestedName);
 }
开发者ID:middleout,项目名称:mdo-bundle-zf2-auto-dep-inject,代码行数:40,代码来源:AbstractGenericFactory.php


注:本文中的Zend\ServiceManager\ServiceLocatorInterface::getServiceLocator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。