當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。