Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

Symfony 4.2 service is private #37

Closed
tijnhendrikson opened this issue May 29, 2018 · 2 comments
Closed

Symfony 4.2 service is private #37

tijnhendrikson opened this issue May 29, 2018 · 2 comments

Comments

@tijnhendrikson
Copy link
Contributor

tijnhendrikson commented May 29, 2018

Symfony 4 can't load the service, since all services are set to private by default.

This can be fixed by setting the service to public inside the M6WebCassandraExtension class.
Notice: $definition->setPublic(true);

protected function loadClient(ContainerBuilder $container, $clientId, array $config)
{
    $class = 'M6Web\Bundle\CassandraBundle\Cassandra\Client';
    $definition = new Definition($class);
    $definition->addArgument($config);
    $definition->setConfigurator(['M6Web\Bundle\CassandraBundle\Cassandra\Configurator', 'buildCluster']);

    // set service to public
    $definition->setPublic(true);

    if ($config['dispatch_events']) {
        $definition->addMethodCall('setEventDispatcher', [new Reference('event_dispatcher')]);
    }

    $container->setDefinition('m6web_cassandra.client.'.$clientId, $definition);
}
@Oliboy50
Copy link
Member

Oliboy50 commented May 29, 2018

Hello @liacmedia, thanks for pointing this.

You are completely right and we would be happy to merge your pull request if you want to fix this :)

@gbouyge
Copy link
Contributor

gbouyge commented May 30, 2018

Fix in https://github.com/M6Web/CassandraBundle/releases/tag/v2.2.2
Thanks again @liacmedia for the pull request 👍

@gbouyge gbouyge closed this as completed May 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants