Skip to content

a client service or alias has been removed #240

@xsuntel

Description

@xsuntel

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions