Skip to content

refactor(di): OptionSync/Loader + ManagerOrderCostRecalculator in ServiceRegistry - #477

Open
Ibochkarev wants to merge 2 commits into
betafrom
feat/issue-363-service-registry-di
Open

refactor(di): OptionSync/Loader + ManagerOrderCostRecalculator in ServiceRegistry#477
Ibochkarev wants to merge 2 commits into
betafrom
feat/issue-363-service-registry-di

Conversation

@Ibochkarev

Copy link
Copy Markdown
Member

Summary

  • Register ms3_option_loader, ms3_option_sync, and ms3_manager_order_cost_recalculator in ServiceRegistry for override via ms3.services.php / ms3.services.d/.
  • OptionService receives loader/sync from the DI container instead of new.
  • OrdersController resolves ManagerOrderCostRecalculator via services->get(...).
  • Document override keys in ms3.services.example.php.
  • Add ServiceRegistryDiTest smoke coverage.

Closes #363

Test plan

  • php tests/ServiceRegistryDiTest.php
  • composer ci:php (lint + smoke)
  • Override smoke: custom class via ms3.services.php for ms3_option_sync (manual on staging)

@Ibochkarev Ibochkarev added enhancement New feature or request priority: medium Средний приоритет tech-debt Maintainability / refactor / architecture debt labels Jul 29, 2026
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
Ibochkarev force-pushed the feat/issue-363-service-registry-di branch from 6491a0c to 91ce41a Compare July 29, 2026 11:31
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: medium Средний приоритет tech-debt Maintainability / refactor / architecture debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] DI: OptionSync/Loader + ManagerOrderCostRecalculator в ServiceRegistry

1 participant