| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Doctrine\DBAL\Driver\Middleware;
|
|
|
4 |
|
|
|
5 |
use Doctrine\DBAL\Connection;
|
|
|
6 |
use Doctrine\DBAL\Driver;
|
|
|
7 |
use Doctrine\DBAL\Driver\API\ExceptionConverter;
|
|
|
8 |
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
|
|
9 |
use Doctrine\DBAL\VersionAwarePlatformDriver;
|
|
|
10 |
use Doctrine\Deprecations\Deprecation;
|
|
|
11 |
|
|
|
12 |
abstract class AbstractDriverMiddleware implements VersionAwarePlatformDriver
|
|
|
13 |
{
|
|
|
14 |
private Driver $wrappedDriver;
|
|
|
15 |
|
|
|
16 |
public function __construct(Driver $wrappedDriver)
|
|
|
17 |
{
|
|
|
18 |
$this->wrappedDriver = $wrappedDriver;
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* {@inheritdoc}
|
|
|
23 |
*/
|
|
|
24 |
public function connect(array $params)
|
|
|
25 |
{
|
|
|
26 |
return $this->wrappedDriver->connect($params);
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
/**
|
|
|
30 |
* {@inheritdoc}
|
|
|
31 |
*/
|
|
|
32 |
public function getDatabasePlatform()
|
|
|
33 |
{
|
|
|
34 |
return $this->wrappedDriver->getDatabasePlatform();
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
/**
|
|
|
38 |
* {@inheritdoc}
|
|
|
39 |
*
|
|
|
40 |
* @deprecated Use {@link AbstractPlatform::createSchemaManager()} instead.
|
|
|
41 |
*/
|
|
|
42 |
public function getSchemaManager(Connection $conn, AbstractPlatform $platform)
|
|
|
43 |
{
|
|
|
44 |
Deprecation::triggerIfCalledFromOutside(
|
|
|
45 |
'doctrine/dbal',
|
|
|
46 |
'https://github.com/doctrine/dbal/pull/5458',
|
|
|
47 |
'AbstractDriverMiddleware::getSchemaManager() is deprecated.'
|
|
|
48 |
. ' Use AbstractPlatform::createSchemaManager() instead.',
|
|
|
49 |
);
|
|
|
50 |
|
|
|
51 |
return $this->wrappedDriver->getSchemaManager($conn, $platform);
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
public function getExceptionConverter(): ExceptionConverter
|
|
|
55 |
{
|
|
|
56 |
return $this->wrappedDriver->getExceptionConverter();
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
* {@inheritdoc}
|
|
|
61 |
*/
|
|
|
62 |
public function createDatabasePlatformForVersion($version)
|
|
|
63 |
{
|
|
|
64 |
if ($this->wrappedDriver instanceof VersionAwarePlatformDriver) {
|
|
|
65 |
return $this->wrappedDriver->createDatabasePlatformForVersion($version);
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
return $this->wrappedDriver->getDatabasePlatform();
|
|
|
69 |
}
|
|
|
70 |
}
|