src/CoreBundle/EventListener/DcGeneral/EnvironmentPopulator/DataProviderPopulator.php
private function injectServiceContainerIntoDataDrivers($providerDefinitions, $environment)
    {
        foreach ($providerDefinitions as $provider) {
            $providerInstance = $environment->getDataProvider($provider->getName());
            if ($providerInstance instanceof Driver) {
                $initialization = $provider->getInitializationData();
                $metaModel      = $this->factory->getMetaModel($initialization['source']);
                $providerInstance->setBaseConfig(
                    array_merge($initialization, ['metaModel' => $metaModel])
                );
                $providerInstance->setDispatcher($this->dispatcher);
                $providerInstance->setConnection($this->connection);
            }
        }
    }
private function injectServiceContainerIntoDataDrivers($providerDefinitions, $environment)
    {
        foreach ($providerDefinitions as $provider) {
            $providerInstance = $environment->getDataProvider($provider->getName());
            if ($providerInstance instanceof Driver) {
                $initialization = $provider->getInitializationData();
                $metaModel      = $this->factory->getMetaModel($initialization['source']);
                $providerInstance->setBaseConfig(
                    array_merge($initialization, ['metaModel' => $metaModel])
                );
                $providerInstance->setDispatcher($this->dispatcher);
                $providerInstance->setConnection($this->connection);
            }
        }
    }
Inject the service container into the data driver instances.

@param DataProviderDefinitionInterface $providerDefinitions The definitions.
@param EnvironmentInterface            $environment         The environment containing the providers.

@return void