Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for DBAL 3 #11216

Merged
merged 1 commit into from
May 22, 2024
Merged

Drop support for DBAL 3 #11216

merged 1 commit into from
May 22, 2024

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Feb 4, 2024

This PR removes all compatibility code for DBAL 3. I'm flagging it as a draft for now because I believe that we can backport a few things.

@derrabus derrabus added this to the 4.0.0 milestone Feb 4, 2024
@derrabus derrabus force-pushed the drop/dbal-3 branch 3 times, most recently from e43754c to c376858 Compare February 7, 2024 14:44
@derrabus derrabus force-pushed the drop/dbal-3 branch 3 times, most recently from 5aa8a32 to ebc7951 Compare February 22, 2024 13:00
@greg0ire
Copy link
Member

There is code here that could be simplified I think:

// DBAL 3
if (method_exists($platform, 'getIdentitySequenceName')) {
$nonIdentityDefaultStrategy[Platforms\PostgreSQLPlatform::class] = ClassMetadata::GENERATOR_TYPE_SEQUENCE;
}
foreach ($nonIdentityDefaultStrategy as $platformFamily => $strategy) {
if (is_a($platform, $platformFamily)) {
if ($platform instanceof Platforms\PostgreSQLPlatform) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/8893',
<<<'DEPRECATION'
Relying on non-optimal defaults for ID generation is deprecated, and IDENTITY
results in SERIAL, which is not recommended.
Instead, configure identifier generation strategies explicitly through
configuration.
We currently recommend "SEQUENCE" for "%s", when using DBAL 3,
and "IDENTITY" when using DBAL 4,
so you should use probably use the following configuration before upgrading to DBAL 4,
and remove it after deploying that upgrade:
$configuration->setIdentityGenerationPreferences([
"%s" => ClassMetadata::GENERATOR_TYPE_SEQUENCE,
]);
DEPRECATION,
$platformFamily,
$platformFamily,
);
}
return $strategy;
}
}

src/Query.php Outdated Show resolved Hide resolved
src/UnitOfWork.php Outdated Show resolved Hide resolved
@derrabus derrabus force-pushed the drop/dbal-3 branch 2 times, most recently from ab01f75 to 0fea130 Compare May 21, 2024 12:26
@derrabus derrabus marked this pull request as ready for review May 22, 2024 08:50
@derrabus
Copy link
Member Author

PR is ready.

@derrabus derrabus requested a review from greg0ire May 22, 2024 08:50
@greg0ire
Copy link
Member

Doing a case insensitive search for dbal 3, this comes up:

public function testPostgresSticksWithSequencesWhenDbal3IsUsed(): void
{
if (! method_exists(AbstractPlatform::class, 'getIdentitySequenceName')) {
self::markTestSkipped('This test requires DBAL 3');
}
$cm = $this->createValidClassMetadata();
$cm->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
$cmf = $this->setUpCmfForPlatform(new PostgreSQLPlatform());
$cmf->setMetadataForClass($cm->name, $cm);
$metadata = $cmf->getMetadataFor($cm->name);
self::assertSame(ClassMetadata::GENERATOR_TYPE_SEQUENCE, $metadata->generatorType);
}

@derrabus
Copy link
Member Author

I must've missed that one. I'll remove the test.

@derrabus derrabus merged commit d973867 into doctrine:4.0.x May 22, 2024
40 checks passed
@derrabus derrabus deleted the drop/dbal-3 branch May 22, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants