DX: use tags and dependency injection to build ExportManager

This commit is contained in:
2022-10-17 17:41:14 +02:00
parent 50e12375f8
commit 4ce56a01a7
4 changed files with 38 additions and 17 deletions

View File

@@ -18,7 +18,7 @@ use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
/**
* Compiles the services tagged with :.
* Compiles the services tagged with :
*
* - chill.export
* - chill.export_formatter
@@ -39,11 +39,11 @@ class ExportsCompilerPass implements CompilerPassInterface
'Chill\MainBundle\Export\ExportManager'
);
$this->compileExports($chillManagerDefinition, $container);
$this->compileFilters($chillManagerDefinition, $container);
$this->compileAggregators($chillManagerDefinition, $container);
$this->compileFormatters($chillManagerDefinition, $container);
$this->compileExportElementsProvider($chillManagerDefinition, $container);
//$this->compileExports($chillManagerDefinition, $container);
//$this->compileFilters($chillManagerDefinition, $container);
//$this->compileAggregators($chillManagerDefinition, $container);
//$this->compileFormatters($chillManagerDefinition, $container);
//$this->compileExportElementsProvider($chillManagerDefinition, $container);
}
private function compileAggregators(
@@ -119,6 +119,12 @@ class ExportsCompilerPass implements CompilerPassInterface
$knownAliases = [];
foreach ($taggedServices as $id => $tagAttributes) {
if (!$container->has($id)) {
dump('the service was removed');
continue;
}
foreach ($tagAttributes as $attributes) {
if (!isset($attributes['alias'])) {
throw new LogicException("the 'alias' attribute is missing in your " .