Repository navigation
Reference base platform class in generated platform check - #1595
Open
maks-oleksyuk wants to merge 1 commit into
Open
maks-oleksyuk wants to merge 1 commit into
maks-oleksyuk wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
maks-oleksyuk
force-pushed
the
fix/generator-use-base-platform-class
branch
from
October 5, 2026 06:47
f17d6be to
4c3b61b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SqlGeneratoremits anabortIf()guard into generated migrations using the exact class of the current platform (get_class($this->platform)). With DBAL 4 this is a version-specific subclass, e.g.:These versioned platform classes are deprecated in DBAL (e.g.
MariaDB120300Platformis marked@deprecated To be removed along with the keyword list feature). They only differ from their parents by the reserved keyword list, which DBAL deprecated in doctrine/dbal#6607 and made unnecessary in doctrine/dbal#6589 by always quoting identifiers.As a result, every freshly generated migration hard-codes a deprecated class that will disappear in a future DBAL major version. The guard is also fragile: a migration generated on MariaDB 12.3 refuses to run on any other MariaDB version.
This PR makes the generator walk up to the topmost concrete platform class (
MariaDBPlatform,MySQLPlatform,PostgreSQLPlatform,SQLitePlatform, ...), so the generated guard checks the database vendor only. Reflection is used instead of a hard-coded list so the declared class name casing is preserved (SqlitePlatformon DBAL 3,SQLitePlatformon DBAL 4) and custom platforms keep working.Only the generated code changes. Existing migrations and runtime behaviour are not affected, and
check_database_platform: falsestill disables the guard entirely.A test covering a platform subclass is added; it fails without the change.
🤖 Generated with Claude Code