Skip to content

Commit

Permalink
Theoretically, there could be more than one ApiDocGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
Luehrsen committed Nov 20, 2023
1 parent 80ce859 commit 7cfe0d0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions DependencyInjection/Compiler/CustomProcessorPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ public function process(ContainerBuilder $container): void
$definitions[$id] = $definition;
}

// If the ApiDocGenerator service is not defined, then there is nothing to do
if (!$container->has(ApiDocGenerator::class)) {
// If there are no definitions, we can stop here.
if (empty($definitions)) {
return;
}

$definition = $container->getDefinition(ApiDocGenerator::class);
$processors = [];
foreach ($container->findTaggedServiceIds('swagger.processor') as $id => $tags) {
$processors[] = $id;
}

foreach($processors as $processor) {
$definition->addMethodCall('registerProcessor', [$processor]);
foreach( $definitions as $definition ) {
foreach($processors as $processor) {
$definition->addMethodCall('registerProcessor', [$processor]);
}
}
}
}

0 comments on commit 7cfe0d0

Please sign in to comment.