While we could have used an abstract definition, its ID would likely conflict with the alias we set for the default client. Remove the abstract definition altogether and simply construct new definitions for each client. This resolves the previous issue where multiple clients would overwrite the constructor arguments of the previous definition.
This commit is contained in:
parent
604193396f
commit
74d993b642
|
@ -70,10 +70,9 @@ class FOSElasticaExtension extends Extension
|
|||
{
|
||||
$clientIds = array();
|
||||
foreach ($clients as $name => $clientConfig) {
|
||||
$clientDef = $container->getDefinition('fos_elastica.client');
|
||||
$clientDef->replaceArgument(0, $clientConfig);
|
||||
|
||||
$clientId = sprintf('fos_elastica.client.%s', $name);
|
||||
$clientDef = new Definition('%fos_elastica.client.class%', array($clientConfig));
|
||||
$clientDef->addMethodCall('setLogger', array(new Reference('fos_elastica.logger')));
|
||||
|
||||
$container->setDefinition($clientId, $clientDef);
|
||||
|
||||
|
|
|
@ -27,13 +27,6 @@
|
|||
<argument type="service" id="fos_elastica.logger" />
|
||||
</service>
|
||||
|
||||
<service id="fos_elastica.client" class="%fos_elastica.client.class%">
|
||||
<argument /> <!-- config -->
|
||||
<call method="setLogger">
|
||||
<argument type="service" id="fos_elastica.logger" />
|
||||
</call>
|
||||
</service>
|
||||
|
||||
<service id="fos_elastica.index_manager" class="FOS\ElasticaBundle\IndexManager">
|
||||
<argument /> <!-- indexes -->
|
||||
<argument /> <!-- default index -->
|
||||
|
|
Loading…
Reference in a new issue