-
Notifications
You must be signed in to change notification settings - Fork 56
Closed
Description
I have a question about how to use a new registered client on SF4. Because I have trouble using it.
Could you please give me an advice?
httplug.yaml
discovery:
client: 'auto'
async_client: false
clients:
default:
factory: 'httplug.factory.guzzle6'
plugins: ['httplug.plugin.logger']
config:
verify: false
timeout: 3
test:
factory: 'httplug.factory.guzzle6'
plugins: ['httplug.plugin.logger']
config:
verify: false
timeout: 3
IndexController.php
$request = $this->container->get('httplug.message_factory')->createRequest('GET', $url);
$response = $this->container->get('httplug.client.test')->sendRequest($request);
var_dump($response);
die();
ServiceNotFoundException
The "httplug.client.test" service or alias has been removed or inlined when the container was
compiled. You should either make it public, or stop using the container directly and use
dependency injection instead.
$ php ./bin/console debug:container httplug.client.test
Information for Service "httplug.client.test"
=============================================
----------------- ----------------------------------------
Option Value
----------------- ----------------------------------------
Service ID httplug.client.test
Class Http\Client\Common\PluginClient
Tags -
Public no
Synthetic no
Lazy no
Shared yes
Abstract no
Autowired no
Autoconfigured no
Factory Service Http\Client\Common\PluginClientFactory
Factory Method createClient
----------------- ----------------------------------------
Metadata
Metadata
Assignees
Labels
No labels