Пример #1
0
function clearTables($con)
{
    echo "Clearing tables\n";
    $productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create()->find($con);
    $productAssociatedContent->delete($con);
    $categoryAssociatedContent = Thelia\Model\CategoryAssociatedContentQuery::create()->find($con);
    $categoryAssociatedContent->delete($con);
    $featureProduct = Thelia\Model\FeatureProductQuery::create()->find($con);
    $featureProduct->delete($con);
    $attributeCombination = Thelia\Model\AttributeCombinationQuery::create()->find($con);
    $attributeCombination->delete($con);
    $feature = Thelia\Model\FeatureQuery::create()->find($con);
    $feature->delete($con);
    $feature = Thelia\Model\FeatureI18nQuery::create()->find($con);
    $feature->delete($con);
    $featureAv = Thelia\Model\FeatureAvQuery::create()->find($con);
    $featureAv->delete($con);
    $featureAv = Thelia\Model\FeatureAvI18nQuery::create()->find($con);
    $featureAv->delete($con);
    $attribute = Thelia\Model\AttributeQuery::create()->find($con);
    $attribute->delete($con);
    $attribute = Thelia\Model\AttributeI18nQuery::create()->find($con);
    $attribute->delete($con);
    $attributeAv = Thelia\Model\AttributeAvQuery::create()->find($con);
    $attributeAv->delete($con);
    $attributeAv = Thelia\Model\AttributeAvI18nQuery::create()->find($con);
    $attributeAv->delete($con);
    $brand = Thelia\Model\BrandQuery::create()->find($con);
    $brand->delete($con);
    $brand = Thelia\Model\BrandI18nQuery::create()->find($con);
    $brand->delete($con);
    $category = Thelia\Model\CategoryQuery::create()->find($con);
    $category->delete($con);
    $category = Thelia\Model\CategoryI18nQuery::create()->find($con);
    $category->delete($con);
    $product = Thelia\Model\ProductQuery::create()->find($con);
    $product->delete($con);
    $product = Thelia\Model\ProductI18nQuery::create()->find($con);
    $product->delete($con);
    $folder = Thelia\Model\FolderQuery::create()->find($con);
    $folder->delete($con);
    $folder = Thelia\Model\FolderI18nQuery::create()->find($con);
    $folder->delete($con);
    $content = Thelia\Model\ContentQuery::create()->find($con);
    $content->delete($con);
    $content = Thelia\Model\ContentI18nQuery::create()->find($con);
    $content->delete($con);
    $accessory = Thelia\Model\AccessoryQuery::create()->find($con);
    $accessory->delete($con);
    $stock = \Thelia\Model\ProductSaleElementsQuery::create()->find($con);
    $stock->delete($con);
    $productPrice = \Thelia\Model\ProductPriceQuery::create()->find($con);
    $productPrice->delete($con);
    \Thelia\Model\ProductImageQuery::create()->find($con)->delete($con);
    $customer = Thelia\Model\CustomerQuery::create()->find($con);
    $customer->delete($con);
    echo "Tables cleared with success\n";
}
Пример #2
0
$localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT', 'de_DE');
$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");
    $stmt->execute();
    echo "Clearing tables\n";
    $productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create()->find();
    $productAssociatedContent->delete();
    $categoryAssociatedContent = Thelia\Model\CategoryAssociatedContentQuery::create()->find();
    $categoryAssociatedContent->delete();
    $featureProduct = Thelia\Model\FeatureProductQuery::create()->find();
    $featureProduct->delete();
    $attributeCombination = Thelia\Model\AttributeCombinationQuery::create()->find();
    $attributeCombination->delete();
    $feature = Thelia\Model\FeatureQuery::create()->find();
    $feature->delete();
    $feature = Thelia\Model\FeatureI18nQuery::create()->find();
    $feature->delete();
    $featureAv = Thelia\Model\FeatureAvQuery::create()->find();
    $featureAv->delete();
    $featureAv = Thelia\Model\FeatureAvI18nQuery::create()->find();
    $featureAv->delete();