diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index f4d97434ed3..81602852e11 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -360,7 +360,8 @@ static function (ClassMetadata $class) use ($idMapping): bool { $uniqIndex = new Index($indexName, $this->getIndexColumns($class, $indexData), true, false, [], $indexData['options'] ?? []); foreach ($table->getIndexes() as $tableIndexName => $tableIndex) { - if ($tableIndex->isFullfilledBy($uniqIndex)) { + $method = method_exists($tableIndex, 'isFulfilledBy') ? 'isFulfilledBy' : 'isFullfilledBy'; + if ($tableIndex->$method($uniqIndex)) { $table->dropIndex($tableIndexName); break; } @@ -856,8 +857,12 @@ public function dropDatabase() */ public function getDropDatabaseSQL() { + $method = method_exists(AbstractSchemaManager::class, 'introspectSchema') ? + 'introspectSchema' : + 'createSchema'; + return $this->schemaManager - ->createSchema() + ->$method() ->toDropSql($this->platform); } diff --git a/tests/Doctrine/Tests/Models/StockExchange/Stock.php b/tests/Doctrine/Tests/Models/StockExchange/Stock.php index 680aa4c7079..5c01c8a8e83 100644 --- a/tests/Doctrine/Tests/Models/StockExchange/Stock.php +++ b/tests/Doctrine/Tests/Models/StockExchange/Stock.php @@ -34,7 +34,7 @@ class Stock /** * @var float - * @Column(type="decimal") + * @Column(type="decimal", precision=10) */ private $price; diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/CompanySchemaTest.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/CompanySchemaTest.php index 854897bea97..4e23a596492 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/CompanySchemaTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/CompanySchemaTest.php @@ -4,9 +4,12 @@ namespace Doctrine\Tests\ORM\Functional\SchemaTool; +use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\Schema; use Doctrine\Tests\OrmFunctionalTestCase; +use function method_exists; + /** * Functional tests for the Class Table Inheritance mapping strategy. */ @@ -21,7 +24,10 @@ protected function setUp(): void /** @group DDC-966 */ public function testGeneratedSchema(): Schema { - $schema = $this->createSchemaManager()->createSchema(); + $method = method_exists(AbstractSchemaManager::class, 'introspectSchema') ? + 'introspectSchema' : + 'createSchema'; + $schema = $this->createSchemaManager()->$method(); self::assertTrue($schema->hasTable('company_contracts')); diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php index f2d848c039d..42f14669ae6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\SchemaTool; use Doctrine\DBAL\Platforms\SqlitePlatform; +use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\Comparator; use Doctrine\Tests\Models; use Doctrine\Tests\OrmFunctionalTestCase; @@ -67,7 +68,10 @@ public function assertCreatedSchemaNeedsNoUpdates(string ...$classes): void $sm = $this->createSchemaManager(); - $fromSchema = $sm->createSchema(); + $method = method_exists(AbstractSchemaManager::class, 'introspectSchema') ? + 'introspectSchema' : + 'createSchema'; + $fromSchema = $sm->$method(); $toSchema = $this->getSchemaForModels(...$classes); if (method_exists($sm, 'createComparator')) { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php index 0bc14dc3ea6..bbd0b167045 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php @@ -108,7 +108,7 @@ class GH7941Product /** * @var string - * @Column(type="decimal") + * @Column(type="decimal", precision=10) */ public $price; diff --git a/tests/Doctrine/Tests/TestUtil.php b/tests/Doctrine/Tests/TestUtil.php index 75b4d848840..baa3248a947 100644 --- a/tests/Doctrine/Tests/TestUtil.php +++ b/tests/Doctrine/Tests/TestUtil.php @@ -91,7 +91,10 @@ private static function initializeDatabase(): void $platform = $privConn->getDatabasePlatform(); if ($platform instanceof SqlitePlatform) { - $schema = self::createSchemaManager($testConn)->createSchema(); + $method = method_exists(AbstractSchemaManager::class, 'introspectSchema') ? + 'introspectSchema' : + 'createSchema'; + $schema = self::createSchemaManager($testConn)->$method(); $stmts = $schema->toDropSql($testConn->getDatabasePlatform()); foreach ($stmts as $stmt) {