Skip to content

Commit

Permalink
Remove DBAL 2 compat code
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Dec 16, 2021
1 parent 5bbd1d2 commit f2e34bd
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ private function determineIdGeneratorStrategy(AbstractPlatform $platform): int
private function truncateSequenceName(string $schemaElementName): string
{
$platform = $this->getTargetPlatform();
if (! $platform instanceof Platforms\OraclePlatform && ! $platform instanceof Platforms\SQLAnywherePlatform) {
if (! $platform instanceof Platforms\OraclePlatform) {
return $schemaElementName;
}

Expand Down
11 changes: 1 addition & 10 deletions lib/Doctrine/ORM/Tools/SchemaTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

namespace Doctrine\ORM\Tools;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractAsset;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
Expand Down Expand Up @@ -36,7 +34,6 @@
use function in_array;
use function is_array;
use function is_numeric;
use function method_exists;
use function strtolower;

/**
Expand Down Expand Up @@ -927,13 +924,7 @@ public function getUpdateSchemaSql(array $classes, $saveMode = false)
{
$toSchema = $this->getSchemaFromMetadata($classes);
$fromSchema = $this->createSchemaForComparison($toSchema);

if (method_exists($this->schemaManager, 'createComparator')) {
$comparator = $this->schemaManager->createComparator();
} else {
$comparator = new Comparator();
}

$comparator = $this->schemaManager->createComparator();
$schemaDiff = $comparator->compareSchemas($fromSchema, $toSchema);

if ($saveMode) {
Expand Down
6 changes: 0 additions & 6 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@
<file name="lib/Doctrine/ORM/QueryBuilder.php"/>
</errorLevel>
</RedundantCastGivenDocblockType>
<RedundantCondition>
<errorLevel type="suppress">
<!-- The SQLAnywherePlatform class may or may not exist depending on the DBAL version -->
<file name="lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php"/>
</errorLevel>
</RedundantCondition>
<!-- Workaround for https://github.com/vimeo/psalm/issues/7026 -->
<ReservedWord>
<errorLevel type="suppress">
Expand Down
11 changes: 1 addition & 10 deletions tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
namespace Doctrine\Tests\ORM\Functional\SchemaTool;

use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\ORM\Tools;
use Doctrine\Tests\Models;
use Doctrine\Tests\OrmFunctionalTestCase;
use Exception;

use function array_filter;
use function count;
use function implode;
use function method_exists;
use function strpos;

use const PHP_EOL;
Expand Down Expand Up @@ -96,13 +93,7 @@ public function assertCreatedSchemaNeedsNoUpdates($classes): void

$fromSchema = $sm->createSchema();
$toSchema = $this->schemaTool->getSchemaFromMetadata($classMetadata);

if (method_exists($sm, 'createComparator')) {
$comparator = $sm->createComparator();
} else {
$comparator = new Comparator();
}

$comparator = $sm->createComparator();
$schemaDiff = $comparator->compareSchemas($fromSchema, $toSchema);

$sql = $schemaDiff->toSql($this->_em->getConnection()->getDatabasePlatform());
Expand Down

0 comments on commit f2e34bd

Please sign in to comment.