0

I installed the bundle to my project https://github.com/M6Web/CassandraBundle

But when i try to reach this config in controller like this

$cassandra = $this->get('m6web_cassandra.client.myclient');

I got this error

The "m6web_cassandra.client.myclient" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.

In the github page are not any info about it, How can i reach the config?

Tan
  • 141
  • 1
  • 2
  • 12
  • 3
    As the message implies, your should inject the client either into the controller's constructor or the action method. This is the "new" way of doing things in SF4. It's possible that you may need to create an alias for the client. The docs should cover this. "bin/console debug:container --show-private" | grep -i m6web" might help. – Cerad Feb 28 '18 at 13:49
  • To provide a similar answer as 3.4 changed the behavior of public and private services: https://stackoverflow.com/a/48332102/1144627 – Will B. Feb 28 '18 at 14:18
  • I changed public: false with public: true and then i got this error - You have requested a non-existent service "m6web_cassandra.client.client1". – Tan Feb 28 '18 at 14:54
  • Where did you change `public` to true ? – j-guyon Feb 28 '18 at 16:54
  • @n3k in services.yaml https://ibb.co/exbDsc – Tan Feb 28 '18 at 17:49
  • The default public value will be applyed only in services witch are defined in the same file. Service you try to get is define in the Extension Class of the cassandra bundle. As Cerad said, you should declare an public alias to the service or inject it in your controller. – j-guyon Feb 28 '18 at 18:22

0 Answers0