Skip to content

document autowiring and disabling it #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions integrations/symfony-bundle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ Usage
$request = $this->container->get('httplug.message_factory')->createRequest('GET', 'http://example.com');
$response = $this->container->get('httplug.client.acme')->sendRequest($request);

Autowiring the Default Client
-----------------------------

The first configured client is considered the "default" client. It is available
for `autowiring`_ both for ``HttpClient`` and ``HttpAsyncClient``. This can be
convenient to build your application.

However, if you configured several different clients and need to be sure that
the correct client is used in each service, it can also hide mistakes.
Therefore you can disable autowiring with a configuration option:

.. code-block:: yaml

httplug:
default_client_autowiring: false

Web Debug Toolbar
`````````````````
Expand Down Expand Up @@ -444,3 +459,4 @@ To mock a response in your tests, do:
<div style="clear:left"></div>

.. _`Symfony Flex`: https://symfony.com/doc/current/setup/flex.html
.. _`autowiring`: https://symfony.com/doc/current/service_container/autowiring.html
4 changes: 4 additions & 0 deletions integrations/symfony-full-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ This page shows an example of all configuration values provided by the bundle.

// config.yml
httplug:
# allows to disable autowiring of the clients
default_client_autowiring: true
# define which service to use as httplug.<type>
# this does NOT change autowiring, which will always go to the "default" client
main_alias:
client: httplug.client.default
message_factory: httplug.message_factory.default
Expand Down