Skip to content

Instantly share code, notes, and snippets.

@nook-ru

nook-ru/seed.php Secret

Created April 12, 2017 09:50
Show Gist options
  • Save nook-ru/5e3156e3e37f5e6e84e936dd098a4b67 to your computer and use it in GitHub Desktop.
Save nook-ru/5e3156e3e37f5e6e84e936dd098a4b67 to your computer and use it in GitHub Desktop.
<?php
CModule::IncludeModule('demo.adminhelper');
// https://github.com/fzaninotto/Faker#installation
$faker = Faker\Factory::create('ru_RU');
for ($i = 0; $i < 10; $i++)
{
$result = Demo\AdminHelper\News\CategoriesTable::add(array(
'TITLE' => $faker->country,
));
if ($result->isSuccess())
{
for ($j = 0; $j < 60; $j++)
{
Demo\AdminHelper\News\NewsTable::add(array(
'CATEGORY_ID' => $result->getId(),
'TITLE' => $faker->sentence(4),
'TEXT' => $faker->text(500),
'TEXT_TEXT_TYPE' => 'text',
'SOURCE' => $faker->url,
));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment