Skip to content

feat: add doctrine:fixtures:up to execute pending fixtures - #5

Merged
brianvarskonst merged 3 commits into
mainfrom
feat/fixtures-up
Nov 15, 2026
Merged

brianvarskonst merged 3 commits into
mainfrom
feat/fixtures-up

Conversation

@brianvarskonst

Copy link
Copy Markdown
Member

What

Part 2 of 3 of migration-style fixtures (status → up → down).

  • doctrine:fixtures:up [--group] [--em] executes only fixtures without a record in doctrine_fixture_versions, in the loader's dependency order, without purging. All fixtures of one run share a batch number.
  • One transaction per fixture: the upstream ORMExecutor::execute([$fixture], append: true) nests inside a transaction that also writes the version record. A failure rolls back that fixture and leaves it pending; earlier fixtures of the run stay executed (like migrations).
  • References set by earlier batches are restored as lazy EntityManager::getReference() proxies, so a fixture in a later run can getReference() an object created by an already executed fixture. Only the references a fixture added or changed are stored with it.
  • The tracking table is now created by ensureTable() before any transaction opens (DDL commits implicitly on MySQL).
  • ProductionGuardPass now hides doctrine:fixtures:up as well; doctrine:fixtures:status stays available.
  • Only public data-fixtures API is used (AbstractExecutor is @internal).

Verification

composer qa passes locally on PHP 8.5 (12 tests, 98 assertions): single batch and idempotent second run, WordPress table untouched, references across batches, rollback of a failing fixture (row and record), production container without up.

DDL commits implicitly on MySQL, so the table must exist before a fixture
transaction opens instead of being created inside record().
Runs only fixtures without a version record, in dependency order and
without purging. Each fixture and its record share one transaction, so a
failure leaves it pending. References set by earlier batches are restored
as lazy proxies, so later fixtures can use getReference() across runs.
The command is hidden in production like doctrine:fixtures:load.
@brianvarskonst
brianvarskonst merged commit 5378e63 into main Nov 15, 2026
3 checks passed
@brianvarskonst
brianvarskonst deleted the feat/fixtures-up branch November 15, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant