akeneo / data-generator-bundle
v1.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: 2022-02-01 12:35:52 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 中安装任何软件包。
以下是一个简单的 命令行工具示例,该工具通过 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)