Download the PHP package sympress/doctrine-fixtures-bundle without Composer
On this page you can find all versions of the php package sympress/doctrine-fixtures-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sympress/doctrine-fixtures-bundle
More information about sympress/doctrine-fixtures-bundle
Files in sympress/doctrine-fixtures-bundle
Package doctrine-fixtures-bundle
Short Description Native Doctrine data fixtures integration for SymPress, built on the original DoctrineFixturesBundle.
License GPL-2.0-or-later
Informations about the package doctrine-fixtures-bundle
SymPress Doctrine Fixtures Bundle
Doctrine data fixtures for the SymPress ecosystem. Uses the original
DoctrineFixturesBundle
on top of sympress/doctrine-bundle.
Requires PHP 8.5 and sympress/doctrine-bundle >= 1.0.7.
Installation
Install it as a development dependency in the consuming application's root:
The SymPress kernel discovers the bundle through extra.kernel and registers the
Doctrine bundle it requires. Symfony Flex is not required.
Writing fixtures
Fixtures are plain upstream fixtures. Extend Doctrine\Bundle\FixturesBundle\Fixture
(or implement ORMFixtureInterface) and register the classes as autoconfigured
services in your kernel-loaded config:
References, DependentFixtureInterface, FixtureGroupInterface and custom purger
factories work exactly as documented upstream.
Loading fixtures
Run the native command through the SymPress kernel console (WP-CLI bridge):
Without --append the command purges every table mapped by Doctrine before
loading. Tables that Doctrine does not map, such as WordPress core and plugin
tables, are not touched. Tables with the WordPress table prefix are never purged
either, even when an entity maps them (quoted or not); outside WordPress, set
DB_TABLE_PREFIX. Use --purge-exclusions to keep individual mapped tables.
Migration-style fixtures: up, down and status
Next to the upstream load (purge and reload everything), the bundle tracks
executed fixtures in doctrine_fixture_versions, like Doctrine Migrations
tracks migrations:
upruns only fixtures that were not executed yet, in dependency order. All fixtures of one run form a batch. Each fixture runs in its own transaction together with its record, so a failure leaves it pending.- References from earlier batches are restored, so a new fixture can use
getReference()on objects created by an already executed fixture. downreverts the last batch, the given fixtures or--all. Executed fixtures that depend on a reverted fixture are reverted first. It asks for confirmation;--no-interactionproceeds likedoctrine:migrations:migrate -n.- All commands accept
--groupand--em.down --groupreverts the group's own fixtures (and their dependents), never the fixtures they depend on.
A fixture becomes revertible by implementing RevertibleFixtureInterface:
down refuses to run, and reverts nothing, if the plan contains a fixture
without down() or one whose class no longer exists. The tracking table is
created on first use and hidden from schema diffs on every connection, so
doctrine:migrations:diff never proposes dropping it. load does not use the
tracking table; use down --all followed by up for a migration-style rebuild.
Production safety
doctrine:fixtures:load, up and down are not registered when the kernel
environment is prod or production; status stays available. Keep the
package in require-dev so production builds (composer install --no-dev) do
not install it at all.
Development
The suite boots the real SymPress kernel and runs the native command against SQLite.
License: GPL-2.0-or-later. Upstream dependencies retain their original licenses.
All versions of doctrine-fixtures-bundle with dependencies
doctrine/data-fixtures Version ^2.2
doctrine/dbal Version ^4.5
doctrine/doctrine-fixtures-bundle Version ^4.3.1
sympress/doctrine-bundle Version ^1.0.7
sympress/kernel Version ^1.1.14