Skip to content

Define the controllers and the HTTP value resolver explicitly, without autowiring nor autoconfiguration #192

Closed

Description

@njoubert-cleverage

Description

The controllers are loaded by a resource with autowire: true and autoconfigure: true (config/services/controller.yaml), and the HTTP value resolver relies on autoconfigure: true to get its tags from #[AsTargetedValueResolver] (config/services/http_value_resolver.yaml). The best practices for reusable bundles say: "Services should not use autowiring or autoconfiguration. Instead, all services should be defined explicitly." cleverage/process-bundle did it for its tasks and transformers (cleverage/process-bundle#149, PR cleverage/process-bundle#291).

What autowiring and autoconfiguration bring today (compiled container of the test kernel):

  • the constructor arguments of the 10 controllers, from the bind of controller.yaml or autowired by type (AdminContextProvider, IntlFormatter, assets.packages, security.helper, validator, AdminUrlGenerator…);
  • the tags ea.dashboard_controller / ea.crud_controller (EasyAdmin interfaces), ea.admin_route_controller (#[AdminRoute]), routing.controller (#[Route], Symfony 7.3+), container.service_subscriber and the setContainer() call of AbstractController;
  • the action arguments: AuthenticationUtils of LoginController::__invoke(), $uploadDirectory of LaunchAction::__invoke();
  • the controller.targeted_value_resolver (http_process_execution) and controller.argument_value_resolver tags of HttpProcessExecuteValueResolver.

The bind of the resource also leaks into the action arguments of the EasyAdmin CRUD controllers: AdminContext $context of index(), detail(), edit()… is registered in the controller arguments locator as the AdminContextFactory service ($context binding). It is never used because the AdminContext is resolved before by EasyAdmin, but it is wrong.

Define the controllers and the value resolver explicitly, with the same compiled definitions (arguments, tags, calls).

Found during the Symfony bundle best practices review (services).

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None: same services, arguments and tags (the controllers are @internal).

Activity

  1. added a commit that references this issue on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions