示例#1
0
文件: Module.php 项目: apparat/object
 /**
  * Configure the dependency injection container
  *
  * @param DependencyInjectionContainerInterface $diContainer Dependency injection container
  * @return void
  */
 public function configureDependencyInjection(DependencyInjectionContainerInterface $diContainer)
 {
     parent::configureDependencyInjection($diContainer);
     // Configure the repository service
     $diContainer->register(Service::class, ['shared' => true, 'substitutions' => [AutoConnectorInterface::class => ['instance' => AutoConnector::class], AdapterStrategyFactoryInterface::class => ['instance' => AdapterStrategyFactory::class], ManagerInterface::class => ['instance' => Manager::class]]]);
     // Configure the type service
     $diContainer->register(Type::class, ['substitutions' => [TypeServiceInterface::class => ['instance' => TypeService::class]]]);
     $diContainer->register(Selector::class, ['substitutions' => [TypeServiceInterface::class => ['instance' => TypeService::class]]]);
     // Configure the CommonMark payload processor
     $diContainer->register(AbstractCommonMarkObject::class, ['shared' => false, 'substitutions' => [CommonMarkPayloadProcessorInterface::class => ['instance' => CommonMarkPayloadProcessor::class]]]);
     // Configure the binary payload processor
     $diContainer->register(AbstractBinaryObject::class, ['shared' => false, 'substitutions' => [BinaryPayloadProcessorInterface::class => ['instance' => BinaryPayloadProcessor::class]]]);
 }
示例#2
0
 /**
  * Configure the dependency injection container
  *
  * @param DependencyInjectionContainerInterface $diContainer Dependency injection container
  * @return void
  * @see https://r.je/dice.html#example3-6
  */
 public function configureDependencyInjection(DependencyInjectionContainerInterface $diContainer)
 {
     parent::configureDependencyInjection($diContainer);
 }