Skip to content

oligus/doctrine-fixtures

Repository files navigation

Doctrine fixtures

Simple fixture loader for Doctrine.

Build Status License: MIT Codecov.io Maintainability

Load XML fixtures into database using entity manager.

Quick start

$ composer require oligus/doctrine-fixtures --dev

Load all fixtures in a directory

$fixture = new FixtureManager($em, new XmlLoader('path/to/fixtures'));
$fixture->loadAll();

Load a single fixture file

$fixture = new FixtureManager($em, new XmlLoader());
$fixture->loadFile('path/to/fixtures/data_table.xml');

Availible Loaders

  • Xml Loader
  • Csv Loader

Fixtures

Creating XML fixture from mysql database

$ mysqldump -h localhost -u username --password=password --xml -t database data_table --where="id='1'"