Skip to content

Commit 5845b9e

Browse files
NGSTACK-1017 simplify feature compiler pass logic, remove abstract feature compiler pass
1 parent 92bc7f4 commit 5845b9e

File tree

2 files changed

+10
-46
lines changed

2 files changed

+10
-46
lines changed

src/DependencyInjection/CompilerPass/FeatureCompilerPass.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/DependencyInjection/CompilerPass/IriTemplateGeneratorCompilerPass.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@
66

77
use Netgen\ApiPlatformExtras\Command\GenerateIriTemplatesCommand;
88
use Netgen\ApiPlatformExtras\Service\IriTemplatesService;
9+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
910
use Symfony\Component\DependencyInjection\ContainerBuilder;
1011
use Symfony\Component\DependencyInjection\Definition;
1112

12-
final class IriTemplateGeneratorCompilerPass extends FeatureCompilerPass
13+
final class IriTemplateGeneratorCompilerPass implements CompilerPassInterface
1314
{
15+
private const FEATURE_ENABLED_PARAMETER = 'netgen_api_platform_extras.features.iri_template_generator.enabled';
16+
1417
public function process(ContainerBuilder $container): void
1518
{
16-
if ($container->getParameter($this->getFeatureEnabledParameterPath()) === false) {
19+
if (
20+
!$container->hasParameter(self::FEATURE_ENABLED_PARAMETER)
21+
|| $container->getParameter(self::FEATURE_ENABLED_PARAMETER) === false
22+
) {
1723
return;
1824
}
1925

@@ -22,8 +28,7 @@ public function process(ContainerBuilder $container): void
2228
IriTemplatesService::class,
2329
new Definition(IriTemplatesService::class),
2430
)
25-
->setAutowired(true)
26-
->setPublic(true);
31+
->setAutowired(true);
2732

2833
$container
2934
->setDefinition(
@@ -37,7 +42,6 @@ public function process(ContainerBuilder $container): void
3742
'description' => 'Generate IRI templates and write them to a JSON file',
3843
],
3944
)
40-
->setAutowired(true)
41-
->setPublic(true);
45+
->setAutowired(true);
4246
}
4347
}

0 commit comments

Comments
 (0)