Skip to content

#52 - Load the SOAP clients lazily from a service locator indexed by code - #53

Merged
njoubert-cleverage merged 2 commits into
mainfrom
52
Oct 15, 2026
Merged

njoubert-cleverage merged 2 commits into
mainfrom
52

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #52. Same model as process-bundle#276 (TransformerLocatorCompilerPass / TransformerRegistry) and cleverage/rest-process-bundle#59.

  • RegisterClientsPass: the services tagged cleverage.soap.client with a code attribute (- { name: cleverage.soap.client, code: my_api }) are registered in a service locator, passed to ClientRegistry (new optional constructor argument): a client is only instantiated when the soap_request task or transformer uses it. Duplicate or empty codes fail the container compilation, with the service ids.
  • A service tagged without code is still registered with ClientRegistry::addClient() (eager), now deprecated since 3.3: the code will be required in 4.0.
  • ClientRegistry::getClient() checks that the service implements ClientInterface and that its getCode() returns the code of the tag; getClients() instantiates every client; FQCN alias CleverAge\SoapProcessBundle\Registry\ClientRegistry.
  • New #[AsSoapClient(code: '...')] attribute (registerAttributeForAutoconfiguration()), adding the tag with its code. ClientInterface itself is not autoconfigured (BC, see the issue).
  • Require symfony/service-contracts (ServiceProviderInterface, already installed through process-bundle).
  • Docs: code attribute in every example, registration notes.

Checked in process-bundle-demo (patch applied to the vendor), demo.soap.client_headers, demo.soap.false_result, demo.soap.fault_without_exceptions, demo.soap.call_failure and demo.soap.headers_leak:

  • current declarations (no code): same exit codes as on main (the two failures are expected by these demos), deprecations logged;
  • with the code attribute on the 4 SOAP clients: same exit codes, no deprecation, lint:container OK.

The demo declarations will be updated in a demo PR (the code attribute is ignored by the previous versions).

Requirements

  • Documentation updates
    • Reference
    • Changelog
  • Unit tests

Breaking changes

None: the clients tagged without code keep working, with a deprecation (3.3, removal in 4.0). Behaviour change: the clients with a code are no longer instantiated with the registry.

🤖 Generated with Claude Code

njoubert-cleverage and others added 2 commits October 15, 2026 17:54
…code

- RegisterClientsPass: the services tagged cleverage.soap.client with a
  code attribute are registered in a service locator passed to the
  ClientRegistry (new optional constructor argument): a client is only
  instantiated when a task or the transformer uses it. Duplicate or empty
  codes fail the container compilation. Without code, the client is still
  registered with addClient(), now deprecated (the code will be required in
  4.0).
- ClientRegistry: getClient() checks that the service implements
  ClientInterface and that its getCode() is the code of the tag;
  getClients() instantiates every client; FQCN alias to autowire it.
- New #[AsSoapClient(code: '...')] attribute (autoconfiguration), adding
  the tag with its code.
- Require symfony/service-contracts (ServiceProviderInterface).
- Docs: code attribute in every example, registration notes.

Same model as process-bundle#276 (TransformerRegistry) and rest#58.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…sed by the extension tests

PHPUnit with coverage (CI) reported the extension test instantiating the
registry as risky (code not listed in UsesClass), and the attribute
constructor as not covered.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@njoubert-cleverage
njoubert-cleverage merged commit b4d92e4 into main Oct 15, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Load the SOAP clients lazily from a service locator indexed by code

1 participant