diff --git a/UPGRADE.md b/UPGRADE.md
index 9e5187c908e..541bb3cc33d 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -8,6 +8,10 @@ awareness about deprecated code.
# Upgrade to 4.0
+## BC BREAK: removed `Driver::getSchemaManager()`
+
+The `Driver::getSchemaManager()` method has been removed.
+
## BC BREAK: removed `AbstractSchemaManager::getDatabasePlatform()`
The `AbstractSchemaManager::getDatabasePlatform()` method has been removed.
diff --git a/psalm.xml.dist b/psalm.xml.dist
index 649070a912c..3900e29a3ae 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -39,10 +39,6 @@
See https://github.com/doctrine/dbal/pull/4317
-->
-
-
diff --git a/src/Connection.php b/src/Connection.php
index 144f6647f8d..553d1b5514c 100644
--- a/src/Connection.php
+++ b/src/Connection.php
@@ -1264,10 +1264,8 @@ public function getNativeConnection()
*/
public function createSchemaManager(): AbstractSchemaManager
{
- return $this->_driver->getSchemaManager(
- $this,
- $this->getDatabasePlatform()
- );
+ return $this->getDatabasePlatform()
+ ->createSchemaManager($this);
}
/**
diff --git a/src/Driver.php b/src/Driver.php
index ea6eb2cccff..b8dca331bde 100644
--- a/src/Driver.php
+++ b/src/Driver.php
@@ -8,7 +8,6 @@
use Doctrine\DBAL\Driver\Connection as DriverConnection;
use Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;
-use Doctrine\DBAL\Schema\AbstractSchemaManager;
/**
* Driver interface.
@@ -35,14 +34,6 @@ public function connect(array $params): DriverConnection;
*/
public function getDatabasePlatform(ServerVersionProvider $versionProvider): AbstractPlatform;
- /**
- * Gets the SchemaManager that can be used to inspect and change the underlying
- * database schema of the platform this driver connects to.
- *
- * @deprecated Use {@link AbstractPlatform::createSchemaManager()} instead.
- */
- public function getSchemaManager(Connection $conn, AbstractPlatform $platform): AbstractSchemaManager;
-
/**
* Gets the ExceptionConverter that can be used to convert driver-level exceptions into DBAL exceptions.
*/
diff --git a/src/Driver/AbstractDB2Driver.php b/src/Driver/AbstractDB2Driver.php
index e0e36762d7a..5ec8c000798 100644
--- a/src/Driver/AbstractDB2Driver.php
+++ b/src/Driver/AbstractDB2Driver.php
@@ -4,16 +4,10 @@
namespace Doctrine\DBAL\Driver;
-use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\API\IBMDB2\ExceptionConverter;
-use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\DB2Platform;
-use Doctrine\DBAL\Schema\DB2SchemaManager;
use Doctrine\DBAL\ServerVersionProvider;
-use Doctrine\Deprecations\Deprecation;
-
-use function assert;
/**
* Abstract base implementation of the {@see Driver} interface for IBM DB2 based drivers.
@@ -25,23 +19,6 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): DB2
return new DB2Platform();
}
- /**
- * @deprecated Use {@link DB2Platform::createSchemaManager()} instead.
- */
- public function getSchemaManager(Connection $conn, AbstractPlatform $platform): DB2SchemaManager
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5458',
- 'AbstractDB2Driver::getSchemaManager() is deprecated.'
- . ' Use DB2Platform::createSchemaManager() instead.'
- );
-
- assert($platform instanceof DB2Platform);
-
- return new DB2SchemaManager($conn, $platform);
- }
-
public function getExceptionConverter(): ExceptionConverter
{
return new ExceptionConverter();
diff --git a/src/Driver/AbstractMySQLDriver.php b/src/Driver/AbstractMySQLDriver.php
index 7ac6593d1c0..d8f24a71426 100644
--- a/src/Driver/AbstractMySQLDriver.php
+++ b/src/Driver/AbstractMySQLDriver.php
@@ -4,21 +4,16 @@
namespace Doctrine\DBAL\Driver;
-use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
-use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\Exception\InvalidPlatformVersion;
use Doctrine\DBAL\Platforms\MariaDBPlatform;
use Doctrine\DBAL\Platforms\MySQL80Platform;
use Doctrine\DBAL\Platforms\MySQLPlatform;
-use Doctrine\DBAL\Schema\MySQLSchemaManager;
use Doctrine\DBAL\ServerVersionProvider;
-use Doctrine\Deprecations\Deprecation;
-use function assert;
use function preg_match;
use function stripos;
use function version_compare;
@@ -81,23 +76,6 @@ private function getOracleMysqlVersionNumber(string $versionString): string
return $majorVersion . '.' . $minorVersion . '.' . $patchVersion;
}
- /**
- * @deprecated Use {@link AbstractMySQLPlatform::createSchemaManager()} instead.
- */
- public function getSchemaManager(Connection $conn, AbstractPlatform $platform): MySQLSchemaManager
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5458',
- 'AbstractMySQLDriver::getSchemaManager() is deprecated.'
- . ' Use MySQLPlatform::createSchemaManager() instead.'
- );
-
- assert($platform instanceof AbstractMySQLPlatform);
-
- return new MySQLSchemaManager($conn, $platform);
- }
-
public function getExceptionConverter(): ExceptionConverter
{
return new ExceptionConverter();
diff --git a/src/Driver/AbstractOracleDriver.php b/src/Driver/AbstractOracleDriver.php
index f4dfe629d50..dc776207b07 100644
--- a/src/Driver/AbstractOracleDriver.php
+++ b/src/Driver/AbstractOracleDriver.php
@@ -4,17 +4,11 @@
namespace Doctrine\DBAL\Driver;
-use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\AbstractOracleDriver\EasyConnectString;
use Doctrine\DBAL\Driver\API\OCI\ExceptionConverter;
-use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
-use Doctrine\DBAL\Schema\OracleSchemaManager;
use Doctrine\DBAL\ServerVersionProvider;
-use Doctrine\Deprecations\Deprecation;
-
-use function assert;
/**
* Abstract base implementation of the {@see Driver} interface for Oracle based drivers.
@@ -26,23 +20,6 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Ora
return new OraclePlatform();
}
- /**
- * @deprecated Use {@link OraclePlatform::createSchemaManager()} instead.
- */
- public function getSchemaManager(Connection $conn, AbstractPlatform $platform): OracleSchemaManager
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5458',
- 'AbstractOracleDriver::getSchemaManager() is deprecated.'
- . ' Use OraclePlatform::createSchemaManager() instead.'
- );
-
- assert($platform instanceof OraclePlatform);
-
- return new OracleSchemaManager($conn, $platform);
- }
-
public function getExceptionConverter(): ExceptionConverter
{
return new ExceptionConverter();
diff --git a/src/Driver/AbstractPostgreSQLDriver.php b/src/Driver/AbstractPostgreSQLDriver.php
index f5c93efc2c0..4b77526a014 100644
--- a/src/Driver/AbstractPostgreSQLDriver.php
+++ b/src/Driver/AbstractPostgreSQLDriver.php
@@ -4,16 +4,10 @@
namespace Doctrine\DBAL\Driver;
-use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter;
-use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
-use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Doctrine\DBAL\ServerVersionProvider;
-use Doctrine\Deprecations\Deprecation;
-
-use function assert;
/**
* Abstract base implementation of the {@see Driver} interface for PostgreSQL based drivers.
@@ -25,23 +19,6 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Pos
return new PostgreSQLPlatform();
}
- /**
- * @deprecated Use {@link PostgreSQLPlatform::createSchemaManager()} instead.
- */
- public function getSchemaManager(Connection $conn, AbstractPlatform $platform): PostgreSQLSchemaManager
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5458',
- 'AbstractPostgreSQLDriver::getSchemaManager() is deprecated.'
- . ' Use PostgreSQLPlatform::createSchemaManager() instead.'
- );
-
- assert($platform instanceof PostgreSQLPlatform);
-
- return new PostgreSQLSchemaManager($conn, $platform);
- }
-
public function getExceptionConverter(): ExceptionConverter
{
return new ExceptionConverter();
diff --git a/src/Driver/AbstractSQLServerDriver.php b/src/Driver/AbstractSQLServerDriver.php
index b09ebe3075d..d4e3dd7f214 100644
--- a/src/Driver/AbstractSQLServerDriver.php
+++ b/src/Driver/AbstractSQLServerDriver.php
@@ -4,16 +4,10 @@
namespace Doctrine\DBAL\Driver;
-use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\API\SQLSrv\ExceptionConverter;
-use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
-use Doctrine\DBAL\Schema\SQLServerSchemaManager;
use Doctrine\DBAL\ServerVersionProvider;
-use Doctrine\Deprecations\Deprecation;
-
-use function assert;
/**
* Abstract base implementation of the {@see Driver} interface for Microsoft SQL Server based drivers.
@@ -25,23 +19,6 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): SQL
return new SQLServerPlatform();
}
- /**
- * @deprecated Use {@link SQLServerPlatform::createSchemaManager()} instead.
- */
- public function getSchemaManager(Connection $conn, AbstractPlatform $platform): SQLServerSchemaManager
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5458',
- 'AbstractSQLServerDriver::getSchemaManager() is deprecated.'
- . ' Use SQLServerPlatform::createSchemaManager() instead.'
- );
-
- assert($platform instanceof SQLServerPlatform);
-
- return new SQLServerSchemaManager($conn, $platform);
- }
-
public function getExceptionConverter(): ExceptionConverter
{
return new ExceptionConverter();
diff --git a/src/Driver/AbstractSQLiteDriver.php b/src/Driver/AbstractSQLiteDriver.php
index c06df5ca0bd..7cad581bbf1 100644
--- a/src/Driver/AbstractSQLiteDriver.php
+++ b/src/Driver/AbstractSQLiteDriver.php
@@ -4,16 +4,10 @@
namespace Doctrine\DBAL\Driver;
-use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\API\SQLite\ExceptionConverter;
-use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
-use Doctrine\DBAL\Schema\SqliteSchemaManager;
use Doctrine\DBAL\ServerVersionProvider;
-use Doctrine\Deprecations\Deprecation;
-
-use function assert;
/**
* Abstract base implementation of the {@see Driver} interface for SQLite based drivers.
@@ -25,23 +19,6 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Sql
return new SqlitePlatform();
}
- /**
- * @deprecated Use {@link SqlitePlatform::createSchemaManager()} instead.
- */
- public function getSchemaManager(Connection $conn, AbstractPlatform $platform): SqliteSchemaManager
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5458',
- 'AbstractSQLiteDriver::getSchemaManager() is deprecated.'
- . ' Use SqlitePlatform::createSchemaManager() instead.'
- );
-
- assert($platform instanceof SqlitePlatform);
-
- return new SqliteSchemaManager($conn, $platform);
- }
-
public function getExceptionConverter(): ExceptionConverter
{
return new ExceptionConverter();
diff --git a/src/Driver/Middleware/AbstractDriverMiddleware.php b/src/Driver/Middleware/AbstractDriverMiddleware.php
index dabc5ffa19f..fb0a277ee3c 100644
--- a/src/Driver/Middleware/AbstractDriverMiddleware.php
+++ b/src/Driver/Middleware/AbstractDriverMiddleware.php
@@ -4,14 +4,11 @@
namespace Doctrine\DBAL\Driver\Middleware;
-use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\API\ExceptionConverter;
use Doctrine\DBAL\Driver\Connection as DriverConnection;
use Doctrine\DBAL\Platforms\AbstractPlatform;
-use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\ServerVersionProvider;
-use Doctrine\Deprecations\Deprecation;
abstract class AbstractDriverMiddleware implements Driver
{
@@ -35,21 +32,6 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Abs
return $this->wrappedDriver->getDatabasePlatform($versionProvider);
}
- /**
- * @deprecated Use {@link AbstractPlatform::createSchemaManager()} instead.
- */
- public function getSchemaManager(Connection $conn, AbstractPlatform $platform): AbstractSchemaManager
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5458',
- 'AbstractDriverMiddleware::getSchemaManager() is deprecated.'
- . ' Use AbstractPlatform::createSchemaManager() instead.'
- );
-
- return $this->wrappedDriver->getSchemaManager($conn, $platform);
- }
-
public function getExceptionConverter(): ExceptionConverter
{
return $this->wrappedDriver->getExceptionConverter();
diff --git a/tests/Driver/AbstractDriverTest.php b/tests/Driver/AbstractDriverTest.php
index 326e0855885..7e5856b7546 100644
--- a/tests/Driver/AbstractDriverTest.php
+++ b/tests/Driver/AbstractDriverTest.php
@@ -13,7 +13,6 @@
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
-use ReflectionProperty;
/**
* @template P of AbstractPlatform
@@ -50,22 +49,6 @@ public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion(
);
}
- public function testReturnsSchemaManager(): void
- {
- $connection = $this->getConnectionMock();
- $schemaManager = $this->driver->getSchemaManager(
- $connection,
- $this->createPlatform()
- );
-
- self::assertEquals($this->createSchemaManager($connection), $schemaManager);
-
- $re = new ReflectionProperty($schemaManager, '_conn');
- $re->setAccessible(true);
-
- self::assertSame($connection, $re->getValue($schemaManager));
- }
-
public function testReturnsExceptionConverter(): void
{
self::assertEquals($this->createExceptionConverter(), $this->driver->getExceptionConverter());