You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Define the controllers and the HTTP value resolver explicitly, without autowiring nor autoconfiguration #192
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
Merge pull request #193 from cleverage/192