2017 © Pedro PelĂĄez
 

rbschange-module faker

Use Faker library to populate your RBSChange 4 database with fake data

image

heri/faker

Use Faker library to populate your RBSChange 4 database with fake data

  • Tuesday, March 11, 2014
  • by heristop
  • Repository
  • 1 Watchers
  • 3 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Faker for RBSChange 4

Have a RBSChange 4 project and need to fill your database for tests?, (*1)

This module provides a command to load random data for any documents like media, products or orders for instance. It integrates Faker, a PHP library that generates fake data., (*2)

Installation

Add the requirement to your composer.json file:, (*3)

``` json { "require": { "heri/faker": "dev-master" } }, (*4)


Then, install the module in the modules manager. ## Usage How it's works? Specify entities to load, and the number of documents you want to create, in your configuration file `project.json`: ``` json { "Heri":{ "Faker":{ "entities":{ "Rbs_Media_Image":{ "number": 5 }, "Rbs_Brand_Brand":{ "number": 5 }, "Rbs_Stock_Sku":{ "number": 5 }, "Rbs_Catalog_Product":{ "number": 5 } } } } }

Lastly, run this command:, (*5)

``` sh php bin/change.phar faker:populate, (*6)


In the previous example, the `Image` and `Brand` models share a relationship. If `Image` documents are populated first, Faker is smart enough to relate the populated Brand documents to one of the populated `Image` documents. ## ProTips Configuration You can add your own formatter for each column of each entity, with or without arguments: ``` json { "Rbs_Media_Image":{ "number": 10, "custom_formatters":{ "path":{ "method": "storeImage", "parameters":{ "width": "320", "height": "240", "category": "cats" } } } } }

With the example above, we choose to generate images of cats:, (*7)

ScreenShot, (*8)

You can use all formatters provided by Faker:, (*9)

``` json { "Rbs_Stock_Sku":{ "custom_formatters":{ "ean13":{ "method": "randomElement", "parameters":{ "values": [ "1234567891234", "1234567891235", "1234567891236" ] } } } } }, (*10)


You can also set `null` to a column value in order to get the default value generated by the orm: ``` json { "Rbs_Brand_Brand":{ "custom_formatters":{ "title": null } } }

License

This module is released under the MIT license. See the complete license in the module:, (*11)

[Resources/meta/LICENSE](https://raw.github.com/heristop/RbsModuleFaker/master/Resources/meta/LICENSE)

The Versions

11/03 2014

dev-master

9999999-dev

Use Faker library to populate your RBSChange 4 database with fake data

  Sources   Download

MIT

The Requires

 

by Alexandre MogĂšre

faker ecommerce rbschange