Skip to content

Instantly share code, notes, and snippets.

@fzaninotto
Created October 24, 2011 07:55
Show Gist options
  • Save fzaninotto/1308553 to your computer and use it in GitHub Desktop.
Save fzaninotto/1308553 to your computer and use it in GitHub Desktop.
Inserting data to a database using Faker and Propel
<?php
$faker = \Faker\Factory::create();
$insertedPKs = array();
for ($i=0; $i < 100; $i++) {
$author = new Author();
$author->setFirstName($faker->firstName);
$author->setLastName($faker->lastName);
$author->setDateOfBirth($faker->date);
$author->setEmail($faker->email);
$author->save();
$insertedPKs[]= $author->getPrimaryKey();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment