Skip to content

Add history plugin to the auto discovery client #36

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
Jan 21, 2016
Merged
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
6 changes: 6 additions & 0 deletions DependencyInjection/HttplugExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Http\HttplugBundle\DependencyInjection;

use Http\Client\Plugin\PluginClient;
use Http\HttplugBundle\ClientFactory\DummyClient;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -88,6 +89,11 @@ protected function configureClients(ContainerBuilder $container, array $config)
// Alias the first client to httplug.client.default
if ($first !== null) {
$container->setAlias('httplug.client.default', 'httplug.client.'.$first);
} elseif (isset($config['_inject_collector_plugin'])) {
// No client was configured. Make sure to inject history plugin to the auto discovery client.
$container->register('httplug.client', PluginClient::class)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was httplug.client not available at all before? or did this happen somewhere else? i am a bit confused by this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

httplug.client was an alias before this line. This register it as a service.

->addArgument(new Reference('httplug.client.default'))
->addArgument([new Reference('httplug.collector.history_plugin')]);
}
}
}