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