oligus / doctrine-fixtures
Doctrine fixtures
0.1.5
2019-12-14 22:21 UTC
Requires
- php: >=7.3
- ext-dom: *
- ext-json: *
- ext-libxml: *
- ext-simplexml: *
Requires (Dev)
- ext-json: *
- doctrine/orm: ^2.6
- phan/phan: ^2.4
- phpmd/phpmd: ^2.7
- phpunit/phpunit: ^8.3
- spatie/phpunit-snapshot-assertions: ^2.1
- squizlabs/php_codesniffer: ^3.4
- symfony/var-dumper: ^4.3
README
Doctrine 简单 fixture 加载器。
使用实体管理器将 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'"