-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Feature Request
What
We would like the interfaces Doctrine\DBAL\Types\PhpDateMappingType
and Doctrine\DBAL\Types\PhpTimeMappingType
to be made part of the public API (i.e., remove the @internal annotation), or alternatively, have a documented and supported way to determine whether a DBAL type maps to a date/time-related column type in SQL (e.g., DATE, DATETIME, TIMESTAMP, TIME, etc.).
Just for context: the interfaces were originally introduced in PR #6161 as part of internal improvements to date/time handling.
Why
In our application — and in upstream libraries like API Platform — we implement filters based on the underlying SQL column types. Specifically, we need to detect when a database column represents a date or time value, so we can apply the appropriate filtering logic (e.g., range queries, date-only comparisons, etc.).
The internal interfaces PhpDateMappingType
and PhpTimeMappingType
already group the types that map to temporal SQL types, and would be ideal for this purpose. However, since they are marked @internal, we cannot safely use them without risking breakage in future releases.
Making them public would provide a stable and semantically clear way to determine if a type is date/time-related.
How
One option would be to simply remove the @internal PHPDoc annotation from the PhpDateMappingType
and PhpTimeMappingType
interfaces, and treat them as stable public API contracts going forward.
Alternatively, Doctrine could expose a public mechanism (e.g. a method or utility interface) to detect whether a given DBAL type maps to a temporal SQL type.