} $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(); $attribute = Thelia\Model\AttributeQuery::create()->find(); $attribute->delete(); $attribute = Thelia\Model\AttributeI18nQuery::create()->find(); $attribute->delete();
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"; }
/** * Returns a new ChildFeatureProductQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildFeatureProductQuery */ public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof \Thelia\Model\FeatureProductQuery) { return $criteria; } $query = new \Thelia\Model\FeatureProductQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }