Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Symfony tagged_iterator instead of compiler passes #7402

Open
16 tasks
mamazu opened this issue May 6, 2024 · 3 comments
Open
16 tasks

Using Symfony tagged_iterator instead of compiler passes #7402

mamazu opened this issue May 6, 2024 · 3 comments
Assignees
Labels
DX Affecting the end developer Feature New functionality not yet included in Sulu

Comments

@mamazu
Copy link
Contributor

mamazu commented May 6, 2024

Problem description

Currently Sulu reimplements the Symfony DI tagged_iterator functionality for many services. While this is a good idea if you want to have custom logic, this makes no sense in this case. Affected services would be:

  • src/Sulu/Component/Symfony/CompilerPass/TaggedServiceCollectorCompilerPass.php (TaggedServiceCollectorCompilerPass -> tagged_iterator #7424)
  • MarkupBundle/DependencyInjection/CompilerPass/TagCompilerPass.php
  • MarkupBundle/DependencyInjection/CompilerPass/ParserCompilerPass.php (Using tagged_iterators for the markup listener #7403)
  • RouteBundle/DependencyInjection/RouteGeneratorCompilerPass.php
  • MediaBundle/DependencyInjection/FormatCacheClearerCompilerPass.php
  • AdminBundle/DependencyInjection/Compiler/AddAdminPass.php
  • MediaBundle/DependencyInjection/ImageTransformationCompilerPass.php
  • PageBundle/DependencyInjection/Compiler/StructureExtensionCompilerPass.php
  • CoreBundle/DependencyInjection/Compiler/RegisterContentTypesCompilerPass.php
  • AdminBundle/DependencyInjection/Compiler/AddMetadataProviderPass.php
  • AudienceTargetingBundle/DependencyInjection/Compiler/AddRulesPass.php (Using tagged_iterator for RuleCollections #7405)
  • DocumentManagerBundle/DependencyInjection/Compiler/InitializerPass.php
  • PageBundle/DependencyInjection/Compiler/SmartContentDataProviderCompilerPass.php
  • CoreBundle/DependencyInjection/Compiler/ListBuilderMetadataProviderCompilerPass.php
  • SecurityBundle/DependencyInjection/Compiler/AccessControlProviderPass.php
  • CoreBundle/DependencyInjection/Compiler/RegisterLocalizationProvidersPass.php

Proposed solution

Use the constructor and call the function from there or make it immutable. So that you can't add services dynamically.

Future ideas

Maybe in the future we could replace this tagging logic with attributes like this:

#[AsLocalizationProvider]
class CustomLocalizationProvider {}
@mamazu mamazu added Feature New functionality not yet included in Sulu DX Affecting the end developer labels May 6, 2024
@alexander-schranz
Copy link
Member

Would nice if you can extend the issue with a list of services and its releated tags were the Tagged_iterator make sense to discuss if we go with constructor injections or calling the add method.

@mamazu
Copy link
Contributor Author

mamazu commented May 6, 2024

Updated it.

@mamazu
Copy link
Contributor Author

mamazu commented May 6, 2024

Oddly enough the ListBuilderMetadataProviderCompilerPass configures a service that no longer exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Affecting the end developer Feature New functionality not yet included in Sulu
Projects
None yet
Development

No branches or pull requests

2 participants