Refactor our environment handler to decorate the original one

This commit is contained in:
Kamil Kokot
2019-02-13 00:38:07 +01:00
parent d74cd251d5
commit c54c581e74
7 changed files with 145 additions and 191 deletions

View File

@@ -88,7 +88,6 @@ final class SymfonyExtension implements Extension
public function process(ContainerBuilder $container): void
{
$this->processEnvironmentHandler($container);
}
private function registerMinkDriver(ExtensionManager $extensionManager): void
@@ -137,8 +136,7 @@ final class SymfonyExtension implements Extension
{
$definition = new Definition(ContextServiceEnvironmentHandler::class, [
new Reference(self::KERNEL_ID),
new Reference(ContextExtension::FACTORY_ID),
new Reference(ContextExtension::AGGREGATE_RESOLVER_FACTORY_ID)
new Reference('environment.handler.context'),
]);
$definition->addTag(EnvironmentExtension::HANDLER_TAG, ['priority' => 128]);
@@ -247,13 +245,4 @@ final class SymfonyExtension implements Extension
return is_string($bootstrap) ? $bootstrap : null;
}
private function processEnvironmentHandler(ContainerBuilder $container): void
{
$definition = $container->findDefinition('fob_symfony.environment_handler.context_service');
foreach ($container->findTaggedServiceIds(ContextExtension::CLASS_RESOLVER_TAG) as $serviceId => $tags) {
$definition->addMethodCall('registerClassResolver', [$container->getDefinition($serviceId)]);
}
}
}