Skip to content

Commit

Permalink
Merge pull request #9259 from morozov/dbal-3.2-deprecations
Browse files Browse the repository at this point in the history
Do not use AbstractPlatform::canEmulateSchemas()
  • Loading branch information
morozov authored Dec 17, 2021
2 parents f2e34bd + a41c6d3 commit 25ca8dc
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 18 deletions.
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Upgrade to 3.0

## BC BREAK: Removed support for schema emulation.

The ORM no longer attempts to emulate schemas on SQLite.

## BC BREAK: Remove `Setup::registerAutoloadDirectory()`

Use Composer's autoloader instead.
Expand Down
4 changes: 0 additions & 4 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3668,10 +3668,6 @@ public function getSequencePrefix(AbstractPlatform $platform)
$schemaName = $this->getSchemaName();
if ($schemaName) {
$sequencePrefix = $schemaName . '.' . $tableName;

if (! $platform->supportsSchemas() && $platform->canEmulateSchemas()) {
$sequencePrefix = $schemaName . '__' . $tableName;
}
}

return $sequencePrefix;
Expand Down
7 changes: 1 addition & 6 deletions lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ public function getTableName(ClassMetadata $class, AbstractPlatform $platform)

if (! empty($class->table['schema'])) {
$tableName = $class->table['schema'] . '.' . $class->table['name'];

if (! $platform->supportsSchemas() && $platform->canEmulateSchemas()) {
$tableName = $class->table['schema'] . '__' . $class->table['name'];
}
}

return isset($class->table['quoted'])
Expand Down Expand Up @@ -90,8 +86,7 @@ public function getJoinTableName(array $association, ClassMetadata $class, Abstr
$schema = '';

if (isset($association['joinTable']['schema'])) {
$schema = $association['joinTable']['schema'];
$schema .= ! $platform->supportsSchemas() && $platform->canEmulateSchemas() ? '__' : '.';
$schema = $association['joinTable']['schema'] . '.';
}

$tableName = $association['joinTable']['name'];
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Tools/SchemaTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ static function (ClassMetadata $class) use ($idMapping): bool {
}
}

if (! $this->platform->supportsSchemas() && ! $this->platform->canEmulateSchemas()) {
if (! $this->platform->supportsSchemas()) {
$schema->visit(new RemoveNamespacedAssets());
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2825Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function setUp(): void

$platform = $this->_em->getConnection()->getDatabasePlatform();

if (! $platform->supportsSchemas() && ! $platform->canEmulateSchemas()) {
if (! $platform->supportsSchemas()) {
self::markTestSkipped('This test is only useful for databases that support schemas or can emulate them.');
}
}
Expand Down
7 changes: 1 addition & 6 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/GH7079Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,7 @@ public function testJoinTableName(): void

private function getTableFullName(array $table): string
{
$join = '.';
if (! $this->platform->supportsSchemas() && $this->platform->canEmulateSchemas()) {
$join = '__';
}

return $table['schema'] . $join . $table['name'];
return $table['schema'] . '.' . $table['name'];
}

private function createClassMetadata(string $className): ClassMetadata
Expand Down

0 comments on commit 25ca8dc

Please sign in to comment.