update faker script
This commit is contained in:
@@ -7,6 +7,9 @@ $faker = Faker\Factory::create();
|
||||
|
||||
$con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
|
||||
$currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne();
|
||||
|
||||
try {
|
||||
|
||||
$category = Thelia\Model\CategoryQuery::create()
|
||||
@@ -52,13 +55,25 @@ try {
|
||||
$product->addCategory($sweet);
|
||||
$product->setTitle($faker->bs);
|
||||
$product->setDescription($faker->text(250));
|
||||
$product->setQuantity($faker->randomNumber(1,50));
|
||||
$product->setPrice($faker->randomFloat(2, 20, 2500));
|
||||
/* $product->setQuantity($faker->randomNumber(1,50));
|
||||
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
|
||||
$product->setVisible(1);
|
||||
$product->setPosition($i);
|
||||
$product->setRef($faker->text(255));
|
||||
$product->save();
|
||||
|
||||
$stock = new \Thelia\Model\Stock();
|
||||
$stock->setProduct($product);
|
||||
$stock->setQuantity($faker->randomNumber(1,50));
|
||||
$stock->setPromo($faker->randomNumber(0,1));
|
||||
$stock->save();
|
||||
|
||||
$productPrice = new \Thelia\Model\ProductPrice();
|
||||
$productPrice->setStock($stock);
|
||||
$productPrice->setCurrency($currency);
|
||||
$productPrice->setPrice($faker->randomFloat(2, 20, 2500));
|
||||
$productPrice->save();
|
||||
|
||||
}
|
||||
|
||||
for ($i=1; $i <= 5; $i++) {
|
||||
@@ -66,13 +81,25 @@ try {
|
||||
$product->addCategory($jeans);
|
||||
$product->setTitle($faker->bs);
|
||||
$product->setDescription($faker->text(250));
|
||||
$product->setQuantity($faker->randomNumber(1,50));
|
||||
$product->setPrice($faker->randomFloat(2, 20, 2500));
|
||||
/* $product->setQuantity($faker->randomNumber(1,50));
|
||||
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
|
||||
$product->setVisible(1);
|
||||
$product->setPosition($i);
|
||||
$product->setRef($faker->text(255));
|
||||
$product->save();
|
||||
|
||||
$stock = new \Thelia\Model\Stock();
|
||||
$stock->setProduct($product);
|
||||
$stock->setQuantity($faker->randomNumber(1,50));
|
||||
$stock->setPromo($faker->randomNumber(0,1));
|
||||
$stock->save();
|
||||
|
||||
$productPrice = new \Thelia\Model\ProductPrice();
|
||||
$productPrice->setStock($stock);
|
||||
$productPrice->setCurrency($currency);
|
||||
$productPrice->setPrice($faker->randomFloat(2, 20, 2500));
|
||||
$productPrice->save();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@ INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES
|
||||
(3, 'en_US', 'Miss', 'Miss'),
|
||||
(3, 'fr_FR', 'Mlle', 'Madamemoiselle');
|
||||
|
||||
INSERT INTO `currency` (`id` ,`name` ,`code` ,`symbol` ,`rate` ,`by_default` ,`created_at` ,`updated_at`)
|
||||
VALUES
|
||||
(1 , 'euro', 'EUR', '€', '1', '1', NOW() , NOW()),
|
||||
(2, 'dollar', 'USD', '$', '1.26', '0', NOW(), NOW()),
|
||||
(3, 'livre', 'GBP', '£', '0.89', '0', NOW(), NOW());
|
||||
|
||||
|
||||
INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `created_at`, `updated_at`) VALUES
|
||||
(1, NULL, '4', 'AF', 'AFG', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
|
||||
(2, NULL, '710', 'ZA', 'ZAF', '2013-07-26 14:44:00', '2013-07-26 14:44:00'),
|
||||
|
||||
Reference in New Issue
Block a user