vendor/doctrine/dbal/src/Driver/Middleware/AbstractDriverMiddleware.php line 29

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