Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Migrate configureSchema() to DBAL's editor API#64389

Merged
nicolas-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
May 28, 2026
Merged

Migrate configureSchema() to DBAL's editor API#64389
nicolas-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

@nicolas-grekas
Copy link
Copy Markdown
Member

Q A
Branch? 7.4
Bug fix? no
New feature? no
Deprecations? no
Issues Follow-up of #64351
License MIT

#64351 silenced the deprecations introduced by doctrine/dbal#7373 (Schema::createTable(), dropTable(), createSequence(), dropSequence()) because the replacement API (Schema::edit() + SchemaEditor) returns a new Schema instance instead of mutating in place, which didn't fit our configureSchema(Schema $schema) callbacks nor Doctrine ORM's postGenerateSchema event (where $schema was 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() on PdoSessionHandler, DoctrineDbalAdapter, DoctrineDbalStore, the Messenger Connection/DoctrineTransport, and DoctrineTokenProvider now returns the (possibly new) Schema. Implementations route through Schema::edit() + SchemaEditor::addTable() when DBAL 4.5+ is available, and fall back to the legacy mutating Schema::createTable() path otherwise.
  • Schema listeners forward the returned schema via 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() and filterSchemaChanges() (only @return Schema in the docblock). Subclasses that override with : void keep working, and caller sites use ?? $schema to 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 into addColumn()'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's SchemaTool::createSchema(), which still calls Schema::createTable() internally (lines 207 and 650 of SchemaTool.php in ORM 3.6). Lifting these requires a follow-up on the ORM side.

@carsonbot carsonbot added this to the 7.4 milestone May 28, 2026
@carsonbot carsonbot changed the title Migrate configureSchema() to DBAL's editor API Migrate configureSchema() to DBAL's editor API May 28, 2026
@nicolas-grekas nicolas-grekas force-pushed the doctrine-schema-editor branch from 3aab1bd to 2f33a56 Compare May 28, 2026 14:40
@nicolas-grekas nicolas-grekas force-pushed the doctrine-schema-editor branch from 2f33a56 to 222bf2f Compare May 28, 2026 15:11
@nicolas-grekas nicolas-grekas merged commit 2e6b45a into symfony:7.4 May 28, 2026
11 of 14 checks passed
@nicolas-grekas nicolas-grekas deleted the doctrine-schema-editor branch May 28, 2026 15:23
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
@fabpot fabpot mentioned this pull request May 29, 2026
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.