oligus/doctrine-fixtures

Doctrine fixtures

0.1.5 2019-12-14 22:21 UTC

This package is auto-updated.

Last update: 2024-09-15 09:00:48 UTC


README

Doctrine 简单 fixture 加载器。

Build Status License: MIT Codecov.io Maintainability

使用实体管理器将 XML fixture 加载到数据库中。

快速开始

$ composer require oligus/doctrine-fixtures --dev

加载目录中的所有 fixtures

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

加载单个 fixture 文件

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

可用的加载器

  • Xml 加载器
  • Csv 加载器

Fixtures

从 mysql 数据库创建 XML fixture

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