Skip to content

Commit 55b061e

Browse files
Don't call deprecated usesSequenceEmulatedIdentityColumns in ClassMetadataFactory
1 parent de7c215 commit 55b061e

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
use Doctrine\Common\EventManager;
88
use Doctrine\DBAL\Platforms;
99
use Doctrine\DBAL\Platforms\AbstractPlatform;
10+
use Doctrine\DBAL\Platforms\MySQLPlatform;
11+
use Doctrine\DBAL\Platforms\MySqlPlatform as LegacyMySqlPlatform;
12+
use Doctrine\DBAL\Platforms\SqlitePlatform;
13+
use Doctrine\DBAL\Platforms\SQLServerPlatform;
1014
use Doctrine\Deprecations\Deprecation;
1115
use Doctrine\ORM\EntityManagerInterface;
1216
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
@@ -621,9 +625,11 @@ private function completeIdGeneratorMapping(ClassMetadataInfo $class): void
621625
case ClassMetadata::GENERATOR_TYPE_IDENTITY:
622626
$sequenceName = null;
623627
$fieldName = $class->identifier ? $class->getSingleIdentifierFieldName() : null;
628+
$platform = $this->getTargetPlatform();
624629

625630
// Platforms that do not have native IDENTITY support need a sequence to emulate this behaviour.
626-
if ($this->getTargetPlatform()->usesSequenceEmulatedIdentityColumns()) {
631+
/** @psalm-suppress UndefinedClass, InvalidClass */
632+
if (! $platform instanceof SqlitePlatform && ! $platform instanceof MySQLPlatform && ! $platform instanceof LegacyMySqlPlatform && ! $platform instanceof SQLServerPlatform && $platform->usesSequenceEmulatedIdentityColumns()) {
627633
Deprecation::trigger(
628634
'doctrine/orm',
629635
'https://github.com/doctrine/orm/issues/8850',

phpstan-dbal2.neon

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ parameters:
1313
-
1414
message: '/Doctrine\\DBAL\\Platforms\\MyS(ql|QL)Platform/'
1515
path: lib/Doctrine/ORM/Internal/SQLResultCasing.php
16+
-
17+
message: '/Doctrine\\DBAL\\Platforms\\MyS(ql|QL)Platform/'
18+
path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
1619

1720
# Forward compatibility for DBAL 3.5
1821
- '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getAlterSchemaSQL\(\).$/'

phpstan-persistence2.neon

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ parameters:
1717
-
1818
message: '/Doctrine\\DBAL\\Platforms\\MyS(ql|QL)Platform/'
1919
path: lib/Doctrine/ORM/Internal/SQLResultCasing.php
20-
20+
-
21+
message: '/Doctrine\\DBAL\\Platforms\\MyS(ql|QL)Platform/'
22+
path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
2123
-
2224
message: '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getSQLResultCasing\(\)\.$/'
2325
path: lib/Doctrine/ORM/Internal/SQLResultCasing.php

phpstan.neon

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ parameters:
1717
-
1818
message: '/Doctrine\\DBAL\\Platforms\\MyS(ql|QL)Platform/'
1919
path: lib/Doctrine/ORM/Internal/SQLResultCasing.php
20-
20+
-
21+
message: '/Doctrine\\DBAL\\Platforms\\MyS(ql|QL)Platform/'
22+
path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
2123
-
2224
message: '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getSQLResultCasing\(\)\.$/'
2325
path: lib/Doctrine/ORM/Internal/SQLResultCasing.php

0 commit comments

Comments
 (0)