Review main Merged

94871[TASK] Do not rely on Doctrine schema object array keys

Stefan Bürk CR +2 V +2 Easy +33 −2 updated 07/23/26, 12:36

Commit message

`Doctrine\DBAL\Schema\Table` keys columns, indexes and foreign key
constraints by a normalized name of its own - lowercased and with
identifier quotes trimmed. Two places rebuild a `Table` and rely on
those keys to deduplicate the definitions passed to the constructor.

`TableBuilder::addIndex()` merges the new index in using a key built
with `strtolower()` only, while the name originates from
`getQuotedName()`. For a quoted index name the key is `` `myidx` ``
and never matches Doctrine's `myidx`, so re-defining that index does
not replace the previous one and the duplicate is passed on.

`SchemaMigrator::mergeTableDefinitions()` deduplicates foreign keys
through `array_merge()` on the Doctrine keys, while the neighbouring
columns and indexes are already merged explicitly.

Both work today only because the keys happen to line up.
`Table::__construct()` re-derives every key itself, so the passed
keys are discarded anyway and only ever mattered for the merge.

Both places now merge explicitly by the object name, mirroring the
existing `mergeColumns()` and `mergeIndexes()`, which also fixes the
quoted index name case.

Note that Doctrine generates a name for unnamed foreign key
constraints as array key only, never on the constraint itself, so
`getName()` stays empty. Merging those by name would collapse them
into one, therefore they are kept as they are.

No behaviour change for existing definitions, no new Doctrine DBAL
API used.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Wouter Wolters +1
    • Simon Schaufelberger +1
    • Benni Mack +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Simon Schaufelberger +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 78

  1. Stefan Bürk uploaded patch set 1 07/21/26, 20:18

  2. Stefan Bürk wrote 07/21/26, 20:19

    Topic set to doctrine-dbal
  3. core-ci voted on patch set 1 V +1 07/21/26, 20:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105119

  4. Wouter Wolters voted on patch set 1 CR +1 07/22/26, 16:13

  5. Simon Schaufelberger voted on patch set 1 CR +1 V +1 07/22/26, 18:22

  6. Benni Mack voted on patch set 1 CR +1 V +1 07/23/26, 12:19

  7. Stefan Bürk voted on patch set 1 CR +2 V +2 07/23/26, 12:27

  8. Stefan Bürk merged patch set 2 07/23/26, 12:36