本文整理汇总了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;
}
示例2: getConfig
protected function getConfig()
{
if (!$this->config) {
$this->config = $this->serviceLocator->getServiceLocator()->get('VuFind\\Config')->get('config');
}
return $this->config;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}