Issue #3389544: Implement ConnectionRegistry
Merged
requested to merge issue/dbal-3389544:3389544-doctrine-persistence--connection-registry into 2.x
1 unresolved thread
Merge request reports
Activity
added 1 commit
- 20bbf75e - doctrine connection registry for drupal/dbal
- src/DbalServiceProvider.php 0 → 100644
17 18 /** 19 * {@inheritdoc} 20 */ 21 public function register(ContainerBuilder $container) { 22 if (class_exists('Drupal\dbal\DoctrineConnectionRegistry')) { 23 $definition = (new Definition(DoctrineConnectionRegistry::class)) 24 ->addArgument(['default' => new Reference('dbal_connection')]) 25 // Private service: Use autowiring or the service alias if you need, 26 // e.g: \Drupal::service(\Doctrine\Persistence\ConnectionRegistry::class); 27 ->setPublic(FALSE); 28 29 $anonymousHash = ContainerBuilder::hash(DoctrineConnectionRegistry::class . mt_rand()); 30 $container->setDefinition('.' . $anonymousHash, $definition); 31 32 $container->setAlias(ConnectionRegistry::class, '.' . $anonymousHash); Its a mix of:
- symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php and
- symfony/framework-bundle/DependencyInjection/FrameworkExtension.php:1213
dot prefix is supposed to indicate hidden. Theres this.
Then the class + random from the first link.
So its accessible via autowire but the id is random.
Edited by dpi
Please register or sign in to reply