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


PHP ServiceManager\ServiceLocatorInterface类代码示例

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


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

示例1: createService

 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $pluginManager = $serviceLocator->get('Phpro\\MailManager\\PluginManager');
     $adapter = $serviceLocator->get('Phpro\\MailManager\\DefaultAdapter');
     $instance = new Instance($pluginManager, $adapter);
     return $instance;
 }
开发者ID:phpro,项目名称:zf-mail-manager,代码行数:14,代码来源:MailManager.php

示例2: createServiceWithName

 public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
 {
     $entity = substr($requestedName, 18);
     $em = $serviceLocator->get('doctrine.entitymanager.orm_default');
     $repository = $em->getRepository('Fulbis\\Core\\Entity\\' . $entity);
     return $repository;
 }
开发者ID:Fulbis,项目名称:api,代码行数:7,代码来源:AbstractFactory.php

示例3: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $dbAdapter = $serviceLocator->get('DbAdapter');
     $hydrator = new HydratingResultSet(new ClassMethods(), new OrderItemEntity());
     $tableGateway = new TableGateway('order_items', $dbAdapter, null, $hydrator);
     return $tableGateway;
 }
开发者ID:pedrohglobo,项目名称:apicodeedu,代码行数:7,代码来源:OrderItemTableGatewayFactory.php

示例4: createService

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

示例5: createService

 public function createService(ServiceLocatorInterface $pluginManager)
 {
     $serviceManager = $pluginManager->getServiceLocator();
     return new JSONErrorResponse($serviceManager);
     // return
     // $serviceManager->get('Application\Controller\Plugin\JSONErrorResponse');
 }
开发者ID:arstropica,项目名称:zf2-dashboard,代码行数:7,代码来源:JsonErrorResponseFactory.php

示例6: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('config');
     try {
         $pdo = $pdo = new \PDO($config['dbAdapterPostgre']['dsn'], $config['dbAdapterPostgre']['username'], $config['dbAdapterPostgre']['password']);
         $sql = "          \n            SELECT                \n                REPLACE(TRIM(SUBSTRING(crypt(sf_private_key_value,gen_salt('xdes')),6,20)),'/','*') AS public_key\n                FROM info_users a \n                INNER JOIN sys_acl_roles sar ON sar.id = a.role_id AND sar.active=0 AND sar.deleted=0 \n                WHERE a.username = :username \n                    AND a.password = :password   \n                    AND a.deleted = 0 \n                    AND a.active = 0 \n                    Limit 1 \n                \n                                 ";
         $statement = $pdo->prepare($sql);
         $statement->bindValue(':username', $_POST['eposta'], \PDO::PARAM_STR);
         $statement->bindValue(':password', md5($_POST['sifre']), \PDO::PARAM_STR);
         //echo debugPDO($sql, $parameters);
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $publicKey = true;
         if (isset($result[0]['public_key'])) {
             $publicKey = $result[0]['public_key'];
         }
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         //return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
         return $publicKey;
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
     //return false;
 }
开发者ID:kuisatz,项目名称:ustalarMerkezi,代码行数:28,代码来源:FactoryServicePublicKeyGenerator.php

示例7: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config');
     $dbOptions = $config['db'];
     $db = new Adapter($dbOptions);
     return $db;
 }
开发者ID:jmleroux,项目名称:zfc-rbac-application,代码行数:7,代码来源:DbAdapter.php

示例8: initialize

 public function initialize($instance, ServiceLocatorInterface $serviceLocator)
 {
     if ($instance instanceof TagReaderAwareInterface) {
         $tagReader = $serviceLocator->get('DocBlockTags\\TagReader');
         $instance->setTagReader($tagReader);
     }
 }
开发者ID:bvarent,项目名称:doc-block-tags,代码行数:7,代码来源:TagReaderInitializer.php

示例9: createService

 /**
  * Create the DefaultAuthorizationListener
  *
  * @param ServiceLocatorInterface $services
  * @return DefaultAuthorizationListener
  */
 public function createService(ServiceLocatorInterface $services)
 {
     if (!$services->has('ZF\\MvcAuth\\Authorization\\AuthorizationInterface')) {
         throw new ServiceNotCreatedException('Cannot create DefaultAuthorizationListener service; ' . 'no ZF\\MvcAuth\\Authorization\\AuthorizationInterface service available!');
     }
     return new DefaultAuthorizationListener($services->get('ZF\\MvcAuth\\Authorization\\AuthorizationInterface'));
 }
开发者ID:nuxwin,项目名称:zf-mvc-auth,代码行数:13,代码来源:DefaultAuthorizationListenerFactory.php

