refactor(di): OptionSync/Loader + ManagerOrderCostRecalculator in ServiceRegistry - #477
Open
Ibochkarev wants to merge 2 commits into
Open
refactor(di): OptionSync/Loader + ManagerOrderCostRecalculator in ServiceRegistry#477Ibochkarev wants to merge 2 commits into
Ibochkarev wants to merge 2 commits into
Conversation
Wire OptionSyncService, OptionLoaderService, and ManagerOrderCostRecalculator through ServiceRegistry so ms3.services.php overrides work. OptionService receives loader/sync from the container; OrdersController resolves the cost recalculator via DI. Add ServiceRegistryDiTest smoke coverage. Closes #363
Ibochkarev
force-pushed
the
feat/issue-363-service-registry-di
branch
from
July 29, 2026 11:31
6491a0c to
91ce41a
Compare
Address #363 review findings: - OptionService now receives OptionCategoryService via its constructor instead of instantiating it internally; ServiceRegistry resolves ms3_category_option_service from DI for the ms3_option_service factory - Extract ServiceRegistry factory maps (CONTROLLERS_WITH_MS3_ONLY, SERVICES_WITH_MODX_AND_MS3, SERVICES_WITH_DEPENDENCIES) and a new SERVICE_DEPENDENCIES map into public constants so they are inspectable - ServiceRegistryDiTest now asserts behaviorally that every factory-map key and every declared dependency is a registered service key, and that ms3_option_service depends on ms3_category_option_service
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.
Summary
ms3_option_loader,ms3_option_sync, andms3_manager_order_cost_recalculatorinServiceRegistryfor override viams3.services.php/ms3.services.d/.OptionServicereceives loader/sync from the DI container instead ofnew.OrdersControllerresolvesManagerOrderCostRecalculatorviaservices->get(...).ms3.services.example.php.ServiceRegistryDiTestsmoke coverage.Closes #363
Test plan
php tests/ServiceRegistryDiTest.phpcomposer ci:php(lint + smoke)ms3.services.phpforms3_option_sync(manual on staging)