Reputation: 36
I'm new in Yii, and I'm just curious, what is the best way for filling database with sample-data? For more detail, I'm searching for: some lib for creating sample texts/emails/user_names, etc. some convenient way to fill DataBase with these data. Any help is appreciated.
Upvotes: 1
Views: 566
Reputation: 1432
You could create something like this, which is actioned in the admin area or when you hit a URL.
for($i = 0; $i<2000; $i++)
{
$sheep = new Sheep();
$sheep->name = 'Sheep no '.$i;
$sheep->save();
}
Upvotes: 0
Reputation: 5798
Yii doesn't provide any functionality to populate database with sample or test data, but you can get number of links on google(popolate database with sample data). One of such is - Sample data genereators
Upvotes: 2