Skip to content

Instantly share code, notes, and snippets.

@fzaninotto
Created October 24, 2011 10:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fzaninotto/1308714 to your computer and use it in GitHub Desktop.
Save fzaninotto/1308714 to your computer and use it in GitHub Desktop.
Inserting data to several tables using Faker Populator, a custom formatter, and Propel
<?php
$faker = \Faker\Factory::create();
$populator = new \Faker\ORM\Propel\Populator($faker);
$populator->addEntity('Author', 10000);
$populator->addEntity('Book', 100000, $customColumnFormatters = array(
'ISBN' => function () use ($generator) { return $generator->randomNumber(13); },
));
$populator->addEntity('Review', 1000000);
$insertedPKs = $populator->execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment