|
12 | 12 | use Doctrine\DBAL\Platforms\AbstractPlatform;
|
13 | 13 | use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
14 | 14 | use Doctrine\DBAL\VersionAwarePlatformDriver;
|
15 |
| -use Sentry\State\HubInterface; |
16 | 15 |
|
17 | 16 | /**
|
18 | 17 | * This is a simple implementation of the {@see Driver} interface that decorates
|
|
24 | 23 | final class TracingDriverForV2 implements Driver, VersionAwarePlatformDriver, ExceptionConverterDriver
|
25 | 24 | {
|
26 | 25 | /**
|
27 |
| - * @var HubInterface The current hub |
| 26 | + * @var TracingDriverConnectionFactoryInterface |
28 | 27 | */
|
29 |
| - private $hub; |
| 28 | + private $connectionFactory; |
30 | 29 |
|
31 | 30 | /**
|
32 | 31 | * @var Driver|VersionAwarePlatformDriver|ExceptionConverterDriver The instance of the decorated driver
|
33 | 32 | */
|
34 | 33 | private $decoratedDriver;
|
35 | 34 |
|
36 | 35 | /**
|
37 |
| - * @param HubInterface $hub The current hub |
38 |
| - * @param Driver $decoratedDriver The instance of the driver to decorate |
| 36 | + * @param TracingDriverConnectionFactoryInterface $connectionFactory The connection factory |
| 37 | + * @param Driver $decoratedDriver The instance of the driver to decorate |
39 | 38 | */
|
40 |
| - public function __construct(HubInterface $hub, Driver $decoratedDriver) |
| 39 | + public function __construct(TracingDriverConnectionFactoryInterface $connectionFactory, Driver $decoratedDriver) |
41 | 40 | {
|
42 |
| - $this->hub = $hub; |
43 | 41 | $this->decoratedDriver = $decoratedDriver;
|
| 42 | + $this->connectionFactory = $connectionFactory; |
44 | 43 | }
|
45 | 44 |
|
46 | 45 | /**
|
47 | 46 | * {@inheritdoc}
|
48 | 47 | */
|
49 |
| - public function connect(array $params, $username = null, $password = null, array $driverOptions = []): TracingDriverConnection |
| 48 | + public function connect(array $params, $username = null, $password = null, array $driverOptions = []): TracingDriverConnectionInterface |
50 | 49 | {
|
51 |
| - return new TracingDriverConnection( |
52 |
| - $this->hub, |
| 50 | + return $this->connectionFactory->create( |
53 | 51 | $this->decoratedDriver->connect($params, $username, $password, $driverOptions),
|
54 |
| - $this->decoratedDriver->getDatabasePlatform()->getName(), |
| 52 | + $this->decoratedDriver->getDatabasePlatform(), |
55 | 53 | $params
|
56 | 54 | );
|
57 | 55 | }
|
|
0 commit comments