akeneo-labs / data-generator-bundle
Akeneo PIM 扩展包,用于生成数据以测试高量级操作
1.5.0
2016-03-16 13:38 UTC
Requires
- php: >=5.4.4
- akeneo/pim-community-dev: ~1.5.0
- box/spout: ^2.4
- doctrine/migrations: 1.0.*@dev
- fzaninotto/faker: 1.4.0
Requires (Dev)
- phpspec/phpspec: ~2.1
Suggests
- doctrine/mongodb-odm: 1.0.0-beta10@dev
- doctrine/mongodb-odm-bundle: v3.0.0-BETA6@dev
This package is not auto-updated.
Last update: 2024-09-09 05:51:28 UTC
README
此扩展包以 Akeneo CSV 格式生成文件数据。
它能够生成产品信息和属性信息(包括系列和属性选项)。
因此,您需要已经设置了渠道、区域和货币的 PIM 系统。
基于此,此扩展包将生成有效的产品和属性数据。
兼容性
此扩展包与 Akeneo PIM 1.3、1.4、1.5 和 1.6 兼容。
由于 Akeneo PIM 1.7 暴露了 Web API,可以通过 Web API 注入数据,而无需在此安装扩展包。
以下是一个简单的 命令行工具示例,该工具通过 Web API 生成并注入数据。
安装
$ composer.phar require akeneo-labs/data-generator-bundle ~0.3
更新您的 app/AppKernel.php
如下
$bundles[] = new Pim\Bundle\DataGeneratorBundle\PimDataGeneratorBundle();
如何使用
目录生成分为两个阶段
- 生成目录固定数据
- 生成产品 CSV 导入文件
Usage: pim:generate:fixtures <configuration_file_path> pim:generate:products-file <configuration_file_path> Arguments: configuration-file YAML configuration file
配置文件示例
生成基本固定数据
data_generator: output_dir: /tmp/fixtures/ entities: attributes: count: 200 identifier_attribute: "sku" families: count: 30 attributes_count: 60 identifier_attribute: "sku" label_attribute: "label"
生成产品
data_generator: output_dir: /tmp/ entities: products: count: 1000 filled_attributes_count: 50 filled_attributes_standard_deviation: 10 mandatory_attributes: [sku, name] # properties that will always be filled in with a random value delimiter: , force_values: { manufacturer: 'FactoryInc', brand: 'SuperProd' } # properties that if they are filled in, will be filled in the given value start_index: 0 categories_count: 10
更多配置示例可在 Resources\examples
目录中找到。
警告
产品数据不能与基本固定数据(系列、类别、属性等)同时生成。实际上,为了生成产品数据,我们使用 PIM 中的对象(系列、属性等)。
因此,如果您需要生成完整目录,您需要
- 生成固定数据
- 将最小数据集固定数据复制到新的固定数据集中
- 将生成的固定数据复制到这个新集中
- 通过更改
installer_data
配置安装新的固定数据集 - 生成产品数据
如何使用生成的属性和系列数据
生成的文件旨在用于固定数据。只有生成的产品 CSV 文件必须由导入配置文件导入。
兼容性
此版本仅与最新构建的 Akeneo PIM 兼容。
致谢
感谢 @fzaninotto 的 Faker ! (https://github.com/fzaninotto/Faker)