I try to inject the symfony service container into a dcotrine dynamic connection wrapper_class
use Doctrine\DBAL\Connection;
class DynamicConnection extends Connection
{
public $container;
/**
* @required
* @param $container
*/
public function setContainer(ContainerInterface $container)
{
$this->container = $container;
}
}
I also tried to inject it with the service.yaml
App\Service\Database\DynamicConnection:
calls:
- [setContainer, ['@service_container']]
But this is also not working. How can i inject the service container here? My goal here is to get a variable of the service container:
$this->container->get('my.string.variable')