springbokagency/faker-xpdo-orm-adapter
Composer 安装命令:
composer require springbokagency/faker-xpdo-orm-adapter
包简介
A Faker ORM adapter to populate xPDO objects with fake data
README 文档
README
A Faker ORM adapter to populate xPDO objects with fake data.
Table of contents
Installation
Install as development dependency using Composer.
$ composer require --dev springbokagency/faker-xpdo-orm-adapter
Usage
To populate xPDO objects, create a new populator class (using a generator instance as first parameter, and a valid xPDO instance as second parameter), then list the class and number of all the objects that must be generated. To launch the actual data population, call the execute() method.
Here is an example showing how to populate 5 modUser and 10 modResource objects:
<?php $generator = \Faker\Factory::create(); $populator = new \SpringbokAgency\Faker\ORM\xPDO\Populator($generator, $xpdo); $populator->addEntity(\MODX\Revolution\modUser::class, 5); $populator->addEntity(\MODX\Revolution\modResource::class, 10); $insertedPKs = $populator->execute();
For more info read the Faker documentation.
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-29