Driver.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace Doctrine\DBAL;
  3. use Doctrine\DBAL\Driver\API\ExceptionConverter;
  4. use Doctrine\DBAL\Driver\Connection as DriverConnection;
  5. use Doctrine\DBAL\Driver\Exception;
  6. use Doctrine\DBAL\Platforms\AbstractPlatform;
  7. use Doctrine\DBAL\Schema\AbstractSchemaManager;
  8. use SensitiveParameter;
  9. /**
  10. * Driver interface.
  11. * Interface that all DBAL drivers must implement.
  12. *
  13. * @psalm-import-type Params from DriverManager
  14. */
  15. interface Driver
  16. {
  17. /**
  18. * Attempts to create a connection with the database.
  19. *
  20. * @param array<string, mixed> $params All connection parameters.
  21. * @psalm-param Params $params All connection parameters.
  22. *
  23. * @return DriverConnection The database connection.
  24. *
  25. * @throws Exception
  26. */
  27. public function connect(
  28. #[SensitiveParameter]
  29. array $params
  30. );
  31. /**
  32. * Gets the DatabasePlatform instance that provides all the metadata about
  33. * the platform this driver connects to.
  34. *
  35. * @return AbstractPlatform The database platform.
  36. */
  37. public function getDatabasePlatform();
  38. /**
  39. * Gets the SchemaManager that can be used to inspect and change the underlying
  40. * database schema of the platform this driver connects to.
  41. *
  42. * @deprecated Use {@link AbstractPlatform::createSchemaManager()} instead.
  43. *
  44. * @return AbstractSchemaManager
  45. */
  46. public function getSchemaManager(Connection $conn, AbstractPlatform $platform);
  47. /**
  48. * Gets the ExceptionConverter that can be used to convert driver-level exceptions into DBAL exceptions.
  49. */
  50. public function getExceptionConverter(): ExceptionConverter;
  51. }