Repository navigation
feat: add doctrine:fixtures:up to execute pending fixtures - #5
Merged
Merged
Conversation
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.
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.
What
Part 2 of 3 of migration-style fixtures (
status→up→down).doctrine:fixtures:up [--group] [--em]executes only fixtures without a record indoctrine_fixture_versions, in the loader's dependency order, without purging. All fixtures of one run share a batch number.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).EntityManager::getReference()proxies, so a fixture in a later run cangetReference()an object created by an already executed fixture. Only the references a fixture added or changed are stored with it.ensureTable()before any transaction opens (DDL commits implicitly on MySQL).ProductionGuardPassnow hidesdoctrine:fixtures:upas well;doctrine:fixtures:statusstays available.AbstractExecutoris@internal).Verification
composer qapasses 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 withoutup.