Migrate configureSchema() to DBAL's editor API#64389
Merged
nicolas-grekas merged 1 commit intoMay 28, 2026
symfony:7.4symfony/symfony:7.4from
nicolas-grekas:doctrine-schema-editornicolas-grekas/symfony:doctrine-schema-editorCopy head branch name to clipboard
Merged
Migrate configureSchema() to DBAL's editor API#64389nicolas-grekas merged 1 commit intosymfony:7.4symfony/symfony:7.4from nicolas-grekas:doctrine-schema-editornicolas-grekas/symfony:doctrine-schema-editorCopy head branch name to clipboard
configureSchema() to DBAL's editor API#64389nicolas-grekas merged 1 commit into
symfony:7.4symfony/symfony:7.4from
nicolas-grekas:doctrine-schema-editornicolas-grekas/symfony:doctrine-schema-editorCopy head branch name to clipboard
Conversation
configureSchema() to DBAL's editor APIconfigureSchema() to DBAL's editor API
3aab1bd to
2f33a56
Compare
2f33a56 to
222bf2f
Compare
nicolas-grekas
added a commit
that referenced
this pull request
May 28, 2026
Apply the `: Schema` return type on the 7 methods that #64389 deferred via `.github/expected-missing-return-types.diff` (file is dropped on 8.0 since 8.0 enforces return types globally). With return types enforced, the `?? $schema` defensive fallbacks added in 7.4 for subclasses overriding with `: void` are dead code under PHP's LSP check, so drop them too. Also restore the options-array form of `Connection::configureSchemaTable()` and drop the leftover `#[IgnoreDeprecations]` / `#[Group]` attributes in `MessengerTransportDoctrineSchemaListenerTest` (no matching imports): both were collateral from the 7.4-into-8.0 merge resolution.
nicolas-grekas
added a commit
that referenced
this pull request
May 28, 2026
* 8.0: Fix post-merge cleanups for #64389 [Yaml] Replace @dataProvider annotation with #[DataProvider] attribute in InlineTest Migrate `configureSchema()` to DBAL's editor API [Yaml] Fix parsing inline anchored values [Dotenv] Don't truncate external env vars containing $ when referenced via ${...} indirection Remove usage of Kernel::VERSION [Translation] Fix XLIFF 2 catalog metadata Bump Symfony version to 8.0.14 Update VERSION for 8.0.13 Update CHANGELOG for 8.0.13 Bump Symfony version to 7.4.14 Update VERSION for 7.4.13 Update CHANGELOG for 7.4.13 Bump Symfony version to 6.4.42 Update VERSION for 6.4.41 Update CONTRIBUTORS for 6.4.41 Update CHANGELOG for 6.4.41 [ObjectMapper] Fix TargetClass generic in ConditionCallableInterface # Conflicts: # src/Symfony/Bridge/Doctrine/SchemaListener/AbstractSchemaListener.php # src/Symfony/Bundle/FrameworkBundle/Console/Application.php # src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php # src/Symfony/Component/HttpKernel/Kernel.php # src/Symfony/Component/ObjectMapper/Condition/TargetClass.php # src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
nicolas-grekas
added a commit
that referenced
this pull request
May 28, 2026
* 8.1: Fix post-merge cleanups for #64389 [Yaml] Replace @dataProvider annotation with #[DataProvider] attribute in InlineTest Migrate `configureSchema()` to DBAL's editor API [Yaml] Fix parsing inline anchored values [Dotenv] Don't truncate external env vars containing $ when referenced via ${...} indirection Remove usage of Kernel::VERSION [Translation] Fix XLIFF 2 catalog metadata Bump Symfony version to 8.0.14 Update VERSION for 8.0.13 Update CHANGELOG for 8.0.13 Bump Symfony version to 7.4.14 Update VERSION for 7.4.13 Update CHANGELOG for 7.4.13 Bump Symfony version to 6.4.42 Update VERSION for 6.4.41 Update CONTRIBUTORS for 6.4.41 Update CHANGELOG for 6.4.41 [ObjectMapper] Fix TargetClass generic in ConditionCallableInterface
Merged
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.
#64351 silenced the deprecations introduced by doctrine/dbal#7373 (
Schema::createTable(),dropTable(),createSequence(),dropSequence()) because the replacement API (Schema::edit()+SchemaEditor) returns a newSchemainstance instead of mutating in place, which didn't fit ourconfigureSchema(Schema $schema)callbacks nor Doctrine ORM'spostGenerateSchemaevent (where$schemawas effectively read-only).doctrine/orm#12483 unblocked the ORM side by adding
GenerateSchemaEventArgs::setSchema()(ORM 3.6+). This PR completes the picture on the Symfony side:configureSchema()onPdoSessionHandler,DoctrineDbalAdapter,DoctrineDbalStore, the MessengerConnection/DoctrineTransport, andDoctrineTokenProvidernow returns the (possibly new)Schema. Implementations route throughSchema::edit()+SchemaEditor::addTable()when DBAL 4.5+ is available, and fall back to the legacy mutatingSchema::createTable()path otherwise.GenerateSchemaEventArgs::setSchema()when ORM 3.6+ is installed, otherwise mutate the original schema in place (legacy behavior).AbstractSchemaListener::filterSchemaChanges()returns the filtered schema and uses the editor API to drop filtered tables/sequences when available.To minimize the BC impact, no PHP return type is declared on
configureSchema()andfilterSchemaChanges()(only@return Schemain the docblock). Subclasses that override with: voidkeep working, and caller sites use?? $schemato fall back to the original (potentially mutated) schema when a legacy override returns nothing.While at it, the column setter chains (
->setLength()->setNotnull()->setAutoincrement()->setUnsigned()) are folded intoaddColumn()'s options array. This dodges doctrine/dbal#7381 (column setter deprecations) the same way: constructor-internal calls don't trigger the deprecation, so passing the options at construction time keeps the code clean for both DBAL <4.5 and 4.5+.Most
#[IgnoreDeprecations]/#[Group('doctrine-dbal-workaround')]tags introduced in #64351 (plus the follow-up Messenger PostgreSQL ones) are removed. Four tags remain on tests that exercise ORM'sSchemaTool::createSchema(), which still callsSchema::createTable()internally (lines 207 and 650 ofSchemaTool.phpin ORM 3.6). Lifting these requires a follow-up on the ORM side.