vendor/sentry/sentry-symfony/src/Tracing/Doctrine/DBAL/TracingDriverForV3.php line 46

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Sentry\SentryBundle\Tracing\Doctrine\DBAL;
  4. use Doctrine\DBAL\Driver;
  5. use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
  6. /**
  7. * This is a simple implementation of the {@see Driver} interface that decorates
  8. * an existing driver to support distributed tracing capabilities. This implementation
  9. * is compatible with all versions of Doctrine DBAL >= 3.0.
  10. *
  11. * @internal
  12. *
  13. * @phpstan-import-type Params from \Doctrine\DBAL\DriverManager as ConnectionParams
  14. */
  15. final class TracingDriverForV3 extends AbstractDriverMiddleware
  16. {
  17. /**
  18. * @var TracingDriverConnectionFactoryInterface The connection factory
  19. */
  20. private $connectionFactory;
  21. /**
  22. * Constructor.
  23. *
  24. * @param TracingDriverConnectionFactoryInterface $connectionFactory The connection factory
  25. * @param Driver $decoratedDriver The instance of the driver to decorate
  26. */
  27. public function __construct(TracingDriverConnectionFactoryInterface $connectionFactory, Driver $decoratedDriver)
  28. {
  29. parent::__construct($decoratedDriver);
  30. $this->connectionFactory = $connectionFactory;
  31. }
  32. /**
  33. * {@inheritdoc}
  34. *
  35. * @phpstan-param ConnectionParams $params
  36. */
  37. public function connect(array $params): TracingDriverConnectionInterface
  38. {
  39. return $this->connectionFactory->create(
  40. parent::connect($params),
  41. $this->getDatabasePlatform(),
  42. $params
  43. );
  44. }
  45. }