Repository navigation
#192 - Define the controllers and the HTTP value resolver explicitly, without autowiring nor autoconfiguration - #193
Merged
Merged
Conversation
… without autowiring nor autoconfiguration The controllers were loaded by a resource with autowire and autoconfigure, the HTTP value resolver relied on autoconfigure. They are defined explicitly (Symfony best practices for bundles), with the same compiled arguments, tags and calls. The $context binding no longer registers AdminContextFactory for the AdminContext arguments of the EasyAdmin actions. Tests and CHANGELOG. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #192, as cleverage/process-bundle#149 (PR cleverage/process-bundle#291).
config/services/controller.yaml: the 10 controllers are defined one by one instead of aresourcewithautowire/autoconfigure/bind: named constructor arguments,setContainer()call with the service locator ofAbstractController(@Psr\Container\ContainerInterface, replaced by thecontainer.service_subscriberlocator), and the tags autoconfiguration added:controller.service_arguments,container.service_subscriber,ea.dashboard_controller/ea.crud_controller(EasyAdmin interfaces),ea.admin_route_controller(#[AdminRoute]),routing.controller(#[Route], used by Symfony 7.3 or later, ignored before).controller.service_argumentswithout attribute still autowires the arguments of the actions (Symfony behaviour, independent ofautowire), so the EasyAdmin actions are unchanged.LoginController::__invoke()getsAuthenticationUtilsfrom the tag (action/argument/id),LaunchAction::__invoke()its$uploadDirectoryfrom abindof its own definition.config/services/http_value_resolver.yaml: thecontroller.targeted_value_resolver(http_process_execution) andcontroller.argument_value_resolvertags, instead ofautoconfigure.Compiled container of the test kernel (debug XML dump, Symfony 8.1, EasyAdmin 5.7), before / after, compared for the controllers and the value resolver: same classes, arguments, tags and
setContainer()locator; only change in the action arguments locators: the$contextbinding of the former resource registered theAdminContextFactoryservice for theAdminContext $contextarguments of the EasyAdmin actions (index(),detail(),edit()…). It was never used (EasyAdmin'sAdminContextResolver, priority 0, resolves the context before theServiceValueResolver, priority -50), and it is gone: these arguments are now resolved as in any EasyAdmin application.Checked in process-bundle-demo (patch applied to the vendor), with the same results as
main:lint:containerOK; login, dashboard, process list, launch form (demo.upload_and_run), index of the 4 CRUD pages, HTTP API without token (401).Tests: no service of the bundle is autowired or autoconfigured, every class of
src/Controller/is registered as a public controller with theAbstractControllerservices, tags of the targeted value resolver. With coverage (pcov): 455 tests, no risky test. Also run with--prefer-lowest(Symfony 6.4). PHPStan, PHP-CS-Fixer, Rector and Twig-CS-Fixer OK.Requirements
Breaking changes
None: same services, arguments and tags (the controllers are
@internal). A new controller must now be declared incontroller.yaml(checked by the tests).🤖 Generated with Claude Code