當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ServiceLocatorInterface::addAbstractFactory方法代碼示例

本文整理匯總了PHP中Zend\ServiceManager\ServiceLocatorInterface::addAbstractFactory方法的典型用法代碼示例。如果您正苦於以下問題:PHP ServiceLocatorInterface::addAbstractFactory方法的具體用法?PHP ServiceLocatorInterface::addAbstractFactory怎麽用?PHP ServiceLocatorInterface::addAbstractFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\ServiceManager\ServiceLocatorInterface的用法示例。


在下文中一共展示了ServiceLocatorInterface::addAbstractFactory方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createService

 /**
  * Class responsible for instantiating a DiAbstractServiceFactory
  *
  * @param  ServiceLocatorInterface $serviceLocator
  * @return DiAbstractServiceFactory
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $factory = new DiAbstractServiceFactory($serviceLocator->get('Di'), DiAbstractServiceFactory::USE_SL_BEFORE_DI);
     if ($serviceLocator instanceof ServiceManager) {
         /* @var $serviceLocator ServiceManager */
         $serviceLocator->addAbstractFactory($factory);
     }
     return $factory;
 }
開發者ID:leonardovn86,項目名稱:zf2_basic2013,代碼行數:15,代碼來源:DiAbstractServiceFactoryFactory.php

示例2: createService

 /**
  * Create and return abstract factory seeded by dependency injector
  *
  * Creates and returns an abstract factory seeded by the dependency
  * injector. If the "di" key of the configuration service is set, that
  * sub-array is passed to a DiConfiguration object and used to configure
  * the DI instance. The DI instance is then used to seed the
  * DiAbstractServiceFactory, which is then registered with the service
  * manager.
  *
  * @param  ServiceLocatorInterface $serviceLocator
  * @return Di
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $di = new Di();
     $config = $serviceLocator->get('Configuration');
     if (isset($config['di'])) {
         $di->configure(new DiConfiguration($config['di']));
     }
     if ($serviceLocator instanceof ServiceManager) {
         // register as abstract factory as well:
         $serviceLocator->addAbstractFactory(new DiAbstractServiceFactory($di, DiAbstractServiceFactory::USE_SL_BEFORE_DI));
     }
     return $di;
 }
開發者ID:robertodormepoco,項目名稱:zf2,代碼行數:26,代碼來源:DiFactory.php

示例3: registerAbstractFactory

 /**
  * @param ServiceLocatorInterface $sl
  * @param Di $di
  * @return void
  */
 protected function registerAbstractFactory(ServiceLocatorInterface $sl, Di $di)
 {
     if ($sl instanceof ServiceManager) {
         /* @var $sl ServiceManager */
         $sl->addAbstractFactory(new DiAbstractServiceFactory($di, DiAbstractServiceFactory::USE_SL_BEFORE_DI));
     }
 }
開發者ID:royopa,項目名稱:OcraDiCompiler,代碼行數:12,代碼來源:DiFactory.php


注:本文中的Zend\ServiceManager\ServiceLocatorInterface::addAbstractFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。