示例10: createService

 /**
  * Create Service
  *
  * @param ServiceLocatorInterface $serviceLocator Zend Service Manager
  *
  * @return Stream
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config');
     $path = $config['rcmLogWriter']['logPath'];
     $writer = new Stream($path);
     return $writer;
 }
开发者ID:reliv,项目名称:Rcm,代码行数:14,代码来源:ZendLogWriterFactory.php

示例11: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $em = $serviceLocator->get('doctrine.entitymanager.orm_default');
     $options = $serviceLocator->get('BiBoBlogOptions');
     $form = new \BiBoBlog\Form\BiBoBlogForm($em, $options);
     return $form;
 }
开发者ID:vn00186388,项目名称:bibo-test,代码行数:7,代码来源:BiBoBlogFormFactory.php

示例12: createService

 /**
  * 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->has('Config') ? $serviceLocator->get('Config') : array();
     // Defaults
     $routerClass = 'Zend\\Mvc\\Router\\Http\\TreeRouteStack';
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     // Console environment?
     if ($rName === 'ConsoleRouter' || $cName === 'router' && Console::isConsole()) {
         // We are in a console, use console router defaults.
         $routerClass = 'Zend\\Mvc\\Router\\Console\\SimpleRouteStack';
         $routerConfig = isset($config['console']['router']) ? $config['console']['router'] : array();
     }
     // Obtain the configured router class, if any
     if (isset($routerConfig['router_class']) && class_exists($routerConfig['router_class'])) {
         $routerClass = $routerConfig['router_class'];
     }
     // Inject the route plugins
     if (!isset($routerConfig['route_plugins'])) {
         $routePluginManager = $serviceLocator->get('RoutePluginManager');
         $routerConfig['route_plugins'] = $routePluginManager;
     }
     // Obtain an instance
     $factory = sprintf('%s::factory', $routerClass);
     return call_user_func($factory, $routerConfig);
 }
开发者ID:eltonoliveira,项目名称:jenkins,代码行数:37,代码来源:RouterFactory.php

示例13: createService

 /**
  * Creates a {@link SocialProfilesFieldset}
  *
  * Uses config from the config key [form_element_config][attach_social_profiles_fieldset]
  * to configure fetch_url, preview_url and name or uses the defaults:
  *  - fetch_url: Route named "auth-social-profiles" with the suffix "?network=%s"
  *  - preview_url: Route named "lang/applications/detail" with the suffix "?action=social-profile&network=%s"
  *  - name: "social_profiles"
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return SocialProfilesFieldset
  * @see \Zend\ServiceManager\FactoryInterface::createService()
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /* @var $serviceLocator \Zend\Form\FormElementManager
      * @var $router         \Zend\Mvc\Router\RouteStackInterface */
     $services = $serviceLocator->getServiceLocator();
     $router = $services->get('Router');
     $config = $services->get('Config');
     $options = isset($config['form_element_config']['attach_social_profiles_fieldset']) ? $config['form_element_config']['attach_social_profiles_fieldset'] : array();
     if (!isset($options['fetch_url'])) {
         $options['fetch_url'] = $router->assemble(array('action' => 'fetch'), array('name' => 'auth-social-profiles')) . '?network=%s';
     }
     if (!isset($options['preview_url'])) {
         $options['preview_url'] = $router->assemble(array('id' => 'null'), array('name' => 'lang/applications/detail'), true) . '?action=social-profile&network=%s';
     }
     if (isset($options['name'])) {
         $name = $options['name'];
         unset($options['name']);
     } else {
         $name = 'social_profiles';
     }
     $options['is_disable_capable'] = false;
     $options['is_disable_elements_capable'] = false;
     $fieldset = new SocialProfilesFieldset($name, $options);
     return $fieldset;
 }
开发者ID:utrenkner,项目名称:YAWIK,代码行数:38,代码来源:SocialProfilesFieldsetFactory.php

示例14: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /** @var \Detail\Apigility\View\JsonRenderer $renderer */
     $renderer = $serviceLocator->get('Detail\\Apigility\\View\\JsonRenderer');
     $strategy = new JsonStrategy($renderer);
     return $strategy;
 }
开发者ID:detailnet,项目名称:dfw-apigility-module,代码行数:7,代码来源:JsonStrategyFactory.php

示例15: createService

 /**
  * Create and return a view manager based on detected environment
  *
  * @param  ServiceLocatorInterface $serviceLocator
  * @return ConsoleViewManager|HttpViewManager
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     if (Console::isConsole()) {
         return $serviceLocator->get('ConsoleViewManager');
     }
     return $serviceLocator->get('HttpViewManager');
 }
开发者ID:leonardovn86,项目名称:zf2_basic2013,代码行数:13,代码来源:ViewManagerFactory.php


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