Repository navigation
#52 - Load the SOAP clients lazily from a service locator indexed by code - #53
Merged
Merged
Conversation
…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]>
3 tasks done
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 #52. Same model as process-bundle#276 (
TransformerLocatorCompilerPass/TransformerRegistry) and cleverage/rest-process-bundle#59.RegisterClientsPass: the services taggedcleverage.soap.clientwith acodeattribute (- { name: cleverage.soap.client, code: my_api }) are registered in a service locator, passed toClientRegistry(new optional constructor argument): a client is only instantiated when thesoap_requesttask or transformer uses it. Duplicate or empty codes fail the container compilation, with the service ids.codeis still registered withClientRegistry::addClient()(eager), now deprecated since 3.3: thecodewill be required in 4.0.ClientRegistry::getClient()checks that the service implementsClientInterfaceand that itsgetCode()returns the code of the tag;getClients()instantiates every client; FQCN aliasCleverAge\SoapProcessBundle\Registry\ClientRegistry.#[AsSoapClient(code: '...')]attribute (registerAttributeForAutoconfiguration()), adding the tag with its code.ClientInterfaceitself is not autoconfigured (BC, see the issue).symfony/service-contracts(ServiceProviderInterface, already installed through process-bundle).codeattribute 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_failureanddemo.soap.headers_leak:code): same exit codes as onmain(the two failures are expected by these demos), deprecations logged;codeattribute on the 4 SOAP clients: same exit codes, no deprecation,lint:containerOK.The demo declarations will be updated in a demo PR (the
codeattribute is ignored by the previous versions).Requirements
Breaking changes
None: the clients tagged without
codekeep working, with a deprecation (3.3, removal in 4.0). Behaviour change: the clients with acodeare no longer instantiated with the registry.🤖 Generated with Claude Code