Symfony: Inject object (not service) to service constructor

Viewed 4993

In the definition of my services, I'd like to pass as a service argument constructor an object not a service.

From config.yml:

services:
  acme.services.exampleservice:
    class:  Acme\ExampleBundle\Services\ExampleService
    arguments: 
        entityManager: "@doctrine.orm.entity_manager"
        httpClient: \Example\Http\Client\Client

Note the httpClient argument. This must be an instance of the \Example\Http\Client\Client class.

The above does not work - the string "\Example\Http\Client\Client" is passed as the httpClient argument to the service.

What is the syntax for achieving the above by means of passing an instance of \Example\Http\Client\Client to the service constructor?

1 Answers
Related