Пример #1
0
         $attributeAv->setPosition($j);
         setI18n($attributeAv);
         $attributeAv->save();
         $attributeList[$attributeId][] = $attributeAv->getId();
     }
 }
 echo "Creating templates\n";
 $template = new Thelia\Model\Template();
 setI18n($template, array("Name" => 20));
 $template->save();
 foreach ($attributeList as $attributeId => $attributeAvId) {
     $at = new Thelia\Model\AttributeTemplate();
     $at->setTemplate($template)->setAttributeId($attributeId)->save();
 }
 foreach ($featureList as $featureId => $featureAvId) {
     $ft = new Thelia\Model\FeatureTemplate();
     $ft->setTemplate($template)->setFeatureId($featureId)->save();
 }
 echo "Creating folders and contents\n";
 //folders and contents
 $contentIdList = array();
 for ($i = 0; $i < 4; $i++) {
     $folder = new Thelia\Model\Folder();
     $folder->setParent(0);
     $folder->setVisible(1);
     $folder->setPosition($i + 1);
     setI18n($folder);
     $folder->save();
     $image = new \Thelia\Model\FolderImage();
     $image->setFolderId($folder->getId());
     generate_image($image, 'folder', $folder->getId());
Пример #2
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);
    $contents = createContents($faker, $folders, $con);
    $categories = createCategories($faker, $con);
    echo "creating templates\n";
    $template = new \Thelia\Model\Template();
    $template->setLocale('fr_FR')->setName('template de démo')->setLocale('en_US')->setName('demo template')->save($con);
    $at = new Thelia\Model\AttributeTemplate();
    $at->setTemplate($template)->setAttribute($color)->save($con);
    $ft = new Thelia\Model\FeatureTemplate();
    $ft->setTemplate($template)->setFeature($material)->save($con);
    echo "end creating templates\n";
    createProduct($faker, $categories, $brands, $contents, $template, $color, $material, $con);
    createCustomer($faker, $con);
    // set some config key
    createConfig($faker, $folders, $contents, $con);
    $con->commit();
} catch (Exception $e) {
    echo "error : " . $e->getMessage() . "\n";
    $con->rollBack();
}
function createProduct($faker, $categories, $brands, $contents, $template, $attribute, $feature, $con)
{
    echo "start creating products\n";
    $fileSystem = new \Symfony\Component\Filesystem\Filesystem();