if (isset($options['l'])) { $localeList = explode(',', str_replace(' ', '', $options['l'])); } if (isset($options['c'])) { if (0 !== intval($options['c'])) { $numberCategories = intval($options['c']); } } if (isset($options['p'])) { if (0 !== intval($options['p'])) { $numberProducts = intval($options['p']); } } $thelia = new Thelia\Core\Thelia("dev", false); $thelia->boot(); $thelia->getContainer()->get('thelia.translator'); // The default faker is en_US $faker = Faker\Factory::create('en_US'); // Create localized version for content generation $localizedFaker = []; foreach ($localeList as $locale) { $localizedFaker[$locale] = Faker\Factory::create($locale); } $con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME); $con->beginTransaction(); // Intialize URL management $url = new Thelia\Tools\URL(); $currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne(); //\Thelia\Log\Tlog::getInstance()->setLevel(\Thelia\Log\Tlog::ERROR); try { $stmt = $con->prepare("SET foreign_key_checks = 0");
if (isset($bootstrapFile)) { require $bootstrapFile; } elseif (is_file($file = __DIR__ . '/../core/vendor/autoload.php')) { require $file; } elseif (is_file($file = __DIR__ . '/../../bootstrap.php')) { // Here we are on a thelia/thelia-project require $file; } else { echo "No autoload file found. Please use the -b argument to include yours"; exit(1); } } $thelia = new Thelia\Core\Thelia("dev", true); $thelia->boot(); // Load the translator $thelia->getContainer()->get("thelia.translator"); $faker = Faker\Factory::create(); // Intialize URL management $url = new Thelia\Tools\URL(); $con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME); $con->beginTransaction(); try { $stmt = $con->prepare("SET foreign_key_checks = 0"); $stmt->execute(); clearTables($con); $stmt = $con->prepare("SET foreign_key_checks = 1"); $stmt->execute(); $material = createMaterials($con); $color = createColors($con); $brands = createBrands($faker, $con); $folders = createFolders($faker, $con);