DBAL deprecation: AbstractPlatform::usesSequenceEmulatedIdentityColumns is deprecated #7162

Closed
opened 2026-01-22 15:45:49 +01:00 by admin · 8 comments
Owner

Originally created by @dmaicher on GitHub (Jun 2, 2023).

I noticed the following deprecation report on my projects:

Doctrine\DBAL\Platforms\AbstractPlatform::usesSequenceEmulatedIdentityColumns is deprecated. (AbstractPlatform.php:3945 called by ClassMetadataFactory.php:622, https://github.com/doctrine/dbal/pull/5513, package doctrine/dbal)

This is caused by b52a8f8b9e/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php (L622)

Is there a way to avoid this deprecation inside ClassMetadataFactory?

Originally created by @dmaicher on GitHub (Jun 2, 2023). I noticed the following deprecation report on my projects: > Doctrine\DBAL\Platforms\AbstractPlatform::usesSequenceEmulatedIdentityColumns is deprecated. (AbstractPlatform.php:3945 called by ClassMetadataFactory.php:622, https://github.com/doctrine/dbal/pull/5513, package doctrine/dbal) This is caused by https://github.com/doctrine/orm/blob/b52a8f8b9e682a0bb5fa381d0cf8aaeb9c4445bf/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L622 Is there a way to avoid this deprecation inside `ClassMetadataFactory`?
admin closed this issue 2026-01-22 15:45:49 +01:00
Author
Owner

@greg0ire commented on GitHub (Jun 2, 2023):

Cc @ruudk

@greg0ire commented on GitHub (Jun 2, 2023): Cc @ruudk
Author
Owner

@greg0ire commented on GitHub (Jun 2, 2023):

The only way I can think of is making the behavior configurable. Either we continue checking, or we don't based on some boolean defined in the ORM config.

@greg0ire commented on GitHub (Jun 2, 2023): The only way I can think of is making the behavior configurable. Either we continue checking, or we don't based on some boolean defined in the ORM config.
Author
Owner

@stof commented on GitHub (Jun 2, 2023):

This check is necessary to avoid breaking BC in the ORM (see that when this method returns true, we reach a deprecated path).

What we need is to find a way to detect the cases non-deprecated case in a non-deprecated way, to avoid reporting a deprecation in that case.

@stof commented on GitHub (Jun 2, 2023): This check is necessary to avoid breaking BC in the ORM (see that when this method returns `true`, we reach a deprecated path). What we need is to find a way to detect the cases non-deprecated case in a non-deprecated way, to avoid reporting a deprecation in that case.
Author
Owner

@greg0ire commented on GitHub (Jun 2, 2023):

Do you mean reimplementing this with instanceof checks? That does not sound too great 🤔 It would be cool if we could ignore that deprecation, but just once (or rather as many times as going on that codepath). But I don't think doctrine/deprecations allows that. Right now, only end users are supposed to call Deprecation::ignore* I think.

@greg0ire commented on GitHub (Jun 2, 2023): Do you mean reimplementing this with `instanceof` checks? That does not sound too great :thinking: It would be cool if we could ignore that deprecation, but just once (or rather as many times as going on that codepath). But I don't think `doctrine/deprecations` allows that. Right now, only end users are supposed to call `Deprecation::ignore*` I think.
Author
Owner

@itinance commented on GitHub (Nov 29, 2023):

For what I found in the official documentation, the recommended way of generating Primary Keys with auto-generated values in PostgreSQL is

 integer primary key generated always as identity

See: https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_serial
So no SERIAL, no SEQUENCEs, instead IDENTITY.

The strategy IDENTITY is neither providing this syntax nor usable thanks to deprecated-messages.

Is there anything available that we don't need to patch Migration-Files manually?

@itinance commented on GitHub (Nov 29, 2023): For what I found in the official documentation, the recommended way of generating Primary Keys with auto-generated values in PostgreSQL is ``` integer primary key generated always as identity ``` See: https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_serial So no SERIAL, no SEQUENCEs, instead IDENTITY. The strategy IDENTITY is neither providing this syntax nor usable thanks to deprecated-messages. Is there anything available that we don't need to patch Migration-Files manually?
Author
Owner

@stof commented on GitHub (Nov 29, 2023):

What we would need for PostgreSQL is updating the PostgreSQLPlatform to use the new way of creating identity columns for PostgreSQL 10+

@stof commented on GitHub (Nov 29, 2023): What we would need for PostgreSQL is updating the PostgreSQLPlatform to use the new way of creating identity columns for PostgreSQL 10+
Author
Owner

@greg0ire commented on GitHub (Nov 29, 2023):

@itinance I'm afraid you'll be stuck until doctrine/dbal 4 is available.

@greg0ire commented on GitHub (Nov 29, 2023): @itinance I'm afraid you'll be stuck until `doctrine/dbal` 4 is available.
Author
Owner

@dmaicher commented on GitHub (Jan 10, 2025):

Closing this as it seems not relevant anymore with DBAL 4

@dmaicher commented on GitHub (Jan 10, 2025): Closing this as it seems not relevant anymore with DBAL 4
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7162