Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faker #126

Open
clasense4 opened this issue May 18, 2015 · 1 comment
Open

Faker #126

clasense4 opened this issue May 18, 2015 · 1 comment

Comments

@clasense4
Copy link
Contributor

What about we use Faker to seed data to database?

Here is some sample code.

composer.json

"require-dev": {
    "fzaninotto/faker": "*"
},

command_prompt

composer update nothing -vvv --profile --prefer-dist

app.php

$Guru = new MyApp\Model\Guru();
$Guru->setGuruId(gen_uuid());
$Guru->setAlamat($faker->streetAddress);
$Guru->setNama($faker->firstName);
$Guru->setNuptk($faker->randomNumber($nbDigits = 9));
$Guru->setNip($faker->randomNumber($nbDigits = 6));
$Guru->setJenisKelamin($jk[$rand_keys]);
$Guru->setStatus(rand(1, 5));
$Guru->save();
@zaunaf
Copy link
Owner

zaunaf commented May 22, 2015

If possible, I think it would be better if we create our own faker, that optimizes our deep knowledge about the database structure and use the TableInfo to record the nature of the columns. I did that before, please check TestGen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants