当前位置: 首页>>代码示例>>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;未经允许,请勿转载。