From 1ba60103f34b288648af417241e957eafd2d21eb Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Wed, 18 Dec 2013 17:46:42 +0100 Subject: [PATCH] coupon in orders + model review : backquote use --- core/lib/Thelia/Action/Order.php | 8 + core/lib/Thelia/Config/Resources/loop.xml | 1 + core/lib/Thelia/Core/Template/Loop/Order.php | 2 +- .../Thelia/Core/Template/Loop/OrderCoupon.php | 116 ++ core/lib/Thelia/Model/Base/Accessory.php | 26 +- core/lib/Thelia/Model/Base/AccessoryQuery.php | 2 +- core/lib/Thelia/Model/Base/Address.php | 74 +- core/lib/Thelia/Model/Base/AddressQuery.php | 2 +- core/lib/Thelia/Model/Base/Admin.php | 50 +- core/lib/Thelia/Model/Base/AdminLog.php | 42 +- core/lib/Thelia/Model/Base/AdminLogQuery.php | 2 +- core/lib/Thelia/Model/Base/AdminQuery.php | 2 +- core/lib/Thelia/Model/Base/Area.php | 22 +- .../Thelia/Model/Base/AreaDeliveryModule.php | 22 +- .../Model/Base/AreaDeliveryModuleQuery.php | 2 +- core/lib/Thelia/Model/Base/AreaQuery.php | 2 +- core/lib/Thelia/Model/Base/Attribute.php | 18 +- core/lib/Thelia/Model/Base/AttributeAv.php | 22 +- .../lib/Thelia/Model/Base/AttributeAvI18n.php | 26 +- .../Model/Base/AttributeAvI18nQuery.php | 2 +- .../Thelia/Model/Base/AttributeAvQuery.php | 2 +- .../Model/Base/AttributeCombination.php | 22 +- .../Model/Base/AttributeCombinationQuery.php | 2 +- core/lib/Thelia/Model/Base/AttributeI18n.php | 26 +- .../Thelia/Model/Base/AttributeI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/AttributeQuery.php | 2 +- .../Thelia/Model/Base/AttributeTemplate.php | 26 +- .../Model/Base/AttributeTemplateQuery.php | 2 +- core/lib/Thelia/Model/Base/Cart.php | 38 +- core/lib/Thelia/Model/Base/CartItem.php | 138 +-- core/lib/Thelia/Model/Base/CartItemQuery.php | 47 +- core/lib/Thelia/Model/Base/CartQuery.php | 2 +- core/lib/Thelia/Model/Base/Category.php | 38 +- .../Model/Base/CategoryAssociatedContent.php | 26 +- .../Base/CategoryAssociatedContentQuery.php | 2 +- .../Thelia/Model/Base/CategoryDocument.php | 26 +- .../Model/Base/CategoryDocumentI18n.php | 26 +- .../Model/Base/CategoryDocumentI18nQuery.php | 2 +- .../Model/Base/CategoryDocumentQuery.php | 2 +- core/lib/Thelia/Model/Base/CategoryI18n.php | 38 +- .../Thelia/Model/Base/CategoryI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/CategoryImage.php | 26 +- .../Thelia/Model/Base/CategoryImageI18n.php | 26 +- .../Model/Base/CategoryImageI18nQuery.php | 2 +- .../Thelia/Model/Base/CategoryImageQuery.php | 2 +- core/lib/Thelia/Model/Base/CategoryQuery.php | 2 +- .../lib/Thelia/Model/Base/CategoryVersion.php | 38 +- .../Model/Base/CategoryVersionQuery.php | 2 +- core/lib/Thelia/Model/Base/Config.php | 30 +- core/lib/Thelia/Model/Base/ConfigI18n.php | 26 +- .../lib/Thelia/Model/Base/ConfigI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/ConfigQuery.php | 2 +- core/lib/Thelia/Model/Base/Content.php | 34 +- .../lib/Thelia/Model/Base/ContentDocument.php | 26 +- .../Thelia/Model/Base/ContentDocumentI18n.php | 26 +- .../Model/Base/ContentDocumentI18nQuery.php | 2 +- .../Model/Base/ContentDocumentQuery.php | 2 +- core/lib/Thelia/Model/Base/ContentFolder.php | 22 +- .../Thelia/Model/Base/ContentFolderQuery.php | 2 +- core/lib/Thelia/Model/Base/ContentI18n.php | 38 +- .../Thelia/Model/Base/ContentI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/ContentImage.php | 26 +- .../Thelia/Model/Base/ContentImageI18n.php | 26 +- .../Model/Base/ContentImageI18nQuery.php | 2 +- .../Thelia/Model/Base/ContentImageQuery.php | 2 +- core/lib/Thelia/Model/Base/ContentQuery.php | 2 +- core/lib/Thelia/Model/Base/ContentVersion.php | 34 +- .../Thelia/Model/Base/ContentVersionQuery.php | 2 +- core/lib/Thelia/Model/Base/Country.php | 38 +- core/lib/Thelia/Model/Base/CountryI18n.php | 26 +- .../Thelia/Model/Base/CountryI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/CountryQuery.php | 2 +- core/lib/Thelia/Model/Base/Coupon.php | 62 +- core/lib/Thelia/Model/Base/CouponI18n.php | 22 +- .../lib/Thelia/Model/Base/CouponI18nQuery.php | 2 +- .../Thelia/Model/Base/CouponOrderQuery.php | 678 ----------- core/lib/Thelia/Model/Base/CouponQuery.php | 2 +- core/lib/Thelia/Model/Base/CouponVersion.php | 62 +- .../Thelia/Model/Base/CouponVersionQuery.php | 2 +- core/lib/Thelia/Model/Base/Currency.php | 34 +- core/lib/Thelia/Model/Base/CurrencyI18n.php | 14 +- .../Thelia/Model/Base/CurrencyI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/CurrencyQuery.php | 2 +- core/lib/Thelia/Model/Base/Customer.php | 66 +- core/lib/Thelia/Model/Base/CustomerQuery.php | 2 +- core/lib/Thelia/Model/Base/CustomerTitle.php | 22 +- .../Thelia/Model/Base/CustomerTitleI18n.php | 18 +- .../Model/Base/CustomerTitleI18nQuery.php | 2 +- .../Thelia/Model/Base/CustomerTitleQuery.php | 2 +- core/lib/Thelia/Model/Base/Feature.php | 22 +- core/lib/Thelia/Model/Base/FeatureAv.php | 22 +- core/lib/Thelia/Model/Base/FeatureAvI18n.php | 26 +- .../Thelia/Model/Base/FeatureAvI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/FeatureAvQuery.php | 2 +- core/lib/Thelia/Model/Base/FeatureI18n.php | 26 +- .../Thelia/Model/Base/FeatureI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/FeatureProduct.php | 34 +- .../Thelia/Model/Base/FeatureProductQuery.php | 2 +- core/lib/Thelia/Model/Base/FeatureQuery.php | 2 +- .../lib/Thelia/Model/Base/FeatureTemplate.php | 26 +- .../Model/Base/FeatureTemplateQuery.php | 2 +- core/lib/Thelia/Model/Base/Folder.php | 38 +- core/lib/Thelia/Model/Base/FolderDocument.php | 26 +- .../Thelia/Model/Base/FolderDocumentI18n.php | 26 +- .../Model/Base/FolderDocumentI18nQuery.php | 2 +- .../Thelia/Model/Base/FolderDocumentQuery.php | 2 +- core/lib/Thelia/Model/Base/FolderI18n.php | 38 +- .../lib/Thelia/Model/Base/FolderI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/FolderImage.php | 26 +- .../lib/Thelia/Model/Base/FolderImageI18n.php | 26 +- .../Model/Base/FolderImageI18nQuery.php | 2 +- .../Thelia/Model/Base/FolderImageQuery.php | 2 +- core/lib/Thelia/Model/Base/FolderQuery.php | 2 +- core/lib/Thelia/Model/Base/FolderVersion.php | 38 +- .../Thelia/Model/Base/FolderVersionQuery.php | 2 +- core/lib/Thelia/Model/Base/Lang.php | 62 +- core/lib/Thelia/Model/Base/LangQuery.php | 2 +- core/lib/Thelia/Model/Base/Message.php | 50 +- core/lib/Thelia/Model/Base/MessageI18n.php | 26 +- .../Thelia/Model/Base/MessageI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/MessageQuery.php | 2 +- core/lib/Thelia/Model/Base/MessageVersion.php | 50 +- .../Thelia/Model/Base/MessageVersionQuery.php | 2 +- core/lib/Thelia/Model/Base/Module.php | 34 +- core/lib/Thelia/Model/Base/ModuleI18n.php | 26 +- .../lib/Thelia/Model/Base/ModuleI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/ModuleImage.php | 26 +- .../lib/Thelia/Model/Base/ModuleImageI18n.php | 26 +- .../Model/Base/ModuleImageI18nQuery.php | 2 +- .../Thelia/Model/Base/ModuleImageQuery.php | 2 +- core/lib/Thelia/Model/Base/ModuleQuery.php | 2 +- core/lib/Thelia/Model/Base/Newsletter.php | 30 +- .../lib/Thelia/Model/Base/NewsletterQuery.php | 2 +- core/lib/Thelia/Model/Base/Order.php | 406 ++++--- core/lib/Thelia/Model/Base/OrderAddress.php | 58 +- .../Thelia/Model/Base/OrderAddressQuery.php | 2 +- .../Base/{CouponOrder.php => OrderCoupon.php} | 880 ++++++++++++-- .../Thelia/Model/Base/OrderCouponQuery.php | 1061 +++++++++++++++++ core/lib/Thelia/Model/Base/OrderProduct.php | 82 +- .../Base/OrderProductAttributeCombination.php | 50 +- .../OrderProductAttributeCombinationQuery.php | 2 +- .../Thelia/Model/Base/OrderProductQuery.php | 2 +- .../lib/Thelia/Model/Base/OrderProductTax.php | 34 +- .../Model/Base/OrderProductTaxQuery.php | 2 +- core/lib/Thelia/Model/Base/OrderQuery.php | 89 +- core/lib/Thelia/Model/Base/OrderStatus.php | 18 +- .../lib/Thelia/Model/Base/OrderStatusI18n.php | 26 +- .../Model/Base/OrderStatusI18nQuery.php | 2 +- .../Thelia/Model/Base/OrderStatusQuery.php | 2 +- core/lib/Thelia/Model/Base/Product.php | 46 +- .../Model/Base/ProductAssociatedContent.php | 26 +- .../Base/ProductAssociatedContentQuery.php | 2 +- .../lib/Thelia/Model/Base/ProductCategory.php | 22 +- .../Model/Base/ProductCategoryQuery.php | 2 +- .../lib/Thelia/Model/Base/ProductDocument.php | 26 +- .../Thelia/Model/Base/ProductDocumentI18n.php | 26 +- .../Model/Base/ProductDocumentI18nQuery.php | 2 +- .../Model/Base/ProductDocumentQuery.php | 2 +- core/lib/Thelia/Model/Base/ProductI18n.php | 38 +- .../Thelia/Model/Base/ProductI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/ProductImage.php | 26 +- .../Thelia/Model/Base/ProductImageI18n.php | 26 +- .../Model/Base/ProductImageI18nQuery.php | 2 +- .../Thelia/Model/Base/ProductImageQuery.php | 2 +- core/lib/Thelia/Model/Base/ProductPrice.php | 30 +- .../Thelia/Model/Base/ProductPriceQuery.php | 2 +- core/lib/Thelia/Model/Base/ProductQuery.php | 2 +- .../Thelia/Model/Base/ProductSaleElements.php | 46 +- .../Model/Base/ProductSaleElementsQuery.php | 2 +- core/lib/Thelia/Model/Base/ProductVersion.php | 46 +- .../Thelia/Model/Base/ProductVersionQuery.php | 2 +- core/lib/Thelia/Model/Base/Profile.php | 18 +- core/lib/Thelia/Model/Base/ProfileI18n.php | 26 +- .../Thelia/Model/Base/ProfileI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/ProfileModule.php | 22 +- .../Thelia/Model/Base/ProfileModuleQuery.php | 2 +- core/lib/Thelia/Model/Base/ProfileQuery.php | 2 +- .../lib/Thelia/Model/Base/ProfileResource.php | 22 +- .../Model/Base/ProfileResourceQuery.php | 2 +- core/lib/Thelia/Model/Base/Resource.php | 18 +- core/lib/Thelia/Model/Base/ResourceI18n.php | 26 +- .../Thelia/Model/Base/ResourceI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/ResourceQuery.php | 2 +- .../Thelia/Model/Base/RewritingArgument.php | 22 +- .../Model/Base/RewritingArgumentQuery.php | 2 +- core/lib/Thelia/Model/Base/RewritingUrl.php | 34 +- .../Thelia/Model/Base/RewritingUrlQuery.php | 2 +- core/lib/Thelia/Model/Base/Tax.php | 22 +- core/lib/Thelia/Model/Base/TaxI18n.php | 18 +- core/lib/Thelia/Model/Base/TaxI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/TaxQuery.php | 2 +- core/lib/Thelia/Model/Base/TaxRule.php | 18 +- core/lib/Thelia/Model/Base/TaxRuleCountry.php | 26 +- .../Thelia/Model/Base/TaxRuleCountryQuery.php | 2 +- core/lib/Thelia/Model/Base/TaxRuleI18n.php | 18 +- .../Thelia/Model/Base/TaxRuleI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/TaxRuleQuery.php | 2 +- core/lib/Thelia/Model/Base/Template.php | 14 +- core/lib/Thelia/Model/Base/TemplateI18n.php | 14 +- .../Thelia/Model/Base/TemplateI18nQuery.php | 2 +- core/lib/Thelia/Model/Base/TemplateQuery.php | 2 +- core/lib/Thelia/Model/Cart.php | 2 - core/lib/Thelia/Model/CouponOrder.php | 9 - .../lib/Thelia/Model/Map/CartItemTableMap.php | 36 +- ...erTableMap.php => OrderCouponTableMap.php} | 232 ++-- core/lib/Thelia/Model/Map/OrderTableMap.php | 40 +- core/lib/Thelia/Model/Order.php | 182 +-- core/lib/Thelia/Model/OrderCoupon.php | 10 + ...ponOrderQuery.php => OrderCouponQuery.php} | 9 +- core/lib/Thelia/Model/OrderQuery.php | 33 - install/thelia.sql | 57 +- local/config/schema.xml | 37 +- reset_install.sh | 2 +- templates/backOffice/default/order-edit.html | 15 +- 214 files changed, 4173 insertions(+), 3065 deletions(-) create mode 100755 core/lib/Thelia/Core/Template/Loop/OrderCoupon.php delete mode 100644 core/lib/Thelia/Model/Base/CouponOrderQuery.php rename core/lib/Thelia/Model/Base/{CouponOrder.php => OrderCoupon.php} (57%) create mode 100644 core/lib/Thelia/Model/Base/OrderCouponQuery.php delete mode 100755 core/lib/Thelia/Model/CouponOrder.php rename core/lib/Thelia/Model/Map/{CouponOrderTableMap.php => OrderCouponTableMap.php} (53%) create mode 100644 core/lib/Thelia/Model/OrderCoupon.php rename core/lib/Thelia/Model/{CouponOrderQuery.php => OrderCouponQuery.php} (64%) mode change 100755 => 100644 diff --git a/core/lib/Thelia/Action/Order.php b/core/lib/Thelia/Action/Order.php index 0699c14d1..23b86c18b 100755 --- a/core/lib/Thelia/Action/Order.php +++ b/core/lib/Thelia/Action/Order.php @@ -178,6 +178,11 @@ class Order extends BaseAction implements EventSubscriberInterface OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_NOT_PAID)->getId() ); + /* memorize discount */ + $placedOrder->setDiscount( + $cart->getDiscount() + ); + $placedOrder->save($con); /* fulfill order_products and decrease stock */ @@ -263,6 +268,9 @@ class Order extends BaseAction implements EventSubscriberInterface } /* discount @todo */ + /* refresh discount */ + + /* memorize coupons */ $con->commit(); diff --git a/core/lib/Thelia/Config/Resources/loop.xml b/core/lib/Thelia/Config/Resources/loop.xml index c253b5fb4..0e5414ad8 100644 --- a/core/lib/Thelia/Config/Resources/loop.xml +++ b/core/lib/Thelia/Config/Resources/loop.xml @@ -28,6 +28,7 @@ + diff --git a/core/lib/Thelia/Core/Template/Loop/Order.php b/core/lib/Thelia/Core/Template/Loop/Order.php index 5f12fa1eb..7e03ece6c 100755 --- a/core/lib/Thelia/Core/Template/Loop/Order.php +++ b/core/lib/Thelia/Core/Template/Loop/Order.php @@ -175,7 +175,6 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt } return $search; - } public function parseResults(LoopResult $loopResult) @@ -202,6 +201,7 @@ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInt ->set("STATUS", $order->getStatusId()) ->set("LANG", $order->getLangId()) ->set("POSTAGE", $order->getPostage()) + ->set("DISCOUNT", $order->getDiscount()) ->set("TOTAL_TAX", $tax) ->set("TOTAL_AMOUNT", $amount - $tax) ->set("TOTAL_TAXED_AMOUNT", $amount) diff --git a/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php b/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php new file mode 100755 index 000000000..80e24c487 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/OrderCoupon.php @@ -0,0 +1,116 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Condition\ConditionFactory; +use Thelia\Condition\Implementation\ConditionInterface; +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; +use Thelia\Core\Template\Element\PropelSearchLoopInterface; +use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\OrderCouponQuery; +use Thelia\Model\OrderQuery; +use Thelia\Type; + +/** + * + * OrderCoupon loop + * + * + * Class OrderCoupon + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class OrderCoupon extends BaseLoop implements PropelSearchLoopInterface +{ + /** + * Define all args used in your loop + * + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('order', null, true) + ); + } + + public function buildModelCriteria() + { + $search = OrderCouponQuery::create(); + + $order = $this->getOrder(); + + $search->filterByOrderId($order, Criteria::EQUAL); + + $search->orderById(Criteria::ASC); + + return $search; + + } + + public function parseResults(LoopResult $loopResult) + { + $conditionFactory = $this->container->get('thelia.condition.factory'); + + /** @var OrderCoupon $orderCoupon */ + foreach ($loopResult->getResultDataCollection() as $orderCoupon) { + $loopResultRow = new LoopResultRow($orderCoupon); + $conditions = $conditionFactory->unserializeConditionCollection( + $orderCoupon->getSerializedConditions() + ); + + $now = time(); + $datediff = $orderCoupon->getExpirationDate()->getTimestamp() - $now; + $daysLeftBeforeExpiration = floor($datediff/(60*60*24)); + + $cleanedConditions = array(); + + foreach ($conditions->getConditions() as $condition) { + $cleanedConditions[] = $condition->getToolTip(); + } + $loopResultRow->set("ID", $orderCoupon->getId()) + ->set("CODE", $orderCoupon->getCode()) + ->set("TITLE", $orderCoupon->getTitle()) + ->set("SHORT_DESCRIPTION", $orderCoupon->getShortDescription()) + ->set("DESCRIPTION", $orderCoupon->getDescription()) + ->set("EXPIRATION_DATE", $orderCoupon->getExpirationDate( OrderQuery::create()->findPk($this->getOrder())->getLangId() )) + ->set("USAGE_LEFT", $orderCoupon->getMaxUsage()) + ->set("IS_CUMULATIVE", $orderCoupon->getIsCumulative()) + ->set("IS_REMOVING_POSTAGE", $orderCoupon->getIsRemovingPostage()) + ->set("IS_AVAILABLE_ON_SPECIAL_OFFERS", $orderCoupon->getIsAvailableOnSpecialOffers()) + ->set("AMOUNT", $orderCoupon->getAmount()) + ->set("APPLICATION_CONDITIONS", $cleanedConditions) + ->set("DAY_LEFT_BEFORE_EXPIRATION", $daysLeftBeforeExpiration) + ; + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Model/Base/Accessory.php b/core/lib/Thelia/Model/Base/Accessory.php index df3de2bc3..5dfd4c91b 100644 --- a/core/lib/Thelia/Model/Base/Accessory.php +++ b/core/lib/Thelia/Model/Base/Accessory.php @@ -902,26 +902,26 @@ abstract class Accessory implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AccessoryTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AccessoryTableMap::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_ID`'; } if ($this->isColumnModified(AccessoryTableMap::ACCESSORY)) { - $modifiedColumns[':p' . $index++] = 'ACCESSORY'; + $modifiedColumns[':p' . $index++] = '`ACCESSORY`'; } if ($this->isColumnModified(AccessoryTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(AccessoryTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AccessoryTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO accessory (%s) VALUES (%s)', + 'INSERT INTO `accessory` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -930,22 +930,22 @@ abstract class Accessory implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PRODUCT_ID': + case '`PRODUCT_ID`': $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); break; - case 'ACCESSORY': + case '`ACCESSORY`': $stmt->bindValue($identifier, $this->accessory, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AccessoryQuery.php b/core/lib/Thelia/Model/Base/AccessoryQuery.php index 82bb03a70..a79b73fbd 100644 --- a/core/lib/Thelia/Model/Base/AccessoryQuery.php +++ b/core/lib/Thelia/Model/Base/AccessoryQuery.php @@ -151,7 +151,7 @@ abstract class AccessoryQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PRODUCT_ID, ACCESSORY, POSITION, CREATED_AT, UPDATED_AT FROM accessory WHERE ID = :p0'; + $sql = 'SELECT `ID`, `PRODUCT_ID`, `ACCESSORY`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `accessory` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Address.php b/core/lib/Thelia/Model/Base/Address.php index 47bcd35a3..98a346969 100644 --- a/core/lib/Thelia/Model/Base/Address.php +++ b/core/lib/Thelia/Model/Base/Address.php @@ -1503,62 +1503,62 @@ abstract class Address implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AddressTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AddressTableMap::LABEL)) { - $modifiedColumns[':p' . $index++] = 'LABEL'; + $modifiedColumns[':p' . $index++] = '`LABEL`'; } if ($this->isColumnModified(AddressTableMap::CUSTOMER_ID)) { - $modifiedColumns[':p' . $index++] = 'CUSTOMER_ID'; + $modifiedColumns[':p' . $index++] = '`CUSTOMER_ID`'; } if ($this->isColumnModified(AddressTableMap::TITLE_ID)) { - $modifiedColumns[':p' . $index++] = 'TITLE_ID'; + $modifiedColumns[':p' . $index++] = '`TITLE_ID`'; } if ($this->isColumnModified(AddressTableMap::COMPANY)) { - $modifiedColumns[':p' . $index++] = 'COMPANY'; + $modifiedColumns[':p' . $index++] = '`COMPANY`'; } if ($this->isColumnModified(AddressTableMap::FIRSTNAME)) { - $modifiedColumns[':p' . $index++] = 'FIRSTNAME'; + $modifiedColumns[':p' . $index++] = '`FIRSTNAME`'; } if ($this->isColumnModified(AddressTableMap::LASTNAME)) { - $modifiedColumns[':p' . $index++] = 'LASTNAME'; + $modifiedColumns[':p' . $index++] = '`LASTNAME`'; } if ($this->isColumnModified(AddressTableMap::ADDRESS1)) { - $modifiedColumns[':p' . $index++] = 'ADDRESS1'; + $modifiedColumns[':p' . $index++] = '`ADDRESS1`'; } if ($this->isColumnModified(AddressTableMap::ADDRESS2)) { - $modifiedColumns[':p' . $index++] = 'ADDRESS2'; + $modifiedColumns[':p' . $index++] = '`ADDRESS2`'; } if ($this->isColumnModified(AddressTableMap::ADDRESS3)) { - $modifiedColumns[':p' . $index++] = 'ADDRESS3'; + $modifiedColumns[':p' . $index++] = '`ADDRESS3`'; } if ($this->isColumnModified(AddressTableMap::ZIPCODE)) { - $modifiedColumns[':p' . $index++] = 'ZIPCODE'; + $modifiedColumns[':p' . $index++] = '`ZIPCODE`'; } if ($this->isColumnModified(AddressTableMap::CITY)) { - $modifiedColumns[':p' . $index++] = 'CITY'; + $modifiedColumns[':p' . $index++] = '`CITY`'; } if ($this->isColumnModified(AddressTableMap::COUNTRY_ID)) { - $modifiedColumns[':p' . $index++] = 'COUNTRY_ID'; + $modifiedColumns[':p' . $index++] = '`COUNTRY_ID`'; } if ($this->isColumnModified(AddressTableMap::PHONE)) { - $modifiedColumns[':p' . $index++] = 'PHONE'; + $modifiedColumns[':p' . $index++] = '`PHONE`'; } if ($this->isColumnModified(AddressTableMap::CELLPHONE)) { - $modifiedColumns[':p' . $index++] = 'CELLPHONE'; + $modifiedColumns[':p' . $index++] = '`CELLPHONE`'; } if ($this->isColumnModified(AddressTableMap::IS_DEFAULT)) { - $modifiedColumns[':p' . $index++] = 'IS_DEFAULT'; + $modifiedColumns[':p' . $index++] = '`IS_DEFAULT`'; } if ($this->isColumnModified(AddressTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AddressTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO address (%s) VALUES (%s)', + 'INSERT INTO `address` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1567,58 +1567,58 @@ abstract class Address implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LABEL': + case '`LABEL`': $stmt->bindValue($identifier, $this->label, PDO::PARAM_STR); break; - case 'CUSTOMER_ID': + case '`CUSTOMER_ID`': $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT); break; - case 'TITLE_ID': + case '`TITLE_ID`': $stmt->bindValue($identifier, $this->title_id, PDO::PARAM_INT); break; - case 'COMPANY': + case '`COMPANY`': $stmt->bindValue($identifier, $this->company, PDO::PARAM_STR); break; - case 'FIRSTNAME': + case '`FIRSTNAME`': $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); break; - case 'LASTNAME': + case '`LASTNAME`': $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); break; - case 'ADDRESS1': + case '`ADDRESS1`': $stmt->bindValue($identifier, $this->address1, PDO::PARAM_STR); break; - case 'ADDRESS2': + case '`ADDRESS2`': $stmt->bindValue($identifier, $this->address2, PDO::PARAM_STR); break; - case 'ADDRESS3': + case '`ADDRESS3`': $stmt->bindValue($identifier, $this->address3, PDO::PARAM_STR); break; - case 'ZIPCODE': + case '`ZIPCODE`': $stmt->bindValue($identifier, $this->zipcode, PDO::PARAM_STR); break; - case 'CITY': + case '`CITY`': $stmt->bindValue($identifier, $this->city, PDO::PARAM_STR); break; - case 'COUNTRY_ID': + case '`COUNTRY_ID`': $stmt->bindValue($identifier, $this->country_id, PDO::PARAM_INT); break; - case 'PHONE': + case '`PHONE`': $stmt->bindValue($identifier, $this->phone, PDO::PARAM_STR); break; - case 'CELLPHONE': + case '`CELLPHONE`': $stmt->bindValue($identifier, $this->cellphone, PDO::PARAM_STR); break; - case 'IS_DEFAULT': + case '`IS_DEFAULT`': $stmt->bindValue($identifier, $this->is_default, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AddressQuery.php b/core/lib/Thelia/Model/Base/AddressQuery.php index dc6827868..40d15fd96 100644 --- a/core/lib/Thelia/Model/Base/AddressQuery.php +++ b/core/lib/Thelia/Model/Base/AddressQuery.php @@ -211,7 +211,7 @@ abstract class AddressQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LABEL, CUSTOMER_ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0'; + $sql = 'SELECT `ID`, `LABEL`, `CUSTOMER_ID`, `TITLE_ID`, `COMPANY`, `FIRSTNAME`, `LASTNAME`, `ADDRESS1`, `ADDRESS2`, `ADDRESS3`, `ZIPCODE`, `CITY`, `COUNTRY_ID`, `PHONE`, `CELLPHONE`, `IS_DEFAULT`, `CREATED_AT`, `UPDATED_AT` FROM `address` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Admin.php b/core/lib/Thelia/Model/Base/Admin.php index cb1295c3f..4342ae90f 100644 --- a/core/lib/Thelia/Model/Base/Admin.php +++ b/core/lib/Thelia/Model/Base/Admin.php @@ -1128,44 +1128,44 @@ abstract class Admin implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AdminTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AdminTableMap::PROFILE_ID)) { - $modifiedColumns[':p' . $index++] = 'PROFILE_ID'; + $modifiedColumns[':p' . $index++] = '`PROFILE_ID`'; } if ($this->isColumnModified(AdminTableMap::FIRSTNAME)) { - $modifiedColumns[':p' . $index++] = 'FIRSTNAME'; + $modifiedColumns[':p' . $index++] = '`FIRSTNAME`'; } if ($this->isColumnModified(AdminTableMap::LASTNAME)) { - $modifiedColumns[':p' . $index++] = 'LASTNAME'; + $modifiedColumns[':p' . $index++] = '`LASTNAME`'; } if ($this->isColumnModified(AdminTableMap::LOGIN)) { - $modifiedColumns[':p' . $index++] = 'LOGIN'; + $modifiedColumns[':p' . $index++] = '`LOGIN`'; } if ($this->isColumnModified(AdminTableMap::PASSWORD)) { - $modifiedColumns[':p' . $index++] = 'PASSWORD'; + $modifiedColumns[':p' . $index++] = '`PASSWORD`'; } if ($this->isColumnModified(AdminTableMap::ALGO)) { - $modifiedColumns[':p' . $index++] = 'ALGO'; + $modifiedColumns[':p' . $index++] = '`ALGO`'; } if ($this->isColumnModified(AdminTableMap::SALT)) { - $modifiedColumns[':p' . $index++] = 'SALT'; + $modifiedColumns[':p' . $index++] = '`SALT`'; } if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_TOKEN)) { - $modifiedColumns[':p' . $index++] = 'REMEMBER_ME_TOKEN'; + $modifiedColumns[':p' . $index++] = '`REMEMBER_ME_TOKEN`'; } if ($this->isColumnModified(AdminTableMap::REMEMBER_ME_SERIAL)) { - $modifiedColumns[':p' . $index++] = 'REMEMBER_ME_SERIAL'; + $modifiedColumns[':p' . $index++] = '`REMEMBER_ME_SERIAL`'; } if ($this->isColumnModified(AdminTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AdminTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO admin (%s) VALUES (%s)', + 'INSERT INTO `admin` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1174,40 +1174,40 @@ abstract class Admin implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PROFILE_ID': + case '`PROFILE_ID`': $stmt->bindValue($identifier, $this->profile_id, PDO::PARAM_INT); break; - case 'FIRSTNAME': + case '`FIRSTNAME`': $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); break; - case 'LASTNAME': + case '`LASTNAME`': $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); break; - case 'LOGIN': + case '`LOGIN`': $stmt->bindValue($identifier, $this->login, PDO::PARAM_STR); break; - case 'PASSWORD': + case '`PASSWORD`': $stmt->bindValue($identifier, $this->password, PDO::PARAM_STR); break; - case 'ALGO': + case '`ALGO`': $stmt->bindValue($identifier, $this->algo, PDO::PARAM_STR); break; - case 'SALT': + case '`SALT`': $stmt->bindValue($identifier, $this->salt, PDO::PARAM_STR); break; - case 'REMEMBER_ME_TOKEN': + case '`REMEMBER_ME_TOKEN`': $stmt->bindValue($identifier, $this->remember_me_token, PDO::PARAM_STR); break; - case 'REMEMBER_ME_SERIAL': + case '`REMEMBER_ME_SERIAL`': $stmt->bindValue($identifier, $this->remember_me_serial, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AdminLog.php b/core/lib/Thelia/Model/Base/AdminLog.php index abebb7cd9..346011916 100644 --- a/core/lib/Thelia/Model/Base/AdminLog.php +++ b/core/lib/Thelia/Model/Base/AdminLog.php @@ -1019,38 +1019,38 @@ abstract class AdminLog implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AdminLogTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AdminLogTableMap::ADMIN_LOGIN)) { - $modifiedColumns[':p' . $index++] = 'ADMIN_LOGIN'; + $modifiedColumns[':p' . $index++] = '`ADMIN_LOGIN`'; } if ($this->isColumnModified(AdminLogTableMap::ADMIN_FIRSTNAME)) { - $modifiedColumns[':p' . $index++] = 'ADMIN_FIRSTNAME'; + $modifiedColumns[':p' . $index++] = '`ADMIN_FIRSTNAME`'; } if ($this->isColumnModified(AdminLogTableMap::ADMIN_LASTNAME)) { - $modifiedColumns[':p' . $index++] = 'ADMIN_LASTNAME'; + $modifiedColumns[':p' . $index++] = '`ADMIN_LASTNAME`'; } if ($this->isColumnModified(AdminLogTableMap::RESOURCE)) { - $modifiedColumns[':p' . $index++] = 'RESOURCE'; + $modifiedColumns[':p' . $index++] = '`RESOURCE`'; } if ($this->isColumnModified(AdminLogTableMap::ACTION)) { - $modifiedColumns[':p' . $index++] = 'ACTION'; + $modifiedColumns[':p' . $index++] = '`ACTION`'; } if ($this->isColumnModified(AdminLogTableMap::MESSAGE)) { - $modifiedColumns[':p' . $index++] = 'MESSAGE'; + $modifiedColumns[':p' . $index++] = '`MESSAGE`'; } if ($this->isColumnModified(AdminLogTableMap::REQUEST)) { - $modifiedColumns[':p' . $index++] = 'REQUEST'; + $modifiedColumns[':p' . $index++] = '`REQUEST`'; } if ($this->isColumnModified(AdminLogTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AdminLogTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO admin_log (%s) VALUES (%s)', + 'INSERT INTO `admin_log` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1059,34 +1059,34 @@ abstract class AdminLog implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'ADMIN_LOGIN': + case '`ADMIN_LOGIN`': $stmt->bindValue($identifier, $this->admin_login, PDO::PARAM_STR); break; - case 'ADMIN_FIRSTNAME': + case '`ADMIN_FIRSTNAME`': $stmt->bindValue($identifier, $this->admin_firstname, PDO::PARAM_STR); break; - case 'ADMIN_LASTNAME': + case '`ADMIN_LASTNAME`': $stmt->bindValue($identifier, $this->admin_lastname, PDO::PARAM_STR); break; - case 'RESOURCE': + case '`RESOURCE`': $stmt->bindValue($identifier, $this->resource, PDO::PARAM_STR); break; - case 'ACTION': + case '`ACTION`': $stmt->bindValue($identifier, $this->action, PDO::PARAM_STR); break; - case 'MESSAGE': + case '`MESSAGE`': $stmt->bindValue($identifier, $this->message, PDO::PARAM_STR); break; - case 'REQUEST': + case '`REQUEST`': $stmt->bindValue($identifier, $this->request, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AdminLogQuery.php b/core/lib/Thelia/Model/Base/AdminLogQuery.php index 061b9013d..de0a8771f 100644 --- a/core/lib/Thelia/Model/Base/AdminLogQuery.php +++ b/core/lib/Thelia/Model/Base/AdminLogQuery.php @@ -156,7 +156,7 @@ abstract class AdminLogQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ADMIN_LOGIN, ADMIN_FIRSTNAME, ADMIN_LASTNAME, RESOURCE, ACTION, MESSAGE, REQUEST, CREATED_AT, UPDATED_AT FROM admin_log WHERE ID = :p0'; + $sql = 'SELECT `ID`, `ADMIN_LOGIN`, `ADMIN_FIRSTNAME`, `ADMIN_LASTNAME`, `RESOURCE`, `ACTION`, `MESSAGE`, `REQUEST`, `CREATED_AT`, `UPDATED_AT` FROM `admin_log` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/AdminQuery.php b/core/lib/Thelia/Model/Base/AdminQuery.php index d9f032544..0ec88d23e 100644 --- a/core/lib/Thelia/Model/Base/AdminQuery.php +++ b/core/lib/Thelia/Model/Base/AdminQuery.php @@ -171,7 +171,7 @@ abstract class AdminQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PROFILE_ID, FIRSTNAME, LASTNAME, LOGIN, PASSWORD, ALGO, SALT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM admin WHERE ID = :p0'; + $sql = 'SELECT `ID`, `PROFILE_ID`, `FIRSTNAME`, `LASTNAME`, `LOGIN`, `PASSWORD`, `ALGO`, `SALT`, `REMEMBER_ME_TOKEN`, `REMEMBER_ME_SERIAL`, `CREATED_AT`, `UPDATED_AT` FROM `admin` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Area.php b/core/lib/Thelia/Model/Base/Area.php index 14d834929..b0efba572 100644 --- a/core/lib/Thelia/Model/Base/Area.php +++ b/core/lib/Thelia/Model/Base/Area.php @@ -882,23 +882,23 @@ abstract class Area implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AreaTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AreaTableMap::NAME)) { - $modifiedColumns[':p' . $index++] = 'NAME'; + $modifiedColumns[':p' . $index++] = '`NAME`'; } if ($this->isColumnModified(AreaTableMap::POSTAGE)) { - $modifiedColumns[':p' . $index++] = 'POSTAGE'; + $modifiedColumns[':p' . $index++] = '`POSTAGE`'; } if ($this->isColumnModified(AreaTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AreaTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO area (%s) VALUES (%s)', + 'INSERT INTO `area` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -907,19 +907,19 @@ abstract class Area implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'NAME': + case '`NAME`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; - case 'POSTAGE': + case '`POSTAGE`': $stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AreaDeliveryModule.php b/core/lib/Thelia/Model/Base/AreaDeliveryModule.php index 1e2996fb4..2873ca946 100644 --- a/core/lib/Thelia/Model/Base/AreaDeliveryModule.php +++ b/core/lib/Thelia/Model/Base/AreaDeliveryModule.php @@ -863,23 +863,23 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AreaDeliveryModuleTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AreaDeliveryModuleTableMap::AREA_ID)) { - $modifiedColumns[':p' . $index++] = 'AREA_ID'; + $modifiedColumns[':p' . $index++] = '`AREA_ID`'; } if ($this->isColumnModified(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID)) { - $modifiedColumns[':p' . $index++] = 'DELIVERY_MODULE_ID'; + $modifiedColumns[':p' . $index++] = '`DELIVERY_MODULE_ID`'; } if ($this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO area_delivery_module (%s) VALUES (%s)', + 'INSERT INTO `area_delivery_module` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -888,19 +888,19 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'AREA_ID': + case '`AREA_ID`': $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT); break; - case 'DELIVERY_MODULE_ID': + case '`DELIVERY_MODULE_ID`': $stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AreaDeliveryModuleQuery.php b/core/lib/Thelia/Model/Base/AreaDeliveryModuleQuery.php index 394fe651e..2d21d28e0 100644 --- a/core/lib/Thelia/Model/Base/AreaDeliveryModuleQuery.php +++ b/core/lib/Thelia/Model/Base/AreaDeliveryModuleQuery.php @@ -147,7 +147,7 @@ abstract class AreaDeliveryModuleQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, AREA_ID, DELIVERY_MODULE_ID, CREATED_AT, UPDATED_AT FROM area_delivery_module WHERE ID = :p0'; + $sql = 'SELECT `ID`, `AREA_ID`, `DELIVERY_MODULE_ID`, `CREATED_AT`, `UPDATED_AT` FROM `area_delivery_module` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/AreaQuery.php b/core/lib/Thelia/Model/Base/AreaQuery.php index ea4cd8b90..e1033e576 100644 --- a/core/lib/Thelia/Model/Base/AreaQuery.php +++ b/core/lib/Thelia/Model/Base/AreaQuery.php @@ -147,7 +147,7 @@ abstract class AreaQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, NAME, POSTAGE, CREATED_AT, UPDATED_AT FROM area WHERE ID = :p0'; + $sql = 'SELECT `ID`, `NAME`, `POSTAGE`, `CREATED_AT`, `UPDATED_AT` FROM `area` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Attribute.php b/core/lib/Thelia/Model/Base/Attribute.php index f9cee31c7..9e1fc6c9c 100644 --- a/core/lib/Thelia/Model/Base/Attribute.php +++ b/core/lib/Thelia/Model/Base/Attribute.php @@ -961,20 +961,20 @@ abstract class Attribute implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AttributeTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AttributeTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(AttributeTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AttributeTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO attribute (%s) VALUES (%s)', + 'INSERT INTO `attribute` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -983,16 +983,16 @@ abstract class Attribute implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AttributeAv.php b/core/lib/Thelia/Model/Base/AttributeAv.php index 83b55fab8..e92a8cd12 100644 --- a/core/lib/Thelia/Model/Base/AttributeAv.php +++ b/core/lib/Thelia/Model/Base/AttributeAv.php @@ -922,23 +922,23 @@ abstract class AttributeAv implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AttributeAvTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AttributeAvTableMap::ATTRIBUTE_ID)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_ID'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_ID`'; } if ($this->isColumnModified(AttributeAvTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(AttributeAvTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AttributeAvTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO attribute_av (%s) VALUES (%s)', + 'INSERT INTO `attribute_av` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -947,19 +947,19 @@ abstract class AttributeAv implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'ATTRIBUTE_ID': + case '`ATTRIBUTE_ID`': $stmt->bindValue($identifier, $this->attribute_id, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AttributeAvI18n.php b/core/lib/Thelia/Model/Base/AttributeAvI18n.php index dd2a973b7..106dee40c 100644 --- a/core/lib/Thelia/Model/Base/AttributeAvI18n.php +++ b/core/lib/Thelia/Model/Base/AttributeAvI18n.php @@ -858,26 +858,26 @@ abstract class AttributeAvI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AttributeAvI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AttributeAvI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(AttributeAvI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(AttributeAvI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(AttributeAvI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(AttributeAvI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO attribute_av_i18n (%s) VALUES (%s)', + 'INSERT INTO `attribute_av_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class AttributeAvI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AttributeAvI18nQuery.php b/core/lib/Thelia/Model/Base/AttributeAvI18nQuery.php index 943e453a9..df90b3baa 100644 --- a/core/lib/Thelia/Model/Base/AttributeAvI18nQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeAvI18nQuery.php @@ -147,7 +147,7 @@ abstract class AttributeAvI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM attribute_av_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `attribute_av_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/AttributeAvQuery.php b/core/lib/Thelia/Model/Base/AttributeAvQuery.php index 8ebfaa8c9..d0227b7c9 100644 --- a/core/lib/Thelia/Model/Base/AttributeAvQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeAvQuery.php @@ -152,7 +152,7 @@ abstract class AttributeAvQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ATTRIBUTE_ID, POSITION, CREATED_AT, UPDATED_AT FROM attribute_av WHERE ID = :p0'; + $sql = 'SELECT `ID`, `ATTRIBUTE_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_av` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/AttributeCombination.php b/core/lib/Thelia/Model/Base/AttributeCombination.php index 543e86476..7db295561 100644 --- a/core/lib/Thelia/Model/Base/AttributeCombination.php +++ b/core/lib/Thelia/Model/Base/AttributeCombination.php @@ -881,23 +881,23 @@ abstract class AttributeCombination implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AttributeCombinationTableMap::ATTRIBUTE_ID)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_ID'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_ID`'; } if ($this->isColumnModified(AttributeCombinationTableMap::ATTRIBUTE_AV_ID)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_AV_ID'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_AV_ID`'; } if ($this->isColumnModified(AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_SALE_ELEMENTS_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_SALE_ELEMENTS_ID`'; } if ($this->isColumnModified(AttributeCombinationTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AttributeCombinationTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO attribute_combination (%s) VALUES (%s)', + 'INSERT INTO `attribute_combination` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -906,19 +906,19 @@ abstract class AttributeCombination implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ATTRIBUTE_ID': + case '`ATTRIBUTE_ID`': $stmt->bindValue($identifier, $this->attribute_id, PDO::PARAM_INT); break; - case 'ATTRIBUTE_AV_ID': + case '`ATTRIBUTE_AV_ID`': $stmt->bindValue($identifier, $this->attribute_av_id, PDO::PARAM_INT); break; - case 'PRODUCT_SALE_ELEMENTS_ID': + case '`PRODUCT_SALE_ELEMENTS_ID`': $stmt->bindValue($identifier, $this->product_sale_elements_id, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AttributeCombinationQuery.php b/core/lib/Thelia/Model/Base/AttributeCombinationQuery.php index 291ff7725..d77286e11 100644 --- a/core/lib/Thelia/Model/Base/AttributeCombinationQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeCombinationQuery.php @@ -151,7 +151,7 @@ abstract class AttributeCombinationQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ATTRIBUTE_ID, ATTRIBUTE_AV_ID, PRODUCT_SALE_ELEMENTS_ID, CREATED_AT, UPDATED_AT FROM attribute_combination WHERE ATTRIBUTE_ID = :p0 AND ATTRIBUTE_AV_ID = :p1 AND PRODUCT_SALE_ELEMENTS_ID = :p2'; + $sql = 'SELECT `ATTRIBUTE_ID`, `ATTRIBUTE_AV_ID`, `PRODUCT_SALE_ELEMENTS_ID`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_combination` WHERE `ATTRIBUTE_ID` = :p0 AND `ATTRIBUTE_AV_ID` = :p1 AND `PRODUCT_SALE_ELEMENTS_ID` = :p2'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/AttributeI18n.php b/core/lib/Thelia/Model/Base/AttributeI18n.php index 30bd331a3..f5cd9c6af 100644 --- a/core/lib/Thelia/Model/Base/AttributeI18n.php +++ b/core/lib/Thelia/Model/Base/AttributeI18n.php @@ -858,26 +858,26 @@ abstract class AttributeI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AttributeI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AttributeI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(AttributeI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(AttributeI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(AttributeI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(AttributeI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO attribute_i18n (%s) VALUES (%s)', + 'INSERT INTO `attribute_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class AttributeI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AttributeI18nQuery.php b/core/lib/Thelia/Model/Base/AttributeI18nQuery.php index c553af9a2..5b7f05df5 100644 --- a/core/lib/Thelia/Model/Base/AttributeI18nQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeI18nQuery.php @@ -147,7 +147,7 @@ abstract class AttributeI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM attribute_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `attribute_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/AttributeQuery.php b/core/lib/Thelia/Model/Base/AttributeQuery.php index b496289f8..a2f2b6915 100644 --- a/core/lib/Thelia/Model/Base/AttributeQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeQuery.php @@ -152,7 +152,7 @@ abstract class AttributeQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, POSITION, CREATED_AT, UPDATED_AT FROM attribute WHERE ID = :p0'; + $sql = 'SELECT `ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `attribute` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/AttributeTemplate.php b/core/lib/Thelia/Model/Base/AttributeTemplate.php index ae45495ee..ea3032359 100644 --- a/core/lib/Thelia/Model/Base/AttributeTemplate.php +++ b/core/lib/Thelia/Model/Base/AttributeTemplate.php @@ -904,26 +904,26 @@ abstract class AttributeTemplate implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AttributeTemplateTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(AttributeTemplateTableMap::ATTRIBUTE_ID)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_ID'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_ID`'; } if ($this->isColumnModified(AttributeTemplateTableMap::TEMPLATE_ID)) { - $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID'; + $modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`'; } if ($this->isColumnModified(AttributeTemplateTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(AttributeTemplateTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(AttributeTemplateTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO attribute_template (%s) VALUES (%s)', + 'INSERT INTO `attribute_template` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -932,22 +932,22 @@ abstract class AttributeTemplate implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'ATTRIBUTE_ID': + case '`ATTRIBUTE_ID`': $stmt->bindValue($identifier, $this->attribute_id, PDO::PARAM_INT); break; - case 'TEMPLATE_ID': + case '`TEMPLATE_ID`': $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php b/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php index e1a8d0320..bbfd77ebb 100644 --- a/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeTemplateQuery.php @@ -151,7 +151,7 @@ abstract class AttributeTemplateQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ATTRIBUTE_ID, TEMPLATE_ID, POSITION, CREATED_AT, UPDATED_AT FROM attribute_template WHERE ID = :p0'; + $sql = 'SELECT `ID`, `ATTRIBUTE_ID`, `TEMPLATE_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `attribute_template` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Cart.php b/core/lib/Thelia/Model/Base/Cart.php index 96880be66..446eae129 100644 --- a/core/lib/Thelia/Model/Base/Cart.php +++ b/core/lib/Thelia/Model/Base/Cart.php @@ -1121,35 +1121,35 @@ abstract class Cart implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CartTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CartTableMap::TOKEN)) { - $modifiedColumns[':p' . $index++] = 'TOKEN'; + $modifiedColumns[':p' . $index++] = '`TOKEN`'; } if ($this->isColumnModified(CartTableMap::CUSTOMER_ID)) { - $modifiedColumns[':p' . $index++] = 'CUSTOMER_ID'; + $modifiedColumns[':p' . $index++] = '`CUSTOMER_ID`'; } if ($this->isColumnModified(CartTableMap::ADDRESS_DELIVERY_ID)) { - $modifiedColumns[':p' . $index++] = 'ADDRESS_DELIVERY_ID'; + $modifiedColumns[':p' . $index++] = '`ADDRESS_DELIVERY_ID`'; } if ($this->isColumnModified(CartTableMap::ADDRESS_INVOICE_ID)) { - $modifiedColumns[':p' . $index++] = 'ADDRESS_INVOICE_ID'; + $modifiedColumns[':p' . $index++] = '`ADDRESS_INVOICE_ID`'; } if ($this->isColumnModified(CartTableMap::CURRENCY_ID)) { - $modifiedColumns[':p' . $index++] = 'CURRENCY_ID'; + $modifiedColumns[':p' . $index++] = '`CURRENCY_ID`'; } if ($this->isColumnModified(CartTableMap::DISCOUNT)) { - $modifiedColumns[':p' . $index++] = 'DISCOUNT'; + $modifiedColumns[':p' . $index++] = '`DISCOUNT`'; } if ($this->isColumnModified(CartTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CartTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO cart (%s) VALUES (%s)', + 'INSERT INTO `cart` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1158,31 +1158,31 @@ abstract class Cart implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'TOKEN': + case '`TOKEN`': $stmt->bindValue($identifier, $this->token, PDO::PARAM_STR); break; - case 'CUSTOMER_ID': + case '`CUSTOMER_ID`': $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT); break; - case 'ADDRESS_DELIVERY_ID': + case '`ADDRESS_DELIVERY_ID`': $stmt->bindValue($identifier, $this->address_delivery_id, PDO::PARAM_INT); break; - case 'ADDRESS_INVOICE_ID': + case '`ADDRESS_INVOICE_ID`': $stmt->bindValue($identifier, $this->address_invoice_id, PDO::PARAM_INT); break; - case 'CURRENCY_ID': + case '`CURRENCY_ID`': $stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT); break; - case 'DISCOUNT': + case '`DISCOUNT`': $stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CartItem.php b/core/lib/Thelia/Model/Base/CartItem.php index 53b3ef411..6b074e4e3 100644 --- a/core/lib/Thelia/Model/Base/CartItem.php +++ b/core/lib/Thelia/Model/Base/CartItem.php @@ -109,13 +109,6 @@ abstract class CartItem implements ActiveRecordInterface */ protected $price_end_of_life; - /** - * The value for the discount field. - * Note: this column has a database default value of: 0 - * @var double - */ - protected $discount; - /** * The value for the promo field. * @var int @@ -166,7 +159,6 @@ abstract class CartItem implements ActiveRecordInterface public function applyDefaultValues() { $this->quantity = 1; - $this->discount = 0; } /** @@ -526,17 +518,6 @@ abstract class CartItem implements ActiveRecordInterface } } - /** - * Get the [discount] column value. - * - * @return double - */ - public function getDiscount() - { - - return $this->discount; - } - /** * Get the [promo] column value. * @@ -768,27 +749,6 @@ abstract class CartItem implements ActiveRecordInterface return $this; } // setPriceEndOfLife() - /** - * Set the value of [discount] column. - * - * @param double $v new value - * @return \Thelia\Model\CartItem The current object (for fluent API support) - */ - public function setDiscount($v) - { - if ($v !== null) { - $v = (double) $v; - } - - if ($this->discount !== $v) { - $this->discount = $v; - $this->modifiedColumns[] = CartItemTableMap::DISCOUNT; - } - - - return $this; - } // setDiscount() - /** * Set the value of [promo] column. * @@ -866,10 +826,6 @@ abstract class CartItem implements ActiveRecordInterface return false; } - if ($this->discount !== 0) { - return false; - } - // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -924,19 +880,16 @@ abstract class CartItem implements ActiveRecordInterface } $this->price_end_of_life = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CartItemTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)]; - $this->discount = (null !== $col) ? (double) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CartItemTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)]; $this->promo = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CartItemTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -949,7 +902,7 @@ abstract class CartItem implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 12; // 12 = CartItemTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 11; // 11 = CartItemTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\CartItem object", 0, $e); @@ -1208,44 +1161,41 @@ abstract class CartItem implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CartItemTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CartItemTableMap::CART_ID)) { - $modifiedColumns[':p' . $index++] = 'CART_ID'; + $modifiedColumns[':p' . $index++] = '`CART_ID`'; } if ($this->isColumnModified(CartItemTableMap::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_ID`'; } if ($this->isColumnModified(CartItemTableMap::QUANTITY)) { - $modifiedColumns[':p' . $index++] = 'QUANTITY'; + $modifiedColumns[':p' . $index++] = '`QUANTITY`'; } if ($this->isColumnModified(CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_SALE_ELEMENTS_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_SALE_ELEMENTS_ID`'; } if ($this->isColumnModified(CartItemTableMap::PRICE)) { - $modifiedColumns[':p' . $index++] = 'PRICE'; + $modifiedColumns[':p' . $index++] = '`PRICE`'; } if ($this->isColumnModified(CartItemTableMap::PROMO_PRICE)) { - $modifiedColumns[':p' . $index++] = 'PROMO_PRICE'; + $modifiedColumns[':p' . $index++] = '`PROMO_PRICE`'; } if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) { - $modifiedColumns[':p' . $index++] = 'PRICE_END_OF_LIFE'; - } - if ($this->isColumnModified(CartItemTableMap::DISCOUNT)) { - $modifiedColumns[':p' . $index++] = 'DISCOUNT'; + $modifiedColumns[':p' . $index++] = '`PRICE_END_OF_LIFE`'; } if ($this->isColumnModified(CartItemTableMap::PROMO)) { - $modifiedColumns[':p' . $index++] = 'PROMO'; + $modifiedColumns[':p' . $index++] = '`PROMO`'; } if ($this->isColumnModified(CartItemTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CartItemTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO cart_item (%s) VALUES (%s)', + 'INSERT INTO `cart_item` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1254,40 +1204,37 @@ abstract class CartItem implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CART_ID': + case '`CART_ID`': $stmt->bindValue($identifier, $this->cart_id, PDO::PARAM_INT); break; - case 'PRODUCT_ID': + case '`PRODUCT_ID`': $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); break; - case 'QUANTITY': + case '`QUANTITY`': $stmt->bindValue($identifier, $this->quantity, PDO::PARAM_STR); break; - case 'PRODUCT_SALE_ELEMENTS_ID': + case '`PRODUCT_SALE_ELEMENTS_ID`': $stmt->bindValue($identifier, $this->product_sale_elements_id, PDO::PARAM_INT); break; - case 'PRICE': + case '`PRICE`': $stmt->bindValue($identifier, $this->price, PDO::PARAM_STR); break; - case 'PROMO_PRICE': + case '`PROMO_PRICE`': $stmt->bindValue($identifier, $this->promo_price, PDO::PARAM_STR); break; - case 'PRICE_END_OF_LIFE': + case '`PRICE_END_OF_LIFE`': $stmt->bindValue($identifier, $this->price_end_of_life ? $this->price_end_of_life->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'DISCOUNT': - $stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR); - break; - case 'PROMO': + case '`PROMO`': $stmt->bindValue($identifier, $this->promo, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } @@ -1377,15 +1324,12 @@ abstract class CartItem implements ActiveRecordInterface return $this->getPriceEndOfLife(); break; case 8: - return $this->getDiscount(); - break; - case 9: return $this->getPromo(); break; - case 10: + case 9: return $this->getCreatedAt(); break; - case 11: + case 10: return $this->getUpdatedAt(); break; default: @@ -1425,10 +1369,9 @@ abstract class CartItem implements ActiveRecordInterface $keys[5] => $this->getPrice(), $keys[6] => $this->getPromoPrice(), $keys[7] => $this->getPriceEndOfLife(), - $keys[8] => $this->getDiscount(), - $keys[9] => $this->getPromo(), - $keys[10] => $this->getCreatedAt(), - $keys[11] => $this->getUpdatedAt(), + $keys[8] => $this->getPromo(), + $keys[9] => $this->getCreatedAt(), + $keys[10] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1504,15 +1447,12 @@ abstract class CartItem implements ActiveRecordInterface $this->setPriceEndOfLife($value); break; case 8: - $this->setDiscount($value); - break; - case 9: $this->setPromo($value); break; - case 10: + case 9: $this->setCreatedAt($value); break; - case 11: + case 10: $this->setUpdatedAt($value); break; } // switch() @@ -1547,10 +1487,9 @@ abstract class CartItem implements ActiveRecordInterface if (array_key_exists($keys[5], $arr)) $this->setPrice($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setPromoPrice($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setPriceEndOfLife($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setDiscount($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setPromo($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setUpdatedAt($arr[$keys[11]]); + if (array_key_exists($keys[8], $arr)) $this->setPromo($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]); } /** @@ -1570,7 +1509,6 @@ abstract class CartItem implements ActiveRecordInterface if ($this->isColumnModified(CartItemTableMap::PRICE)) $criteria->add(CartItemTableMap::PRICE, $this->price); if ($this->isColumnModified(CartItemTableMap::PROMO_PRICE)) $criteria->add(CartItemTableMap::PROMO_PRICE, $this->promo_price); if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) $criteria->add(CartItemTableMap::PRICE_END_OF_LIFE, $this->price_end_of_life); - if ($this->isColumnModified(CartItemTableMap::DISCOUNT)) $criteria->add(CartItemTableMap::DISCOUNT, $this->discount); if ($this->isColumnModified(CartItemTableMap::PROMO)) $criteria->add(CartItemTableMap::PROMO, $this->promo); if ($this->isColumnModified(CartItemTableMap::CREATED_AT)) $criteria->add(CartItemTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(CartItemTableMap::UPDATED_AT)) $criteria->add(CartItemTableMap::UPDATED_AT, $this->updated_at); @@ -1644,7 +1582,6 @@ abstract class CartItem implements ActiveRecordInterface $copyObj->setPrice($this->getPrice()); $copyObj->setPromoPrice($this->getPromoPrice()); $copyObj->setPriceEndOfLife($this->getPriceEndOfLife()); - $copyObj->setDiscount($this->getDiscount()); $copyObj->setPromo($this->getPromo()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1842,7 +1779,6 @@ abstract class CartItem implements ActiveRecordInterface $this->price = null; $this->promo_price = null; $this->price_end_of_life = null; - $this->discount = null; $this->promo = null; $this->created_at = null; $this->updated_at = null; diff --git a/core/lib/Thelia/Model/Base/CartItemQuery.php b/core/lib/Thelia/Model/Base/CartItemQuery.php index 79d5d3cfe..9e7e675d1 100644 --- a/core/lib/Thelia/Model/Base/CartItemQuery.php +++ b/core/lib/Thelia/Model/Base/CartItemQuery.php @@ -29,7 +29,6 @@ use Thelia\Model\Map\CartItemTableMap; * @method ChildCartItemQuery orderByPrice($order = Criteria::ASC) Order by the price column * @method ChildCartItemQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column * @method ChildCartItemQuery orderByPriceEndOfLife($order = Criteria::ASC) Order by the price_end_of_life column - * @method ChildCartItemQuery orderByDiscount($order = Criteria::ASC) Order by the discount column * @method ChildCartItemQuery orderByPromo($order = Criteria::ASC) Order by the promo column * @method ChildCartItemQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildCartItemQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column @@ -42,7 +41,6 @@ use Thelia\Model\Map\CartItemTableMap; * @method ChildCartItemQuery groupByPrice() Group by the price column * @method ChildCartItemQuery groupByPromoPrice() Group by the promo_price column * @method ChildCartItemQuery groupByPriceEndOfLife() Group by the price_end_of_life column - * @method ChildCartItemQuery groupByDiscount() Group by the discount column * @method ChildCartItemQuery groupByPromo() Group by the promo column * @method ChildCartItemQuery groupByCreatedAt() Group by the created_at column * @method ChildCartItemQuery groupByUpdatedAt() Group by the updated_at column @@ -74,7 +72,6 @@ use Thelia\Model\Map\CartItemTableMap; * @method ChildCartItem findOneByPrice(double $price) Return the first ChildCartItem filtered by the price column * @method ChildCartItem findOneByPromoPrice(double $promo_price) Return the first ChildCartItem filtered by the promo_price column * @method ChildCartItem findOneByPriceEndOfLife(string $price_end_of_life) Return the first ChildCartItem filtered by the price_end_of_life column - * @method ChildCartItem findOneByDiscount(double $discount) Return the first ChildCartItem filtered by the discount column * @method ChildCartItem findOneByPromo(int $promo) Return the first ChildCartItem filtered by the promo column * @method ChildCartItem findOneByCreatedAt(string $created_at) Return the first ChildCartItem filtered by the created_at column * @method ChildCartItem findOneByUpdatedAt(string $updated_at) Return the first ChildCartItem filtered by the updated_at column @@ -87,7 +84,6 @@ use Thelia\Model\Map\CartItemTableMap; * @method array findByPrice(double $price) Return ChildCartItem objects filtered by the price column * @method array findByPromoPrice(double $promo_price) Return ChildCartItem objects filtered by the promo_price column * @method array findByPriceEndOfLife(string $price_end_of_life) Return ChildCartItem objects filtered by the price_end_of_life column - * @method array findByDiscount(double $discount) Return ChildCartItem objects filtered by the discount column * @method array findByPromo(int $promo) Return ChildCartItem objects filtered by the promo column * @method array findByCreatedAt(string $created_at) Return ChildCartItem objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildCartItem objects filtered by the updated_at column @@ -179,7 +175,7 @@ abstract class CartItemQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CART_ID, PRODUCT_ID, QUANTITY, PRODUCT_SALE_ELEMENTS_ID, PRICE, PROMO_PRICE, PRICE_END_OF_LIFE, DISCOUNT, PROMO, CREATED_AT, UPDATED_AT FROM cart_item WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CART_ID`, `PRODUCT_ID`, `QUANTITY`, `PRODUCT_SALE_ELEMENTS_ID`, `PRICE`, `PROMO_PRICE`, `PRICE_END_OF_LIFE`, `PROMO`, `CREATED_AT`, `UPDATED_AT` FROM `cart_item` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -604,47 +600,6 @@ abstract class CartItemQuery extends ModelCriteria return $this->addUsingAlias(CartItemTableMap::PRICE_END_OF_LIFE, $priceEndOfLife, $comparison); } - /** - * Filter the query on the discount column - * - * Example usage: - * - * $query->filterByDiscount(1234); // WHERE discount = 1234 - * $query->filterByDiscount(array(12, 34)); // WHERE discount IN (12, 34) - * $query->filterByDiscount(array('min' => 12)); // WHERE discount > 12 - * - * - * @param mixed $discount The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCartItemQuery The current query, for fluid interface - */ - public function filterByDiscount($discount = null, $comparison = null) - { - if (is_array($discount)) { - $useMinMax = false; - if (isset($discount['min'])) { - $this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($discount['max'])) { - $this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount, $comparison); - } - /** * Filter the query on the promo column * diff --git a/core/lib/Thelia/Model/Base/CartQuery.php b/core/lib/Thelia/Model/Base/CartQuery.php index 2628aa893..9fbd97a12 100644 --- a/core/lib/Thelia/Model/Base/CartQuery.php +++ b/core/lib/Thelia/Model/Base/CartQuery.php @@ -175,7 +175,7 @@ abstract class CartQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, TOKEN, CUSTOMER_ID, ADDRESS_DELIVERY_ID, ADDRESS_INVOICE_ID, CURRENCY_ID, DISCOUNT, CREATED_AT, UPDATED_AT FROM cart WHERE ID = :p0'; + $sql = 'SELECT `ID`, `TOKEN`, `CUSTOMER_ID`, `ADDRESS_DELIVERY_ID`, `ADDRESS_INVOICE_ID`, `CURRENCY_ID`, `DISCOUNT`, `CREATED_AT`, `UPDATED_AT` FROM `cart` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Category.php b/core/lib/Thelia/Model/Base/Category.php index aacf774c0..8b3cbceaf 100644 --- a/core/lib/Thelia/Model/Base/Category.php +++ b/core/lib/Thelia/Model/Base/Category.php @@ -1283,35 +1283,35 @@ abstract class Category implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CategoryTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CategoryTableMap::PARENT)) { - $modifiedColumns[':p' . $index++] = 'PARENT'; + $modifiedColumns[':p' . $index++] = '`PARENT`'; } if ($this->isColumnModified(CategoryTableMap::VISIBLE)) { - $modifiedColumns[':p' . $index++] = 'VISIBLE'; + $modifiedColumns[':p' . $index++] = '`VISIBLE`'; } if ($this->isColumnModified(CategoryTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(CategoryTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CategoryTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(CategoryTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(CategoryTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(CategoryTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO category (%s) VALUES (%s)', + 'INSERT INTO `category` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1320,31 +1320,31 @@ abstract class Category implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PARENT': + case '`PARENT`': $stmt->bindValue($identifier, $this->parent, PDO::PARAM_INT); break; - case 'VISIBLE': + case '`VISIBLE`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php b/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php index 8079eb563..31f7b0b6e 100644 --- a/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php +++ b/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php @@ -904,26 +904,26 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CategoryAssociatedContentTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CategoryAssociatedContentTableMap::CATEGORY_ID)) { - $modifiedColumns[':p' . $index++] = 'CATEGORY_ID'; + $modifiedColumns[':p' . $index++] = '`CATEGORY_ID`'; } if ($this->isColumnModified(CategoryAssociatedContentTableMap::CONTENT_ID)) { - $modifiedColumns[':p' . $index++] = 'CONTENT_ID'; + $modifiedColumns[':p' . $index++] = '`CONTENT_ID`'; } if ($this->isColumnModified(CategoryAssociatedContentTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(CategoryAssociatedContentTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CategoryAssociatedContentTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO category_associated_content (%s) VALUES (%s)', + 'INSERT INTO `category_associated_content` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -932,22 +932,22 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CATEGORY_ID': + case '`CATEGORY_ID`': $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); break; - case 'CONTENT_ID': + case '`CONTENT_ID`': $stmt->bindValue($identifier, $this->content_id, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php b/core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php index bb03306f4..dd5238d83 100644 --- a/core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php @@ -151,7 +151,7 @@ abstract class CategoryAssociatedContentQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CATEGORY_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM category_associated_content WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CATEGORY_ID`, `CONTENT_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `category_associated_content` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CategoryDocument.php b/core/lib/Thelia/Model/Base/CategoryDocument.php index 83660e717..c39cf631a 100644 --- a/core/lib/Thelia/Model/Base/CategoryDocument.php +++ b/core/lib/Thelia/Model/Base/CategoryDocument.php @@ -930,26 +930,26 @@ abstract class CategoryDocument implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CategoryDocumentTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CategoryDocumentTableMap::CATEGORY_ID)) { - $modifiedColumns[':p' . $index++] = 'CATEGORY_ID'; + $modifiedColumns[':p' . $index++] = '`CATEGORY_ID`'; } if ($this->isColumnModified(CategoryDocumentTableMap::FILE)) { - $modifiedColumns[':p' . $index++] = 'FILE'; + $modifiedColumns[':p' . $index++] = '`FILE`'; } if ($this->isColumnModified(CategoryDocumentTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(CategoryDocumentTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CategoryDocumentTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO category_document (%s) VALUES (%s)', + 'INSERT INTO `category_document` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -958,22 +958,22 @@ abstract class CategoryDocument implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CATEGORY_ID': + case '`CATEGORY_ID`': $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); break; - case 'FILE': + case '`FILE`': $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php b/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php index c4348da52..24f29f985 100644 --- a/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php @@ -858,26 +858,26 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CategoryDocumentI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CategoryDocumentI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(CategoryDocumentI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(CategoryDocumentI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(CategoryDocumentI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(CategoryDocumentI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO category_document_i18n (%s) VALUES (%s)', + 'INSERT INTO `category_document_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CategoryDocumentI18nQuery.php b/core/lib/Thelia/Model/Base/CategoryDocumentI18nQuery.php index a8c6000dc..d9dc050aa 100644 --- a/core/lib/Thelia/Model/Base/CategoryDocumentI18nQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryDocumentI18nQuery.php @@ -147,7 +147,7 @@ abstract class CategoryDocumentI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM category_document_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `category_document_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CategoryDocumentQuery.php b/core/lib/Thelia/Model/Base/CategoryDocumentQuery.php index 8c0a177ac..55fb01406 100644 --- a/core/lib/Thelia/Model/Base/CategoryDocumentQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryDocumentQuery.php @@ -152,7 +152,7 @@ abstract class CategoryDocumentQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CATEGORY_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM category_document WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CATEGORY_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `category_document` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CategoryI18n.php b/core/lib/Thelia/Model/Base/CategoryI18n.php index 0eb196d29..873d152a1 100644 --- a/core/lib/Thelia/Model/Base/CategoryI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryI18n.php @@ -981,35 +981,35 @@ abstract class CategoryI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CategoryI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CategoryI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(CategoryI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(CategoryI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(CategoryI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(CategoryI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } if ($this->isColumnModified(CategoryI18nTableMap::META_TITLE)) { - $modifiedColumns[':p' . $index++] = 'META_TITLE'; + $modifiedColumns[':p' . $index++] = '`META_TITLE`'; } if ($this->isColumnModified(CategoryI18nTableMap::META_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'META_DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`META_DESCRIPTION`'; } if ($this->isColumnModified(CategoryI18nTableMap::META_KEYWORDS)) { - $modifiedColumns[':p' . $index++] = 'META_KEYWORDS'; + $modifiedColumns[':p' . $index++] = '`META_KEYWORDS`'; } $sql = sprintf( - 'INSERT INTO category_i18n (%s) VALUES (%s)', + 'INSERT INTO `category_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1018,31 +1018,31 @@ abstract class CategoryI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; - case 'META_TITLE': + case '`META_TITLE`': $stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR); break; - case 'META_DESCRIPTION': + case '`META_DESCRIPTION`': $stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR); break; - case 'META_KEYWORDS': + case '`META_KEYWORDS`': $stmt->bindValue($identifier, $this->meta_keywords, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CategoryI18nQuery.php b/core/lib/Thelia/Model/Base/CategoryI18nQuery.php index 44ef90de3..68a692f2d 100644 --- a/core/lib/Thelia/Model/Base/CategoryI18nQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryI18nQuery.php @@ -159,7 +159,7 @@ abstract class CategoryI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM category_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `META_TITLE`, `META_DESCRIPTION`, `META_KEYWORDS` FROM `category_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CategoryImage.php b/core/lib/Thelia/Model/Base/CategoryImage.php index 2a7e826c7..04963495f 100644 --- a/core/lib/Thelia/Model/Base/CategoryImage.php +++ b/core/lib/Thelia/Model/Base/CategoryImage.php @@ -930,26 +930,26 @@ abstract class CategoryImage implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CategoryImageTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CategoryImageTableMap::CATEGORY_ID)) { - $modifiedColumns[':p' . $index++] = 'CATEGORY_ID'; + $modifiedColumns[':p' . $index++] = '`CATEGORY_ID`'; } if ($this->isColumnModified(CategoryImageTableMap::FILE)) { - $modifiedColumns[':p' . $index++] = 'FILE'; + $modifiedColumns[':p' . $index++] = '`FILE`'; } if ($this->isColumnModified(CategoryImageTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(CategoryImageTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CategoryImageTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO category_image (%s) VALUES (%s)', + 'INSERT INTO `category_image` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -958,22 +958,22 @@ abstract class CategoryImage implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CATEGORY_ID': + case '`CATEGORY_ID`': $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); break; - case 'FILE': + case '`FILE`': $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CategoryImageI18n.php b/core/lib/Thelia/Model/Base/CategoryImageI18n.php index 1197930c8..73b9e6037 100644 --- a/core/lib/Thelia/Model/Base/CategoryImageI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryImageI18n.php @@ -858,26 +858,26 @@ abstract class CategoryImageI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CategoryImageI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CategoryImageI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(CategoryImageI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(CategoryImageI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(CategoryImageI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(CategoryImageI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO category_image_i18n (%s) VALUES (%s)', + 'INSERT INTO `category_image_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class CategoryImageI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CategoryImageI18nQuery.php b/core/lib/Thelia/Model/Base/CategoryImageI18nQuery.php index 6d552e808..424a478cf 100644 --- a/core/lib/Thelia/Model/Base/CategoryImageI18nQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryImageI18nQuery.php @@ -147,7 +147,7 @@ abstract class CategoryImageI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM category_image_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `category_image_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CategoryImageQuery.php b/core/lib/Thelia/Model/Base/CategoryImageQuery.php index 2130e757b..af219e055 100644 --- a/core/lib/Thelia/Model/Base/CategoryImageQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryImageQuery.php @@ -152,7 +152,7 @@ abstract class CategoryImageQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CATEGORY_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM category_image WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CATEGORY_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `category_image` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CategoryQuery.php b/core/lib/Thelia/Model/Base/CategoryQuery.php index 4ef552094..5cd4bc8f9 100644 --- a/core/lib/Thelia/Model/Base/CategoryQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryQuery.php @@ -187,7 +187,7 @@ abstract class CategoryQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PARENT, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM category WHERE ID = :p0'; + $sql = 'SELECT `ID`, `PARENT`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `category` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CategoryVersion.php b/core/lib/Thelia/Model/Base/CategoryVersion.php index 7abd40b21..110844ba0 100644 --- a/core/lib/Thelia/Model/Base/CategoryVersion.php +++ b/core/lib/Thelia/Model/Base/CategoryVersion.php @@ -1019,35 +1019,35 @@ abstract class CategoryVersion implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CategoryVersionTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CategoryVersionTableMap::PARENT)) { - $modifiedColumns[':p' . $index++] = 'PARENT'; + $modifiedColumns[':p' . $index++] = '`PARENT`'; } if ($this->isColumnModified(CategoryVersionTableMap::VISIBLE)) { - $modifiedColumns[':p' . $index++] = 'VISIBLE'; + $modifiedColumns[':p' . $index++] = '`VISIBLE`'; } if ($this->isColumnModified(CategoryVersionTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(CategoryVersionTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CategoryVersionTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(CategoryVersionTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(CategoryVersionTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(CategoryVersionTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO category_version (%s) VALUES (%s)', + 'INSERT INTO `category_version` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1056,31 +1056,31 @@ abstract class CategoryVersion implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PARENT': + case '`PARENT`': $stmt->bindValue($identifier, $this->parent, PDO::PARAM_INT); break; - case 'VISIBLE': + case '`VISIBLE`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CategoryVersionQuery.php b/core/lib/Thelia/Model/Base/CategoryVersionQuery.php index 88c4f460a..a51640003 100644 --- a/core/lib/Thelia/Model/Base/CategoryVersionQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryVersionQuery.php @@ -159,7 +159,7 @@ abstract class CategoryVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PARENT, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM category_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT `ID`, `PARENT`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `category_version` WHERE `ID` = :p0 AND `VERSION` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Config.php b/core/lib/Thelia/Model/Base/Config.php index 72837ec39..b7ca01d01 100644 --- a/core/lib/Thelia/Model/Base/Config.php +++ b/core/lib/Thelia/Model/Base/Config.php @@ -968,29 +968,29 @@ abstract class Config implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ConfigTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ConfigTableMap::NAME)) { - $modifiedColumns[':p' . $index++] = 'NAME'; + $modifiedColumns[':p' . $index++] = '`NAME`'; } if ($this->isColumnModified(ConfigTableMap::VALUE)) { - $modifiedColumns[':p' . $index++] = 'VALUE'; + $modifiedColumns[':p' . $index++] = '`VALUE`'; } if ($this->isColumnModified(ConfigTableMap::SECURED)) { - $modifiedColumns[':p' . $index++] = 'SECURED'; + $modifiedColumns[':p' . $index++] = '`SECURED`'; } if ($this->isColumnModified(ConfigTableMap::HIDDEN)) { - $modifiedColumns[':p' . $index++] = 'HIDDEN'; + $modifiedColumns[':p' . $index++] = '`HIDDEN`'; } if ($this->isColumnModified(ConfigTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ConfigTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO config (%s) VALUES (%s)', + 'INSERT INTO `config` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -999,25 +999,25 @@ abstract class Config implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'NAME': + case '`NAME`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; - case 'VALUE': + case '`VALUE`': $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); break; - case 'SECURED': + case '`SECURED`': $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT); break; - case 'HIDDEN': + case '`HIDDEN`': $stmt->bindValue($identifier, $this->hidden, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ConfigI18n.php b/core/lib/Thelia/Model/Base/ConfigI18n.php index 370860b61..d5a976276 100644 --- a/core/lib/Thelia/Model/Base/ConfigI18n.php +++ b/core/lib/Thelia/Model/Base/ConfigI18n.php @@ -858,26 +858,26 @@ abstract class ConfigI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ConfigI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ConfigI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ConfigI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ConfigI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ConfigI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ConfigI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO config_i18n (%s) VALUES (%s)', + 'INSERT INTO `config_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class ConfigI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ConfigI18nQuery.php b/core/lib/Thelia/Model/Base/ConfigI18nQuery.php index bc231b05c..b10bb1da3 100644 --- a/core/lib/Thelia/Model/Base/ConfigI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ConfigI18nQuery.php @@ -147,7 +147,7 @@ abstract class ConfigI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM config_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `config_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ConfigQuery.php b/core/lib/Thelia/Model/Base/ConfigQuery.php index ef47308a4..d219bb4a2 100644 --- a/core/lib/Thelia/Model/Base/ConfigQuery.php +++ b/core/lib/Thelia/Model/Base/ConfigQuery.php @@ -152,7 +152,7 @@ abstract class ConfigQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, NAME, VALUE, SECURED, HIDDEN, CREATED_AT, UPDATED_AT FROM config WHERE ID = :p0'; + $sql = 'SELECT `ID`, `NAME`, `VALUE`, `SECURED`, `HIDDEN`, `CREATED_AT`, `UPDATED_AT` FROM `config` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Content.php b/core/lib/Thelia/Model/Base/Content.php index 6618ae9c7..1e6165d3e 100644 --- a/core/lib/Thelia/Model/Base/Content.php +++ b/core/lib/Thelia/Model/Base/Content.php @@ -1275,32 +1275,32 @@ abstract class Content implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ContentTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ContentTableMap::VISIBLE)) { - $modifiedColumns[':p' . $index++] = 'VISIBLE'; + $modifiedColumns[':p' . $index++] = '`VISIBLE`'; } if ($this->isColumnModified(ContentTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ContentTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ContentTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(ContentTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(ContentTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(ContentTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO content (%s) VALUES (%s)', + 'INSERT INTO `content` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1309,28 +1309,28 @@ abstract class Content implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'VISIBLE': + case '`VISIBLE`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ContentDocument.php b/core/lib/Thelia/Model/Base/ContentDocument.php index f59b52af0..382154637 100644 --- a/core/lib/Thelia/Model/Base/ContentDocument.php +++ b/core/lib/Thelia/Model/Base/ContentDocument.php @@ -930,26 +930,26 @@ abstract class ContentDocument implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ContentDocumentTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ContentDocumentTableMap::CONTENT_ID)) { - $modifiedColumns[':p' . $index++] = 'CONTENT_ID'; + $modifiedColumns[':p' . $index++] = '`CONTENT_ID`'; } if ($this->isColumnModified(ContentDocumentTableMap::FILE)) { - $modifiedColumns[':p' . $index++] = 'FILE'; + $modifiedColumns[':p' . $index++] = '`FILE`'; } if ($this->isColumnModified(ContentDocumentTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ContentDocumentTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ContentDocumentTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO content_document (%s) VALUES (%s)', + 'INSERT INTO `content_document` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -958,22 +958,22 @@ abstract class ContentDocument implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CONTENT_ID': + case '`CONTENT_ID`': $stmt->bindValue($identifier, $this->content_id, PDO::PARAM_INT); break; - case 'FILE': + case '`FILE`': $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ContentDocumentI18n.php b/core/lib/Thelia/Model/Base/ContentDocumentI18n.php index e51c76524..22139cd78 100644 --- a/core/lib/Thelia/Model/Base/ContentDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/ContentDocumentI18n.php @@ -858,26 +858,26 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ContentDocumentI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ContentDocumentI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ContentDocumentI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ContentDocumentI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ContentDocumentI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ContentDocumentI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO content_document_i18n (%s) VALUES (%s)', + 'INSERT INTO `content_document_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ContentDocumentI18nQuery.php b/core/lib/Thelia/Model/Base/ContentDocumentI18nQuery.php index e88858892..67ef58154 100644 --- a/core/lib/Thelia/Model/Base/ContentDocumentI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ContentDocumentI18nQuery.php @@ -147,7 +147,7 @@ abstract class ContentDocumentI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM content_document_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `content_document_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ContentDocumentQuery.php b/core/lib/Thelia/Model/Base/ContentDocumentQuery.php index 89cf5d48b..f6e09b426 100644 --- a/core/lib/Thelia/Model/Base/ContentDocumentQuery.php +++ b/core/lib/Thelia/Model/Base/ContentDocumentQuery.php @@ -152,7 +152,7 @@ abstract class ContentDocumentQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CONTENT_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM content_document WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CONTENT_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `content_document` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ContentFolder.php b/core/lib/Thelia/Model/Base/ContentFolder.php index 8200b942c..2e4525e28 100644 --- a/core/lib/Thelia/Model/Base/ContentFolder.php +++ b/core/lib/Thelia/Model/Base/ContentFolder.php @@ -867,23 +867,23 @@ abstract class ContentFolder implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ContentFolderTableMap::CONTENT_ID)) { - $modifiedColumns[':p' . $index++] = 'CONTENT_ID'; + $modifiedColumns[':p' . $index++] = '`CONTENT_ID`'; } if ($this->isColumnModified(ContentFolderTableMap::FOLDER_ID)) { - $modifiedColumns[':p' . $index++] = 'FOLDER_ID'; + $modifiedColumns[':p' . $index++] = '`FOLDER_ID`'; } if ($this->isColumnModified(ContentFolderTableMap::DEFAULT_FOLDER)) { - $modifiedColumns[':p' . $index++] = 'DEFAULT_FOLDER'; + $modifiedColumns[':p' . $index++] = '`DEFAULT_FOLDER`'; } if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ContentFolderTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO content_folder (%s) VALUES (%s)', + 'INSERT INTO `content_folder` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -892,19 +892,19 @@ abstract class ContentFolder implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'CONTENT_ID': + case '`CONTENT_ID`': $stmt->bindValue($identifier, $this->content_id, PDO::PARAM_INT); break; - case 'FOLDER_ID': + case '`FOLDER_ID`': $stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT); break; - case 'DEFAULT_FOLDER': + case '`DEFAULT_FOLDER`': $stmt->bindValue($identifier, (int) $this->default_folder, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ContentFolderQuery.php b/core/lib/Thelia/Model/Base/ContentFolderQuery.php index 72561ae77..4aa4e26df 100644 --- a/core/lib/Thelia/Model/Base/ContentFolderQuery.php +++ b/core/lib/Thelia/Model/Base/ContentFolderQuery.php @@ -147,7 +147,7 @@ abstract class ContentFolderQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT CONTENT_ID, FOLDER_ID, DEFAULT_FOLDER, CREATED_AT, UPDATED_AT FROM content_folder WHERE CONTENT_ID = :p0 AND FOLDER_ID = :p1'; + $sql = 'SELECT `CONTENT_ID`, `FOLDER_ID`, `DEFAULT_FOLDER`, `CREATED_AT`, `UPDATED_AT` FROM `content_folder` WHERE `CONTENT_ID` = :p0 AND `FOLDER_ID` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ContentI18n.php b/core/lib/Thelia/Model/Base/ContentI18n.php index 5b5dd2459..706f8a714 100644 --- a/core/lib/Thelia/Model/Base/ContentI18n.php +++ b/core/lib/Thelia/Model/Base/ContentI18n.php @@ -981,35 +981,35 @@ abstract class ContentI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ContentI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ContentI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ContentI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ContentI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ContentI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ContentI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } if ($this->isColumnModified(ContentI18nTableMap::META_TITLE)) { - $modifiedColumns[':p' . $index++] = 'META_TITLE'; + $modifiedColumns[':p' . $index++] = '`META_TITLE`'; } if ($this->isColumnModified(ContentI18nTableMap::META_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'META_DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`META_DESCRIPTION`'; } if ($this->isColumnModified(ContentI18nTableMap::META_KEYWORDS)) { - $modifiedColumns[':p' . $index++] = 'META_KEYWORDS'; + $modifiedColumns[':p' . $index++] = '`META_KEYWORDS`'; } $sql = sprintf( - 'INSERT INTO content_i18n (%s) VALUES (%s)', + 'INSERT INTO `content_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1018,31 +1018,31 @@ abstract class ContentI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; - case 'META_TITLE': + case '`META_TITLE`': $stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR); break; - case 'META_DESCRIPTION': + case '`META_DESCRIPTION`': $stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR); break; - case 'META_KEYWORDS': + case '`META_KEYWORDS`': $stmt->bindValue($identifier, $this->meta_keywords, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ContentI18nQuery.php b/core/lib/Thelia/Model/Base/ContentI18nQuery.php index ed844f4c2..c2b1dc15b 100644 --- a/core/lib/Thelia/Model/Base/ContentI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ContentI18nQuery.php @@ -159,7 +159,7 @@ abstract class ContentI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM content_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `META_TITLE`, `META_DESCRIPTION`, `META_KEYWORDS` FROM `content_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ContentImage.php b/core/lib/Thelia/Model/Base/ContentImage.php index 17fa9d1f8..0dd622743 100644 --- a/core/lib/Thelia/Model/Base/ContentImage.php +++ b/core/lib/Thelia/Model/Base/ContentImage.php @@ -930,26 +930,26 @@ abstract class ContentImage implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ContentImageTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ContentImageTableMap::CONTENT_ID)) { - $modifiedColumns[':p' . $index++] = 'CONTENT_ID'; + $modifiedColumns[':p' . $index++] = '`CONTENT_ID`'; } if ($this->isColumnModified(ContentImageTableMap::FILE)) { - $modifiedColumns[':p' . $index++] = 'FILE'; + $modifiedColumns[':p' . $index++] = '`FILE`'; } if ($this->isColumnModified(ContentImageTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ContentImageTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ContentImageTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO content_image (%s) VALUES (%s)', + 'INSERT INTO `content_image` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -958,22 +958,22 @@ abstract class ContentImage implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CONTENT_ID': + case '`CONTENT_ID`': $stmt->bindValue($identifier, $this->content_id, PDO::PARAM_INT); break; - case 'FILE': + case '`FILE`': $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ContentImageI18n.php b/core/lib/Thelia/Model/Base/ContentImageI18n.php index dcee14315..996ce8b5c 100644 --- a/core/lib/Thelia/Model/Base/ContentImageI18n.php +++ b/core/lib/Thelia/Model/Base/ContentImageI18n.php @@ -858,26 +858,26 @@ abstract class ContentImageI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ContentImageI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ContentImageI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ContentImageI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ContentImageI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ContentImageI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ContentImageI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO content_image_i18n (%s) VALUES (%s)', + 'INSERT INTO `content_image_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class ContentImageI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ContentImageI18nQuery.php b/core/lib/Thelia/Model/Base/ContentImageI18nQuery.php index 1807c5bb7..e99e58f37 100644 --- a/core/lib/Thelia/Model/Base/ContentImageI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ContentImageI18nQuery.php @@ -147,7 +147,7 @@ abstract class ContentImageI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM content_image_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `content_image_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ContentImageQuery.php b/core/lib/Thelia/Model/Base/ContentImageQuery.php index f69464dd7..339bdfc55 100644 --- a/core/lib/Thelia/Model/Base/ContentImageQuery.php +++ b/core/lib/Thelia/Model/Base/ContentImageQuery.php @@ -152,7 +152,7 @@ abstract class ContentImageQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CONTENT_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM content_image WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CONTENT_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `content_image` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ContentQuery.php b/core/lib/Thelia/Model/Base/ContentQuery.php index 0dc2f57a4..0cbd7191d 100644 --- a/core/lib/Thelia/Model/Base/ContentQuery.php +++ b/core/lib/Thelia/Model/Base/ContentQuery.php @@ -187,7 +187,7 @@ abstract class ContentQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM content WHERE ID = :p0'; + $sql = 'SELECT `ID`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `content` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ContentVersion.php b/core/lib/Thelia/Model/Base/ContentVersion.php index beb02456e..f4190b659 100644 --- a/core/lib/Thelia/Model/Base/ContentVersion.php +++ b/core/lib/Thelia/Model/Base/ContentVersion.php @@ -978,32 +978,32 @@ abstract class ContentVersion implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ContentVersionTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ContentVersionTableMap::VISIBLE)) { - $modifiedColumns[':p' . $index++] = 'VISIBLE'; + $modifiedColumns[':p' . $index++] = '`VISIBLE`'; } if ($this->isColumnModified(ContentVersionTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ContentVersionTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ContentVersionTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(ContentVersionTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(ContentVersionTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(ContentVersionTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO content_version (%s) VALUES (%s)', + 'INSERT INTO `content_version` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1012,28 +1012,28 @@ abstract class ContentVersion implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'VISIBLE': + case '`VISIBLE`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ContentVersionQuery.php b/core/lib/Thelia/Model/Base/ContentVersionQuery.php index ae737d96e..6e8481c99 100644 --- a/core/lib/Thelia/Model/Base/ContentVersionQuery.php +++ b/core/lib/Thelia/Model/Base/ContentVersionQuery.php @@ -155,7 +155,7 @@ abstract class ContentVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM content_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT `ID`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `content_version` WHERE `ID` = :p0 AND `VERSION` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Country.php b/core/lib/Thelia/Model/Base/Country.php index 299b3e511..288ad7128 100644 --- a/core/lib/Thelia/Model/Base/Country.php +++ b/core/lib/Thelia/Model/Base/Country.php @@ -1151,35 +1151,35 @@ abstract class Country implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CountryTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CountryTableMap::AREA_ID)) { - $modifiedColumns[':p' . $index++] = 'AREA_ID'; + $modifiedColumns[':p' . $index++] = '`AREA_ID`'; } if ($this->isColumnModified(CountryTableMap::ISOCODE)) { - $modifiedColumns[':p' . $index++] = 'ISOCODE'; + $modifiedColumns[':p' . $index++] = '`ISOCODE`'; } if ($this->isColumnModified(CountryTableMap::ISOALPHA2)) { - $modifiedColumns[':p' . $index++] = 'ISOALPHA2'; + $modifiedColumns[':p' . $index++] = '`ISOALPHA2`'; } if ($this->isColumnModified(CountryTableMap::ISOALPHA3)) { - $modifiedColumns[':p' . $index++] = 'ISOALPHA3'; + $modifiedColumns[':p' . $index++] = '`ISOALPHA3`'; } if ($this->isColumnModified(CountryTableMap::BY_DEFAULT)) { - $modifiedColumns[':p' . $index++] = 'BY_DEFAULT'; + $modifiedColumns[':p' . $index++] = '`BY_DEFAULT`'; } if ($this->isColumnModified(CountryTableMap::SHOP_COUNTRY)) { - $modifiedColumns[':p' . $index++] = 'SHOP_COUNTRY'; + $modifiedColumns[':p' . $index++] = '`SHOP_COUNTRY`'; } if ($this->isColumnModified(CountryTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CountryTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO country (%s) VALUES (%s)', + 'INSERT INTO `country` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1188,31 +1188,31 @@ abstract class Country implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'AREA_ID': + case '`AREA_ID`': $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT); break; - case 'ISOCODE': + case '`ISOCODE`': $stmt->bindValue($identifier, $this->isocode, PDO::PARAM_STR); break; - case 'ISOALPHA2': + case '`ISOALPHA2`': $stmt->bindValue($identifier, $this->isoalpha2, PDO::PARAM_STR); break; - case 'ISOALPHA3': + case '`ISOALPHA3`': $stmt->bindValue($identifier, $this->isoalpha3, PDO::PARAM_STR); break; - case 'BY_DEFAULT': + case '`BY_DEFAULT`': $stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT); break; - case 'SHOP_COUNTRY': + case '`SHOP_COUNTRY`': $stmt->bindValue($identifier, (int) $this->shop_country, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CountryI18n.php b/core/lib/Thelia/Model/Base/CountryI18n.php index 2c660e200..16fcf0d0f 100644 --- a/core/lib/Thelia/Model/Base/CountryI18n.php +++ b/core/lib/Thelia/Model/Base/CountryI18n.php @@ -858,26 +858,26 @@ abstract class CountryI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CountryI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CountryI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(CountryI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(CountryI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(CountryI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(CountryI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO country_i18n (%s) VALUES (%s)', + 'INSERT INTO `country_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class CountryI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CountryI18nQuery.php b/core/lib/Thelia/Model/Base/CountryI18nQuery.php index 924ed263a..81ea2b508 100644 --- a/core/lib/Thelia/Model/Base/CountryI18nQuery.php +++ b/core/lib/Thelia/Model/Base/CountryI18nQuery.php @@ -147,7 +147,7 @@ abstract class CountryI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM country_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `country_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CountryQuery.php b/core/lib/Thelia/Model/Base/CountryQuery.php index 9135e293a..270802f07 100644 --- a/core/lib/Thelia/Model/Base/CountryQuery.php +++ b/core/lib/Thelia/Model/Base/CountryQuery.php @@ -172,7 +172,7 @@ abstract class CountryQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, AREA_ID, ISOCODE, ISOALPHA2, ISOALPHA3, BY_DEFAULT, SHOP_COUNTRY, CREATED_AT, UPDATED_AT FROM country WHERE ID = :p0'; + $sql = 'SELECT `ID`, `AREA_ID`, `ISOCODE`, `ISOALPHA2`, `ISOALPHA3`, `BY_DEFAULT`, `SHOP_COUNTRY`, `CREATED_AT`, `UPDATED_AT` FROM `country` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Coupon.php b/core/lib/Thelia/Model/Base/Coupon.php index 012b97313..e664fc623 100644 --- a/core/lib/Thelia/Model/Base/Coupon.php +++ b/core/lib/Thelia/Model/Base/Coupon.php @@ -1393,53 +1393,53 @@ abstract class Coupon implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CouponTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CouponTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + $modifiedColumns[':p' . $index++] = '`CODE`'; } if ($this->isColumnModified(CouponTableMap::TYPE)) { - $modifiedColumns[':p' . $index++] = 'TYPE'; + $modifiedColumns[':p' . $index++] = '`TYPE`'; } if ($this->isColumnModified(CouponTableMap::AMOUNT)) { - $modifiedColumns[':p' . $index++] = 'AMOUNT'; + $modifiedColumns[':p' . $index++] = '`AMOUNT`'; } if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) { - $modifiedColumns[':p' . $index++] = 'IS_ENABLED'; + $modifiedColumns[':p' . $index++] = '`IS_ENABLED`'; } if ($this->isColumnModified(CouponTableMap::EXPIRATION_DATE)) { - $modifiedColumns[':p' . $index++] = 'EXPIRATION_DATE'; + $modifiedColumns[':p' . $index++] = '`EXPIRATION_DATE`'; } if ($this->isColumnModified(CouponTableMap::MAX_USAGE)) { - $modifiedColumns[':p' . $index++] = 'MAX_USAGE'; + $modifiedColumns[':p' . $index++] = '`MAX_USAGE`'; } if ($this->isColumnModified(CouponTableMap::IS_CUMULATIVE)) { - $modifiedColumns[':p' . $index++] = 'IS_CUMULATIVE'; + $modifiedColumns[':p' . $index++] = '`IS_CUMULATIVE`'; } if ($this->isColumnModified(CouponTableMap::IS_REMOVING_POSTAGE)) { - $modifiedColumns[':p' . $index++] = 'IS_REMOVING_POSTAGE'; + $modifiedColumns[':p' . $index++] = '`IS_REMOVING_POSTAGE`'; } if ($this->isColumnModified(CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) { - $modifiedColumns[':p' . $index++] = 'IS_AVAILABLE_ON_SPECIAL_OFFERS'; + $modifiedColumns[':p' . $index++] = '`IS_AVAILABLE_ON_SPECIAL_OFFERS`'; } if ($this->isColumnModified(CouponTableMap::IS_USED)) { - $modifiedColumns[':p' . $index++] = 'IS_USED'; + $modifiedColumns[':p' . $index++] = '`IS_USED`'; } if ($this->isColumnModified(CouponTableMap::SERIALIZED_CONDITIONS)) { - $modifiedColumns[':p' . $index++] = 'SERIALIZED_CONDITIONS'; + $modifiedColumns[':p' . $index++] = '`SERIALIZED_CONDITIONS`'; } if ($this->isColumnModified(CouponTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CouponTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(CouponTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } $sql = sprintf( - 'INSERT INTO coupon (%s) VALUES (%s)', + 'INSERT INTO `coupon` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1448,49 +1448,49 @@ abstract class Coupon implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': + case '`CODE`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'TYPE': + case '`TYPE`': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; - case 'AMOUNT': + case '`AMOUNT`': $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); break; - case 'IS_ENABLED': + case '`IS_ENABLED`': $stmt->bindValue($identifier, (int) $this->is_enabled, PDO::PARAM_INT); break; - case 'EXPIRATION_DATE': + case '`EXPIRATION_DATE`': $stmt->bindValue($identifier, $this->expiration_date ? $this->expiration_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'MAX_USAGE': + case '`MAX_USAGE`': $stmt->bindValue($identifier, $this->max_usage, PDO::PARAM_INT); break; - case 'IS_CUMULATIVE': + case '`IS_CUMULATIVE`': $stmt->bindValue($identifier, (int) $this->is_cumulative, PDO::PARAM_INT); break; - case 'IS_REMOVING_POSTAGE': + case '`IS_REMOVING_POSTAGE`': $stmt->bindValue($identifier, (int) $this->is_removing_postage, PDO::PARAM_INT); break; - case 'IS_AVAILABLE_ON_SPECIAL_OFFERS': + case '`IS_AVAILABLE_ON_SPECIAL_OFFERS`': $stmt->bindValue($identifier, (int) $this->is_available_on_special_offers, PDO::PARAM_INT); break; - case 'IS_USED': + case '`IS_USED`': $stmt->bindValue($identifier, (int) $this->is_used, PDO::PARAM_INT); break; - case 'SERIALIZED_CONDITIONS': + case '`SERIALIZED_CONDITIONS`': $stmt->bindValue($identifier, $this->serialized_conditions, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; } diff --git a/core/lib/Thelia/Model/Base/CouponI18n.php b/core/lib/Thelia/Model/Base/CouponI18n.php index 7bb7d8314..eed23d5fe 100644 --- a/core/lib/Thelia/Model/Base/CouponI18n.php +++ b/core/lib/Thelia/Model/Base/CouponI18n.php @@ -817,23 +817,23 @@ abstract class CouponI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CouponI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CouponI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(CouponI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(CouponI18nTableMap::SHORT_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`SHORT_DESCRIPTION`'; } if ($this->isColumnModified(CouponI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } $sql = sprintf( - 'INSERT INTO coupon_i18n (%s) VALUES (%s)', + 'INSERT INTO `coupon_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -842,19 +842,19 @@ abstract class CouponI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'SHORT_DESCRIPTION': + case '`SHORT_DESCRIPTION`': $stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CouponI18nQuery.php b/core/lib/Thelia/Model/Base/CouponI18nQuery.php index 5dfbdbcdc..217796a80 100644 --- a/core/lib/Thelia/Model/Base/CouponI18nQuery.php +++ b/core/lib/Thelia/Model/Base/CouponI18nQuery.php @@ -143,7 +143,7 @@ abstract class CouponI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, SHORT_DESCRIPTION, DESCRIPTION FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `SHORT_DESCRIPTION`, `DESCRIPTION` FROM `coupon_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CouponOrderQuery.php b/core/lib/Thelia/Model/Base/CouponOrderQuery.php deleted file mode 100644 index 255d69504..000000000 --- a/core/lib/Thelia/Model/Base/CouponOrderQuery.php +++ /dev/null @@ -1,678 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con an optional connection object - * - * @return ChildCouponOrder|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = CouponOrderTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(CouponOrderTableMap::DATABASE_NAME); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object - * - * @return ChildCouponOrder A model object, or null if the key is not found - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT ID, ORDER_ID, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); - } - $obj = null; - if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildCouponOrder(); - $obj->hydrate($row); - CouponOrderTableMap::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object - * - * @return ChildCouponOrder|array|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $dataFetcher = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object - * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if (null === $con) { - $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $dataFetcher = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($dataFetcher); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(CouponOrderTableMap::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(CouponOrderTableMap::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id)) { - $useMinMax = false; - if (isset($id['min'])) { - $this->addUsingAlias(CouponOrderTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($id['max'])) { - $this->addUsingAlias(CouponOrderTableMap::ID, $id['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponOrderTableMap::ID, $id, $comparison); - } - - /** - * Filter the query on the order_id column - * - * Example usage: - * - * $query->filterByOrderId(1234); // WHERE order_id = 1234 - * $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34) - * $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12 - * - * - * @see filterByOrder() - * - * @param mixed $orderId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByOrderId($orderId = null, $comparison = null) - { - if (is_array($orderId)) { - $useMinMax = false; - if (isset($orderId['min'])) { - $this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($orderId['max'])) { - $this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId, $comparison); - } - - /** - * Filter the query on the value column - * - * Example usage: - * - * $query->filterByValue(1234); // WHERE value = 1234 - * $query->filterByValue(array(12, 34)); // WHERE value IN (12, 34) - * $query->filterByValue(array('min' => 12)); // WHERE value > 12 - * - * - * @param mixed $value The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByValue($value = null, $comparison = null) - { - if (is_array($value)) { - $useMinMax = false; - if (isset($value['min'])) { - $this->addUsingAlias(CouponOrderTableMap::VALUE, $value['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($value['max'])) { - $this->addUsingAlias(CouponOrderTableMap::VALUE, $value['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponOrderTableMap::VALUE, $value, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(CouponOrderTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(CouponOrderTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponOrderTableMap::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related \Thelia\Model\Order object - * - * @param \Thelia\Model\Order|ObjectCollection $order The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByOrder($order, $comparison = null) - { - if ($order instanceof \Thelia\Model\Order) { - return $this - ->addUsingAlias(CouponOrderTableMap::ORDER_ID, $order->getId(), $comparison); - } elseif ($order instanceof ObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(CouponOrderTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByOrder() only accepts arguments of type \Thelia\Model\Order or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Order relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Order'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Order'); - } - - return $this; - } - - /** - * Use the Order relation Order object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query - */ - public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinOrder($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery'); - } - - /** - * Exclude object from result - * - * @param ChildCouponOrder $couponOrder Object to remove from the list of results - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function prune($couponOrder = null) - { - if ($couponOrder) { - $this->addUsingAlias(CouponOrderTableMap::ID, $couponOrder->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - /** - * Deletes all rows from the coupon_order table. - * - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - */ - public function doDeleteAll(ConnectionInterface $con = null) - { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += parent::doDeleteAll($con); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CouponOrderTableMap::clearInstancePool(); - CouponOrderTableMap::clearRelatedInstancePool(); - - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $affectedRows; - } - - /** - * Performs a DELETE on the database, given a ChildCouponOrder or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ChildCouponOrder object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public function delete(ConnectionInterface $con = null) - { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME); - } - - $criteria = $this; - - // Set the correct dbName - $criteria->setDbName(CouponOrderTableMap::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - - CouponOrderTableMap::removeInstanceFromPool($criteria); - - $affectedRows += ModelCriteria::delete($con); - CouponOrderTableMap::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(CouponOrderTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(CouponOrderTableMap::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(CouponOrderTableMap::UPDATED_AT); - } - - /** - * Order by create date desc - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(CouponOrderTableMap::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(CouponOrderTableMap::CREATED_AT); - } - -} // CouponOrderQuery diff --git a/core/lib/Thelia/Model/Base/CouponQuery.php b/core/lib/Thelia/Model/Base/CouponQuery.php index d480f06c4..471fc296b 100644 --- a/core/lib/Thelia/Model/Base/CouponQuery.php +++ b/core/lib/Thelia/Model/Base/CouponQuery.php @@ -195,7 +195,7 @@ abstract class CouponQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_ENABLED, EXPIRATION_DATE, MAX_USAGE, IS_CUMULATIVE, IS_REMOVING_POSTAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, IS_USED, SERIALIZED_CONDITIONS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CODE`, `TYPE`, `AMOUNT`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CouponVersion.php b/core/lib/Thelia/Model/Base/CouponVersion.php index 67c077cfa..687acabdb 100644 --- a/core/lib/Thelia/Model/Base/CouponVersion.php +++ b/core/lib/Thelia/Model/Base/CouponVersion.php @@ -1305,53 +1305,53 @@ abstract class CouponVersion implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CouponVersionTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CouponVersionTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + $modifiedColumns[':p' . $index++] = '`CODE`'; } if ($this->isColumnModified(CouponVersionTableMap::TYPE)) { - $modifiedColumns[':p' . $index++] = 'TYPE'; + $modifiedColumns[':p' . $index++] = '`TYPE`'; } if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) { - $modifiedColumns[':p' . $index++] = 'AMOUNT'; + $modifiedColumns[':p' . $index++] = '`AMOUNT`'; } if ($this->isColumnModified(CouponVersionTableMap::IS_ENABLED)) { - $modifiedColumns[':p' . $index++] = 'IS_ENABLED'; + $modifiedColumns[':p' . $index++] = '`IS_ENABLED`'; } if ($this->isColumnModified(CouponVersionTableMap::EXPIRATION_DATE)) { - $modifiedColumns[':p' . $index++] = 'EXPIRATION_DATE'; + $modifiedColumns[':p' . $index++] = '`EXPIRATION_DATE`'; } if ($this->isColumnModified(CouponVersionTableMap::MAX_USAGE)) { - $modifiedColumns[':p' . $index++] = 'MAX_USAGE'; + $modifiedColumns[':p' . $index++] = '`MAX_USAGE`'; } if ($this->isColumnModified(CouponVersionTableMap::IS_CUMULATIVE)) { - $modifiedColumns[':p' . $index++] = 'IS_CUMULATIVE'; + $modifiedColumns[':p' . $index++] = '`IS_CUMULATIVE`'; } if ($this->isColumnModified(CouponVersionTableMap::IS_REMOVING_POSTAGE)) { - $modifiedColumns[':p' . $index++] = 'IS_REMOVING_POSTAGE'; + $modifiedColumns[':p' . $index++] = '`IS_REMOVING_POSTAGE`'; } if ($this->isColumnModified(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) { - $modifiedColumns[':p' . $index++] = 'IS_AVAILABLE_ON_SPECIAL_OFFERS'; + $modifiedColumns[':p' . $index++] = '`IS_AVAILABLE_ON_SPECIAL_OFFERS`'; } if ($this->isColumnModified(CouponVersionTableMap::IS_USED)) { - $modifiedColumns[':p' . $index++] = 'IS_USED'; + $modifiedColumns[':p' . $index++] = '`IS_USED`'; } if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_CONDITIONS)) { - $modifiedColumns[':p' . $index++] = 'SERIALIZED_CONDITIONS'; + $modifiedColumns[':p' . $index++] = '`SERIALIZED_CONDITIONS`'; } if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CouponVersionTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(CouponVersionTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } $sql = sprintf( - 'INSERT INTO coupon_version (%s) VALUES (%s)', + 'INSERT INTO `coupon_version` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1360,49 +1360,49 @@ abstract class CouponVersion implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': + case '`CODE`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'TYPE': + case '`TYPE`': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; - case 'AMOUNT': + case '`AMOUNT`': $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); break; - case 'IS_ENABLED': + case '`IS_ENABLED`': $stmt->bindValue($identifier, (int) $this->is_enabled, PDO::PARAM_INT); break; - case 'EXPIRATION_DATE': + case '`EXPIRATION_DATE`': $stmt->bindValue($identifier, $this->expiration_date ? $this->expiration_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'MAX_USAGE': + case '`MAX_USAGE`': $stmt->bindValue($identifier, $this->max_usage, PDO::PARAM_INT); break; - case 'IS_CUMULATIVE': + case '`IS_CUMULATIVE`': $stmt->bindValue($identifier, (int) $this->is_cumulative, PDO::PARAM_INT); break; - case 'IS_REMOVING_POSTAGE': + case '`IS_REMOVING_POSTAGE`': $stmt->bindValue($identifier, (int) $this->is_removing_postage, PDO::PARAM_INT); break; - case 'IS_AVAILABLE_ON_SPECIAL_OFFERS': + case '`IS_AVAILABLE_ON_SPECIAL_OFFERS`': $stmt->bindValue($identifier, (int) $this->is_available_on_special_offers, PDO::PARAM_INT); break; - case 'IS_USED': + case '`IS_USED`': $stmt->bindValue($identifier, (int) $this->is_used, PDO::PARAM_INT); break; - case 'SERIALIZED_CONDITIONS': + case '`SERIALIZED_CONDITIONS`': $stmt->bindValue($identifier, $this->serialized_conditions, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; } diff --git a/core/lib/Thelia/Model/Base/CouponVersionQuery.php b/core/lib/Thelia/Model/Base/CouponVersionQuery.php index eebd85dd9..7ff88c828 100644 --- a/core/lib/Thelia/Model/Base/CouponVersionQuery.php +++ b/core/lib/Thelia/Model/Base/CouponVersionQuery.php @@ -183,7 +183,7 @@ abstract class CouponVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_ENABLED, EXPIRATION_DATE, MAX_USAGE, IS_CUMULATIVE, IS_REMOVING_POSTAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, IS_USED, SERIALIZED_CONDITIONS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT `ID`, `CODE`, `TYPE`, `AMOUNT`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon_version` WHERE `ID` = :p0 AND `VERSION` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Currency.php b/core/lib/Thelia/Model/Base/Currency.php index 2161e4425..d701d0e91 100644 --- a/core/lib/Thelia/Model/Base/Currency.php +++ b/core/lib/Thelia/Model/Base/Currency.php @@ -1084,32 +1084,32 @@ abstract class Currency implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CurrencyTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CurrencyTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + $modifiedColumns[':p' . $index++] = '`CODE`'; } if ($this->isColumnModified(CurrencyTableMap::SYMBOL)) { - $modifiedColumns[':p' . $index++] = 'SYMBOL'; + $modifiedColumns[':p' . $index++] = '`SYMBOL`'; } if ($this->isColumnModified(CurrencyTableMap::RATE)) { - $modifiedColumns[':p' . $index++] = 'RATE'; + $modifiedColumns[':p' . $index++] = '`RATE`'; } if ($this->isColumnModified(CurrencyTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(CurrencyTableMap::BY_DEFAULT)) { - $modifiedColumns[':p' . $index++] = 'BY_DEFAULT'; + $modifiedColumns[':p' . $index++] = '`BY_DEFAULT`'; } if ($this->isColumnModified(CurrencyTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CurrencyTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO currency (%s) VALUES (%s)', + 'INSERT INTO `currency` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1118,28 +1118,28 @@ abstract class Currency implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': + case '`CODE`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'SYMBOL': + case '`SYMBOL`': $stmt->bindValue($identifier, $this->symbol, PDO::PARAM_STR); break; - case 'RATE': + case '`RATE`': $stmt->bindValue($identifier, $this->rate, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'BY_DEFAULT': + case '`BY_DEFAULT`': $stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CurrencyI18n.php b/core/lib/Thelia/Model/Base/CurrencyI18n.php index c3e6af289..671696db9 100644 --- a/core/lib/Thelia/Model/Base/CurrencyI18n.php +++ b/core/lib/Thelia/Model/Base/CurrencyI18n.php @@ -735,17 +735,17 @@ abstract class CurrencyI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CurrencyI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CurrencyI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(CurrencyI18nTableMap::NAME)) { - $modifiedColumns[':p' . $index++] = 'NAME'; + $modifiedColumns[':p' . $index++] = '`NAME`'; } $sql = sprintf( - 'INSERT INTO currency_i18n (%s) VALUES (%s)', + 'INSERT INTO `currency_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -754,13 +754,13 @@ abstract class CurrencyI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'NAME': + case '`NAME`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CurrencyI18nQuery.php b/core/lib/Thelia/Model/Base/CurrencyI18nQuery.php index 33af4ff87..65019d642 100644 --- a/core/lib/Thelia/Model/Base/CurrencyI18nQuery.php +++ b/core/lib/Thelia/Model/Base/CurrencyI18nQuery.php @@ -135,7 +135,7 @@ abstract class CurrencyI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, NAME FROM currency_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `NAME` FROM `currency_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CurrencyQuery.php b/core/lib/Thelia/Model/Base/CurrencyQuery.php index 4276000a1..c6382efba 100644 --- a/core/lib/Thelia/Model/Base/CurrencyQuery.php +++ b/core/lib/Thelia/Model/Base/CurrencyQuery.php @@ -168,7 +168,7 @@ abstract class CurrencyQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, SYMBOL, RATE, POSITION, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM currency WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CODE`, `SYMBOL`, `RATE`, `POSITION`, `BY_DEFAULT`, `CREATED_AT`, `UPDATED_AT` FROM `currency` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Customer.php b/core/lib/Thelia/Model/Base/Customer.php index 857dc5e17..1273b9c02 100644 --- a/core/lib/Thelia/Model/Base/Customer.php +++ b/core/lib/Thelia/Model/Base/Customer.php @@ -1392,56 +1392,56 @@ abstract class Customer implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CustomerTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CustomerTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; + $modifiedColumns[':p' . $index++] = '`REF`'; } if ($this->isColumnModified(CustomerTableMap::TITLE_ID)) { - $modifiedColumns[':p' . $index++] = 'TITLE_ID'; + $modifiedColumns[':p' . $index++] = '`TITLE_ID`'; } if ($this->isColumnModified(CustomerTableMap::FIRSTNAME)) { - $modifiedColumns[':p' . $index++] = 'FIRSTNAME'; + $modifiedColumns[':p' . $index++] = '`FIRSTNAME`'; } if ($this->isColumnModified(CustomerTableMap::LASTNAME)) { - $modifiedColumns[':p' . $index++] = 'LASTNAME'; + $modifiedColumns[':p' . $index++] = '`LASTNAME`'; } if ($this->isColumnModified(CustomerTableMap::EMAIL)) { - $modifiedColumns[':p' . $index++] = 'EMAIL'; + $modifiedColumns[':p' . $index++] = '`EMAIL`'; } if ($this->isColumnModified(CustomerTableMap::PASSWORD)) { - $modifiedColumns[':p' . $index++] = 'PASSWORD'; + $modifiedColumns[':p' . $index++] = '`PASSWORD`'; } if ($this->isColumnModified(CustomerTableMap::ALGO)) { - $modifiedColumns[':p' . $index++] = 'ALGO'; + $modifiedColumns[':p' . $index++] = '`ALGO`'; } if ($this->isColumnModified(CustomerTableMap::RESELLER)) { - $modifiedColumns[':p' . $index++] = 'RESELLER'; + $modifiedColumns[':p' . $index++] = '`RESELLER`'; } if ($this->isColumnModified(CustomerTableMap::LANG)) { - $modifiedColumns[':p' . $index++] = 'LANG'; + $modifiedColumns[':p' . $index++] = '`LANG`'; } if ($this->isColumnModified(CustomerTableMap::SPONSOR)) { - $modifiedColumns[':p' . $index++] = 'SPONSOR'; + $modifiedColumns[':p' . $index++] = '`SPONSOR`'; } if ($this->isColumnModified(CustomerTableMap::DISCOUNT)) { - $modifiedColumns[':p' . $index++] = 'DISCOUNT'; + $modifiedColumns[':p' . $index++] = '`DISCOUNT`'; } if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_TOKEN)) { - $modifiedColumns[':p' . $index++] = 'REMEMBER_ME_TOKEN'; + $modifiedColumns[':p' . $index++] = '`REMEMBER_ME_TOKEN`'; } if ($this->isColumnModified(CustomerTableMap::REMEMBER_ME_SERIAL)) { - $modifiedColumns[':p' . $index++] = 'REMEMBER_ME_SERIAL'; + $modifiedColumns[':p' . $index++] = '`REMEMBER_ME_SERIAL`'; } if ($this->isColumnModified(CustomerTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CustomerTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO customer (%s) VALUES (%s)', + 'INSERT INTO `customer` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1450,52 +1450,52 @@ abstract class Customer implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'REF': + case '`REF`': $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); break; - case 'TITLE_ID': + case '`TITLE_ID`': $stmt->bindValue($identifier, $this->title_id, PDO::PARAM_INT); break; - case 'FIRSTNAME': + case '`FIRSTNAME`': $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); break; - case 'LASTNAME': + case '`LASTNAME`': $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); break; - case 'EMAIL': + case '`EMAIL`': $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR); break; - case 'PASSWORD': + case '`PASSWORD`': $stmt->bindValue($identifier, $this->password, PDO::PARAM_STR); break; - case 'ALGO': + case '`ALGO`': $stmt->bindValue($identifier, $this->algo, PDO::PARAM_STR); break; - case 'RESELLER': + case '`RESELLER`': $stmt->bindValue($identifier, $this->reseller, PDO::PARAM_INT); break; - case 'LANG': + case '`LANG`': $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR); break; - case 'SPONSOR': + case '`SPONSOR`': $stmt->bindValue($identifier, $this->sponsor, PDO::PARAM_STR); break; - case 'DISCOUNT': + case '`DISCOUNT`': $stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR); break; - case 'REMEMBER_ME_TOKEN': + case '`REMEMBER_ME_TOKEN`': $stmt->bindValue($identifier, $this->remember_me_token, PDO::PARAM_STR); break; - case 'REMEMBER_ME_SERIAL': + case '`REMEMBER_ME_SERIAL`': $stmt->bindValue($identifier, $this->remember_me_serial, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CustomerQuery.php b/core/lib/Thelia/Model/Base/CustomerQuery.php index 897bb5ee9..28ccb557b 100644 --- a/core/lib/Thelia/Model/Base/CustomerQuery.php +++ b/core/lib/Thelia/Model/Base/CustomerQuery.php @@ -199,7 +199,7 @@ abstract class CustomerQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, REF, TITLE_ID, FIRSTNAME, LASTNAME, EMAIL, PASSWORD, ALGO, RESELLER, LANG, SPONSOR, DISCOUNT, REMEMBER_ME_TOKEN, REMEMBER_ME_SERIAL, CREATED_AT, UPDATED_AT FROM customer WHERE ID = :p0'; + $sql = 'SELECT `ID`, `REF`, `TITLE_ID`, `FIRSTNAME`, `LASTNAME`, `EMAIL`, `PASSWORD`, `ALGO`, `RESELLER`, `LANG`, `SPONSOR`, `DISCOUNT`, `REMEMBER_ME_TOKEN`, `REMEMBER_ME_SERIAL`, `CREATED_AT`, `UPDATED_AT` FROM `customer` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CustomerTitle.php b/core/lib/Thelia/Model/Base/CustomerTitle.php index 978b779b1..ccf25fa82 100644 --- a/core/lib/Thelia/Model/Base/CustomerTitle.php +++ b/core/lib/Thelia/Model/Base/CustomerTitle.php @@ -946,23 +946,23 @@ abstract class CustomerTitle implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CustomerTitleTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CustomerTitleTableMap::BY_DEFAULT)) { - $modifiedColumns[':p' . $index++] = 'BY_DEFAULT'; + $modifiedColumns[':p' . $index++] = '`BY_DEFAULT`'; } if ($this->isColumnModified(CustomerTitleTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(CustomerTitleTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(CustomerTitleTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO customer_title (%s) VALUES (%s)', + 'INSERT INTO `customer_title` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -971,19 +971,19 @@ abstract class CustomerTitle implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'BY_DEFAULT': + case '`BY_DEFAULT`': $stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CustomerTitleI18n.php b/core/lib/Thelia/Model/Base/CustomerTitleI18n.php index 5c173543b..b0e182acc 100644 --- a/core/lib/Thelia/Model/Base/CustomerTitleI18n.php +++ b/core/lib/Thelia/Model/Base/CustomerTitleI18n.php @@ -776,20 +776,20 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CustomerTitleI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(CustomerTitleI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(CustomerTitleI18nTableMap::SHORT)) { - $modifiedColumns[':p' . $index++] = 'SHORT'; + $modifiedColumns[':p' . $index++] = '`SHORT`'; } if ($this->isColumnModified(CustomerTitleI18nTableMap::LONG)) { - $modifiedColumns[':p' . $index++] = 'LONG'; + $modifiedColumns[':p' . $index++] = '`LONG`'; } $sql = sprintf( - 'INSERT INTO customer_title_i18n (%s) VALUES (%s)', + 'INSERT INTO `customer_title_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -798,16 +798,16 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'SHORT': + case '`SHORT`': $stmt->bindValue($identifier, $this->short, PDO::PARAM_STR); break; - case 'LONG': + case '`LONG`': $stmt->bindValue($identifier, $this->long, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/CustomerTitleI18nQuery.php b/core/lib/Thelia/Model/Base/CustomerTitleI18nQuery.php index 4feeab473..446d44b1f 100644 --- a/core/lib/Thelia/Model/Base/CustomerTitleI18nQuery.php +++ b/core/lib/Thelia/Model/Base/CustomerTitleI18nQuery.php @@ -139,7 +139,7 @@ abstract class CustomerTitleI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, SHORT, LONG FROM customer_title_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `SHORT`, `LONG` FROM `customer_title_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CustomerTitleQuery.php b/core/lib/Thelia/Model/Base/CustomerTitleQuery.php index ea34c8c91..62fa27684 100644 --- a/core/lib/Thelia/Model/Base/CustomerTitleQuery.php +++ b/core/lib/Thelia/Model/Base/CustomerTitleQuery.php @@ -152,7 +152,7 @@ abstract class CustomerTitleQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, BY_DEFAULT, POSITION, CREATED_AT, UPDATED_AT FROM customer_title WHERE ID = :p0'; + $sql = 'SELECT `ID`, `BY_DEFAULT`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `customer_title` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Feature.php b/core/lib/Thelia/Model/Base/Feature.php index 7d3a0e7f3..fbe4448f8 100644 --- a/core/lib/Thelia/Model/Base/Feature.php +++ b/core/lib/Thelia/Model/Base/Feature.php @@ -1020,23 +1020,23 @@ abstract class Feature implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FeatureTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FeatureTableMap::VISIBLE)) { - $modifiedColumns[':p' . $index++] = 'VISIBLE'; + $modifiedColumns[':p' . $index++] = '`VISIBLE`'; } if ($this->isColumnModified(FeatureTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(FeatureTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(FeatureTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO feature (%s) VALUES (%s)', + 'INSERT INTO `feature` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1045,19 +1045,19 @@ abstract class Feature implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'VISIBLE': + case '`VISIBLE`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FeatureAv.php b/core/lib/Thelia/Model/Base/FeatureAv.php index 7f5191418..bc19f98a9 100644 --- a/core/lib/Thelia/Model/Base/FeatureAv.php +++ b/core/lib/Thelia/Model/Base/FeatureAv.php @@ -922,23 +922,23 @@ abstract class FeatureAv implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FeatureAvTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FeatureAvTableMap::FEATURE_ID)) { - $modifiedColumns[':p' . $index++] = 'FEATURE_ID'; + $modifiedColumns[':p' . $index++] = '`FEATURE_ID`'; } if ($this->isColumnModified(FeatureAvTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(FeatureAvTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(FeatureAvTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO feature_av (%s) VALUES (%s)', + 'INSERT INTO `feature_av` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -947,19 +947,19 @@ abstract class FeatureAv implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'FEATURE_ID': + case '`FEATURE_ID`': $stmt->bindValue($identifier, $this->feature_id, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FeatureAvI18n.php b/core/lib/Thelia/Model/Base/FeatureAvI18n.php index e88356a16..658f4fcc4 100644 --- a/core/lib/Thelia/Model/Base/FeatureAvI18n.php +++ b/core/lib/Thelia/Model/Base/FeatureAvI18n.php @@ -858,26 +858,26 @@ abstract class FeatureAvI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FeatureAvI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FeatureAvI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(FeatureAvI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(FeatureAvI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(FeatureAvI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(FeatureAvI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO feature_av_i18n (%s) VALUES (%s)', + 'INSERT INTO `feature_av_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class FeatureAvI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FeatureAvI18nQuery.php b/core/lib/Thelia/Model/Base/FeatureAvI18nQuery.php index bab9fd843..88bb52aa5 100644 --- a/core/lib/Thelia/Model/Base/FeatureAvI18nQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureAvI18nQuery.php @@ -147,7 +147,7 @@ abstract class FeatureAvI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM feature_av_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `feature_av_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FeatureAvQuery.php b/core/lib/Thelia/Model/Base/FeatureAvQuery.php index fb3796c97..3d8d81a4b 100644 --- a/core/lib/Thelia/Model/Base/FeatureAvQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureAvQuery.php @@ -152,7 +152,7 @@ abstract class FeatureAvQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, FEATURE_ID, POSITION, CREATED_AT, UPDATED_AT FROM feature_av WHERE ID = :p0'; + $sql = 'SELECT `ID`, `FEATURE_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `feature_av` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FeatureI18n.php b/core/lib/Thelia/Model/Base/FeatureI18n.php index ed475e87f..f11699fb9 100644 --- a/core/lib/Thelia/Model/Base/FeatureI18n.php +++ b/core/lib/Thelia/Model/Base/FeatureI18n.php @@ -858,26 +858,26 @@ abstract class FeatureI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FeatureI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FeatureI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(FeatureI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(FeatureI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(FeatureI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(FeatureI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO feature_i18n (%s) VALUES (%s)', + 'INSERT INTO `feature_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class FeatureI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FeatureI18nQuery.php b/core/lib/Thelia/Model/Base/FeatureI18nQuery.php index 5f7080be6..33c171127 100644 --- a/core/lib/Thelia/Model/Base/FeatureI18nQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureI18nQuery.php @@ -147,7 +147,7 @@ abstract class FeatureI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM feature_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `feature_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FeatureProduct.php b/core/lib/Thelia/Model/Base/FeatureProduct.php index f8ddbd9b7..151f1cc6a 100644 --- a/core/lib/Thelia/Model/Base/FeatureProduct.php +++ b/core/lib/Thelia/Model/Base/FeatureProduct.php @@ -1008,32 +1008,32 @@ abstract class FeatureProduct implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FeatureProductTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FeatureProductTableMap::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_ID`'; } if ($this->isColumnModified(FeatureProductTableMap::FEATURE_ID)) { - $modifiedColumns[':p' . $index++] = 'FEATURE_ID'; + $modifiedColumns[':p' . $index++] = '`FEATURE_ID`'; } if ($this->isColumnModified(FeatureProductTableMap::FEATURE_AV_ID)) { - $modifiedColumns[':p' . $index++] = 'FEATURE_AV_ID'; + $modifiedColumns[':p' . $index++] = '`FEATURE_AV_ID`'; } if ($this->isColumnModified(FeatureProductTableMap::FREE_TEXT_VALUE)) { - $modifiedColumns[':p' . $index++] = 'FREE_TEXT_VALUE'; + $modifiedColumns[':p' . $index++] = '`FREE_TEXT_VALUE`'; } if ($this->isColumnModified(FeatureProductTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(FeatureProductTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(FeatureProductTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO feature_product (%s) VALUES (%s)', + 'INSERT INTO `feature_product` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1042,28 +1042,28 @@ abstract class FeatureProduct implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PRODUCT_ID': + case '`PRODUCT_ID`': $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); break; - case 'FEATURE_ID': + case '`FEATURE_ID`': $stmt->bindValue($identifier, $this->feature_id, PDO::PARAM_INT); break; - case 'FEATURE_AV_ID': + case '`FEATURE_AV_ID`': $stmt->bindValue($identifier, $this->feature_av_id, PDO::PARAM_INT); break; - case 'FREE_TEXT_VALUE': + case '`FREE_TEXT_VALUE`': $stmt->bindValue($identifier, $this->free_text_value, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FeatureProductQuery.php b/core/lib/Thelia/Model/Base/FeatureProductQuery.php index eb2ee7ec1..b1d46a12f 100644 --- a/core/lib/Thelia/Model/Base/FeatureProductQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureProductQuery.php @@ -163,7 +163,7 @@ abstract class FeatureProductQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PRODUCT_ID, FEATURE_ID, FEATURE_AV_ID, FREE_TEXT_VALUE, POSITION, CREATED_AT, UPDATED_AT FROM feature_product WHERE ID = :p0'; + $sql = 'SELECT `ID`, `PRODUCT_ID`, `FEATURE_ID`, `FEATURE_AV_ID`, `FREE_TEXT_VALUE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `feature_product` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FeatureQuery.php b/core/lib/Thelia/Model/Base/FeatureQuery.php index 097646c87..d6e20ea15 100644 --- a/core/lib/Thelia/Model/Base/FeatureQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureQuery.php @@ -156,7 +156,7 @@ abstract class FeatureQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, VISIBLE, POSITION, CREATED_AT, UPDATED_AT FROM feature WHERE ID = :p0'; + $sql = 'SELECT `ID`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `feature` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FeatureTemplate.php b/core/lib/Thelia/Model/Base/FeatureTemplate.php index bc7b4f921..920c16cde 100644 --- a/core/lib/Thelia/Model/Base/FeatureTemplate.php +++ b/core/lib/Thelia/Model/Base/FeatureTemplate.php @@ -904,26 +904,26 @@ abstract class FeatureTemplate implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FeatureTemplateTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FeatureTemplateTableMap::FEATURE_ID)) { - $modifiedColumns[':p' . $index++] = 'FEATURE_ID'; + $modifiedColumns[':p' . $index++] = '`FEATURE_ID`'; } if ($this->isColumnModified(FeatureTemplateTableMap::TEMPLATE_ID)) { - $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID'; + $modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`'; } if ($this->isColumnModified(FeatureTemplateTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(FeatureTemplateTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(FeatureTemplateTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO feature_template (%s) VALUES (%s)', + 'INSERT INTO `feature_template` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -932,22 +932,22 @@ abstract class FeatureTemplate implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'FEATURE_ID': + case '`FEATURE_ID`': $stmt->bindValue($identifier, $this->feature_id, PDO::PARAM_INT); break; - case 'TEMPLATE_ID': + case '`TEMPLATE_ID`': $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FeatureTemplateQuery.php b/core/lib/Thelia/Model/Base/FeatureTemplateQuery.php index cccad15ae..8b4f0893e 100644 --- a/core/lib/Thelia/Model/Base/FeatureTemplateQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureTemplateQuery.php @@ -151,7 +151,7 @@ abstract class FeatureTemplateQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, FEATURE_ID, TEMPLATE_ID, POSITION, CREATED_AT, UPDATED_AT FROM feature_template WHERE ID = :p0'; + $sql = 'SELECT `ID`, `FEATURE_ID`, `TEMPLATE_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `feature_template` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Folder.php b/core/lib/Thelia/Model/Base/Folder.php index 20a7e8dbc..6b08987e0 100644 --- a/core/lib/Thelia/Model/Base/Folder.php +++ b/core/lib/Thelia/Model/Base/Folder.php @@ -1250,35 +1250,35 @@ abstract class Folder implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FolderTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FolderTableMap::PARENT)) { - $modifiedColumns[':p' . $index++] = 'PARENT'; + $modifiedColumns[':p' . $index++] = '`PARENT`'; } if ($this->isColumnModified(FolderTableMap::VISIBLE)) { - $modifiedColumns[':p' . $index++] = 'VISIBLE'; + $modifiedColumns[':p' . $index++] = '`VISIBLE`'; } if ($this->isColumnModified(FolderTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(FolderTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(FolderTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(FolderTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(FolderTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(FolderTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO folder (%s) VALUES (%s)', + 'INSERT INTO `folder` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1287,31 +1287,31 @@ abstract class Folder implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PARENT': + case '`PARENT`': $stmt->bindValue($identifier, $this->parent, PDO::PARAM_INT); break; - case 'VISIBLE': + case '`VISIBLE`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FolderDocument.php b/core/lib/Thelia/Model/Base/FolderDocument.php index ea1a35d74..abd2b3429 100644 --- a/core/lib/Thelia/Model/Base/FolderDocument.php +++ b/core/lib/Thelia/Model/Base/FolderDocument.php @@ -930,26 +930,26 @@ abstract class FolderDocument implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FolderDocumentTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FolderDocumentTableMap::FOLDER_ID)) { - $modifiedColumns[':p' . $index++] = 'FOLDER_ID'; + $modifiedColumns[':p' . $index++] = '`FOLDER_ID`'; } if ($this->isColumnModified(FolderDocumentTableMap::FILE)) { - $modifiedColumns[':p' . $index++] = 'FILE'; + $modifiedColumns[':p' . $index++] = '`FILE`'; } if ($this->isColumnModified(FolderDocumentTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(FolderDocumentTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(FolderDocumentTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO folder_document (%s) VALUES (%s)', + 'INSERT INTO `folder_document` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -958,22 +958,22 @@ abstract class FolderDocument implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'FOLDER_ID': + case '`FOLDER_ID`': $stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT); break; - case 'FILE': + case '`FILE`': $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FolderDocumentI18n.php b/core/lib/Thelia/Model/Base/FolderDocumentI18n.php index 600890a03..a24ea7482 100644 --- a/core/lib/Thelia/Model/Base/FolderDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/FolderDocumentI18n.php @@ -858,26 +858,26 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FolderDocumentI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FolderDocumentI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(FolderDocumentI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(FolderDocumentI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(FolderDocumentI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(FolderDocumentI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO folder_document_i18n (%s) VALUES (%s)', + 'INSERT INTO `folder_document_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FolderDocumentI18nQuery.php b/core/lib/Thelia/Model/Base/FolderDocumentI18nQuery.php index 073cef92e..f053ac652 100644 --- a/core/lib/Thelia/Model/Base/FolderDocumentI18nQuery.php +++ b/core/lib/Thelia/Model/Base/FolderDocumentI18nQuery.php @@ -147,7 +147,7 @@ abstract class FolderDocumentI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM folder_document_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `folder_document_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FolderDocumentQuery.php b/core/lib/Thelia/Model/Base/FolderDocumentQuery.php index b1c41a29e..c438576a6 100644 --- a/core/lib/Thelia/Model/Base/FolderDocumentQuery.php +++ b/core/lib/Thelia/Model/Base/FolderDocumentQuery.php @@ -152,7 +152,7 @@ abstract class FolderDocumentQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, FOLDER_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM folder_document WHERE ID = :p0'; + $sql = 'SELECT `ID`, `FOLDER_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `folder_document` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FolderI18n.php b/core/lib/Thelia/Model/Base/FolderI18n.php index ec57cff1d..ef0da9d3e 100644 --- a/core/lib/Thelia/Model/Base/FolderI18n.php +++ b/core/lib/Thelia/Model/Base/FolderI18n.php @@ -981,35 +981,35 @@ abstract class FolderI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FolderI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FolderI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(FolderI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(FolderI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(FolderI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(FolderI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } if ($this->isColumnModified(FolderI18nTableMap::META_TITLE)) { - $modifiedColumns[':p' . $index++] = 'META_TITLE'; + $modifiedColumns[':p' . $index++] = '`META_TITLE`'; } if ($this->isColumnModified(FolderI18nTableMap::META_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'META_DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`META_DESCRIPTION`'; } if ($this->isColumnModified(FolderI18nTableMap::META_KEYWORDS)) { - $modifiedColumns[':p' . $index++] = 'META_KEYWORDS'; + $modifiedColumns[':p' . $index++] = '`META_KEYWORDS`'; } $sql = sprintf( - 'INSERT INTO folder_i18n (%s) VALUES (%s)', + 'INSERT INTO `folder_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1018,31 +1018,31 @@ abstract class FolderI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; - case 'META_TITLE': + case '`META_TITLE`': $stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR); break; - case 'META_DESCRIPTION': + case '`META_DESCRIPTION`': $stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR); break; - case 'META_KEYWORDS': + case '`META_KEYWORDS`': $stmt->bindValue($identifier, $this->meta_keywords, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FolderI18nQuery.php b/core/lib/Thelia/Model/Base/FolderI18nQuery.php index 5a95c3689..787657033 100644 --- a/core/lib/Thelia/Model/Base/FolderI18nQuery.php +++ b/core/lib/Thelia/Model/Base/FolderI18nQuery.php @@ -159,7 +159,7 @@ abstract class FolderI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM folder_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `META_TITLE`, `META_DESCRIPTION`, `META_KEYWORDS` FROM `folder_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FolderImage.php b/core/lib/Thelia/Model/Base/FolderImage.php index 2440c7232..6525246de 100644 --- a/core/lib/Thelia/Model/Base/FolderImage.php +++ b/core/lib/Thelia/Model/Base/FolderImage.php @@ -930,26 +930,26 @@ abstract class FolderImage implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FolderImageTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FolderImageTableMap::FOLDER_ID)) { - $modifiedColumns[':p' . $index++] = 'FOLDER_ID'; + $modifiedColumns[':p' . $index++] = '`FOLDER_ID`'; } if ($this->isColumnModified(FolderImageTableMap::FILE)) { - $modifiedColumns[':p' . $index++] = 'FILE'; + $modifiedColumns[':p' . $index++] = '`FILE`'; } if ($this->isColumnModified(FolderImageTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(FolderImageTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(FolderImageTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO folder_image (%s) VALUES (%s)', + 'INSERT INTO `folder_image` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -958,22 +958,22 @@ abstract class FolderImage implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'FOLDER_ID': + case '`FOLDER_ID`': $stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT); break; - case 'FILE': + case '`FILE`': $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FolderImageI18n.php b/core/lib/Thelia/Model/Base/FolderImageI18n.php index e080b4b5c..95fb29b2a 100644 --- a/core/lib/Thelia/Model/Base/FolderImageI18n.php +++ b/core/lib/Thelia/Model/Base/FolderImageI18n.php @@ -858,26 +858,26 @@ abstract class FolderImageI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FolderImageI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FolderImageI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(FolderImageI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(FolderImageI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(FolderImageI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(FolderImageI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO folder_image_i18n (%s) VALUES (%s)', + 'INSERT INTO `folder_image_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class FolderImageI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FolderImageI18nQuery.php b/core/lib/Thelia/Model/Base/FolderImageI18nQuery.php index 0e7e0ab55..15381439b 100644 --- a/core/lib/Thelia/Model/Base/FolderImageI18nQuery.php +++ b/core/lib/Thelia/Model/Base/FolderImageI18nQuery.php @@ -147,7 +147,7 @@ abstract class FolderImageI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM folder_image_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `folder_image_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FolderImageQuery.php b/core/lib/Thelia/Model/Base/FolderImageQuery.php index ca12e098e..6466b83a3 100644 --- a/core/lib/Thelia/Model/Base/FolderImageQuery.php +++ b/core/lib/Thelia/Model/Base/FolderImageQuery.php @@ -152,7 +152,7 @@ abstract class FolderImageQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, FOLDER_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM folder_image WHERE ID = :p0'; + $sql = 'SELECT `ID`, `FOLDER_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `folder_image` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FolderQuery.php b/core/lib/Thelia/Model/Base/FolderQuery.php index d7d6794c5..473ad2234 100644 --- a/core/lib/Thelia/Model/Base/FolderQuery.php +++ b/core/lib/Thelia/Model/Base/FolderQuery.php @@ -183,7 +183,7 @@ abstract class FolderQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PARENT, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM folder WHERE ID = :p0'; + $sql = 'SELECT `ID`, `PARENT`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `folder` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/FolderVersion.php b/core/lib/Thelia/Model/Base/FolderVersion.php index 657bdeb44..a0678e1b7 100644 --- a/core/lib/Thelia/Model/Base/FolderVersion.php +++ b/core/lib/Thelia/Model/Base/FolderVersion.php @@ -1019,35 +1019,35 @@ abstract class FolderVersion implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(FolderVersionTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(FolderVersionTableMap::PARENT)) { - $modifiedColumns[':p' . $index++] = 'PARENT'; + $modifiedColumns[':p' . $index++] = '`PARENT`'; } if ($this->isColumnModified(FolderVersionTableMap::VISIBLE)) { - $modifiedColumns[':p' . $index++] = 'VISIBLE'; + $modifiedColumns[':p' . $index++] = '`VISIBLE`'; } if ($this->isColumnModified(FolderVersionTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(FolderVersionTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(FolderVersionTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(FolderVersionTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(FolderVersionTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(FolderVersionTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO folder_version (%s) VALUES (%s)', + 'INSERT INTO `folder_version` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1056,31 +1056,31 @@ abstract class FolderVersion implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PARENT': + case '`PARENT`': $stmt->bindValue($identifier, $this->parent, PDO::PARAM_INT); break; - case 'VISIBLE': + case '`VISIBLE`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/FolderVersionQuery.php b/core/lib/Thelia/Model/Base/FolderVersionQuery.php index 22090d7be..086551003 100644 --- a/core/lib/Thelia/Model/Base/FolderVersionQuery.php +++ b/core/lib/Thelia/Model/Base/FolderVersionQuery.php @@ -159,7 +159,7 @@ abstract class FolderVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PARENT, VISIBLE, POSITION, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM folder_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT `ID`, `PARENT`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `folder_version` WHERE `ID` = :p0 AND `VERSION` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Lang.php b/core/lib/Thelia/Model/Base/Lang.php index ac6f1f63c..f01227211 100644 --- a/core/lib/Thelia/Model/Base/Lang.php +++ b/core/lib/Thelia/Model/Base/Lang.php @@ -1258,53 +1258,53 @@ abstract class Lang implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(LangTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(LangTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(LangTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + $modifiedColumns[':p' . $index++] = '`CODE`'; } if ($this->isColumnModified(LangTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(LangTableMap::URL)) { - $modifiedColumns[':p' . $index++] = 'URL'; + $modifiedColumns[':p' . $index++] = '`URL`'; } if ($this->isColumnModified(LangTableMap::DATE_FORMAT)) { - $modifiedColumns[':p' . $index++] = 'DATE_FORMAT'; + $modifiedColumns[':p' . $index++] = '`DATE_FORMAT`'; } if ($this->isColumnModified(LangTableMap::TIME_FORMAT)) { - $modifiedColumns[':p' . $index++] = 'TIME_FORMAT'; + $modifiedColumns[':p' . $index++] = '`TIME_FORMAT`'; } if ($this->isColumnModified(LangTableMap::DATETIME_FORMAT)) { - $modifiedColumns[':p' . $index++] = 'DATETIME_FORMAT'; + $modifiedColumns[':p' . $index++] = '`DATETIME_FORMAT`'; } if ($this->isColumnModified(LangTableMap::DECIMAL_SEPARATOR)) { - $modifiedColumns[':p' . $index++] = 'DECIMAL_SEPARATOR'; + $modifiedColumns[':p' . $index++] = '`DECIMAL_SEPARATOR`'; } if ($this->isColumnModified(LangTableMap::THOUSANDS_SEPARATOR)) { - $modifiedColumns[':p' . $index++] = 'THOUSANDS_SEPARATOR'; + $modifiedColumns[':p' . $index++] = '`THOUSANDS_SEPARATOR`'; } if ($this->isColumnModified(LangTableMap::DECIMALS)) { - $modifiedColumns[':p' . $index++] = 'DECIMALS'; + $modifiedColumns[':p' . $index++] = '`DECIMALS`'; } if ($this->isColumnModified(LangTableMap::BY_DEFAULT)) { - $modifiedColumns[':p' . $index++] = 'BY_DEFAULT'; + $modifiedColumns[':p' . $index++] = '`BY_DEFAULT`'; } if ($this->isColumnModified(LangTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(LangTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(LangTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO lang (%s) VALUES (%s)', + 'INSERT INTO `lang` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1313,49 +1313,49 @@ abstract class Lang implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'CODE': + case '`CODE`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'URL': + case '`URL`': $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); break; - case 'DATE_FORMAT': + case '`DATE_FORMAT`': $stmt->bindValue($identifier, $this->date_format, PDO::PARAM_STR); break; - case 'TIME_FORMAT': + case '`TIME_FORMAT`': $stmt->bindValue($identifier, $this->time_format, PDO::PARAM_STR); break; - case 'DATETIME_FORMAT': + case '`DATETIME_FORMAT`': $stmt->bindValue($identifier, $this->datetime_format, PDO::PARAM_STR); break; - case 'DECIMAL_SEPARATOR': + case '`DECIMAL_SEPARATOR`': $stmt->bindValue($identifier, $this->decimal_separator, PDO::PARAM_STR); break; - case 'THOUSANDS_SEPARATOR': + case '`THOUSANDS_SEPARATOR`': $stmt->bindValue($identifier, $this->thousands_separator, PDO::PARAM_STR); break; - case 'DECIMALS': + case '`DECIMALS`': $stmt->bindValue($identifier, $this->decimals, PDO::PARAM_STR); break; - case 'BY_DEFAULT': + case '`BY_DEFAULT`': $stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/LangQuery.php b/core/lib/Thelia/Model/Base/LangQuery.php index 045ee0887..f4f480fa9 100644 --- a/core/lib/Thelia/Model/Base/LangQuery.php +++ b/core/lib/Thelia/Model/Base/LangQuery.php @@ -183,7 +183,7 @@ abstract class LangQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, TITLE, CODE, LOCALE, URL, DATE_FORMAT, TIME_FORMAT, DATETIME_FORMAT, DECIMAL_SEPARATOR, THOUSANDS_SEPARATOR, DECIMALS, BY_DEFAULT, POSITION, CREATED_AT, UPDATED_AT FROM lang WHERE ID = :p0'; + $sql = 'SELECT `ID`, `TITLE`, `CODE`, `LOCALE`, `URL`, `DATE_FORMAT`, `TIME_FORMAT`, `DATETIME_FORMAT`, `DECIMAL_SEPARATOR`, `THOUSANDS_SEPARATOR`, `DECIMALS`, `BY_DEFAULT`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `lang` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Message.php b/core/lib/Thelia/Model/Base/Message.php index 351aa3818..ef8b825c3 100644 --- a/core/lib/Thelia/Model/Base/Message.php +++ b/core/lib/Thelia/Model/Base/Message.php @@ -1233,44 +1233,44 @@ abstract class Message implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(MessageTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(MessageTableMap::NAME)) { - $modifiedColumns[':p' . $index++] = 'NAME'; + $modifiedColumns[':p' . $index++] = '`NAME`'; } if ($this->isColumnModified(MessageTableMap::SECURED)) { - $modifiedColumns[':p' . $index++] = 'SECURED'; + $modifiedColumns[':p' . $index++] = '`SECURED`'; } if ($this->isColumnModified(MessageTableMap::TEXT_LAYOUT_FILE_NAME)) { - $modifiedColumns[':p' . $index++] = 'TEXT_LAYOUT_FILE_NAME'; + $modifiedColumns[':p' . $index++] = '`TEXT_LAYOUT_FILE_NAME`'; } if ($this->isColumnModified(MessageTableMap::TEXT_TEMPLATE_FILE_NAME)) { - $modifiedColumns[':p' . $index++] = 'TEXT_TEMPLATE_FILE_NAME'; + $modifiedColumns[':p' . $index++] = '`TEXT_TEMPLATE_FILE_NAME`'; } if ($this->isColumnModified(MessageTableMap::HTML_LAYOUT_FILE_NAME)) { - $modifiedColumns[':p' . $index++] = 'HTML_LAYOUT_FILE_NAME'; + $modifiedColumns[':p' . $index++] = '`HTML_LAYOUT_FILE_NAME`'; } if ($this->isColumnModified(MessageTableMap::HTML_TEMPLATE_FILE_NAME)) { - $modifiedColumns[':p' . $index++] = 'HTML_TEMPLATE_FILE_NAME'; + $modifiedColumns[':p' . $index++] = '`HTML_TEMPLATE_FILE_NAME`'; } if ($this->isColumnModified(MessageTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(MessageTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(MessageTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(MessageTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(MessageTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO message (%s) VALUES (%s)', + 'INSERT INTO `message` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1279,40 +1279,40 @@ abstract class Message implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'NAME': + case '`NAME`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; - case 'SECURED': + case '`SECURED`': $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT); break; - case 'TEXT_LAYOUT_FILE_NAME': + case '`TEXT_LAYOUT_FILE_NAME`': $stmt->bindValue($identifier, $this->text_layout_file_name, PDO::PARAM_STR); break; - case 'TEXT_TEMPLATE_FILE_NAME': + case '`TEXT_TEMPLATE_FILE_NAME`': $stmt->bindValue($identifier, $this->text_template_file_name, PDO::PARAM_STR); break; - case 'HTML_LAYOUT_FILE_NAME': + case '`HTML_LAYOUT_FILE_NAME`': $stmt->bindValue($identifier, $this->html_layout_file_name, PDO::PARAM_STR); break; - case 'HTML_TEMPLATE_FILE_NAME': + case '`HTML_TEMPLATE_FILE_NAME`': $stmt->bindValue($identifier, $this->html_template_file_name, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/MessageI18n.php b/core/lib/Thelia/Model/Base/MessageI18n.php index 42923cb69..615169d63 100644 --- a/core/lib/Thelia/Model/Base/MessageI18n.php +++ b/core/lib/Thelia/Model/Base/MessageI18n.php @@ -858,26 +858,26 @@ abstract class MessageI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(MessageI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(MessageI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(MessageI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(MessageI18nTableMap::SUBJECT)) { - $modifiedColumns[':p' . $index++] = 'SUBJECT'; + $modifiedColumns[':p' . $index++] = '`SUBJECT`'; } if ($this->isColumnModified(MessageI18nTableMap::TEXT_MESSAGE)) { - $modifiedColumns[':p' . $index++] = 'TEXT_MESSAGE'; + $modifiedColumns[':p' . $index++] = '`TEXT_MESSAGE`'; } if ($this->isColumnModified(MessageI18nTableMap::HTML_MESSAGE)) { - $modifiedColumns[':p' . $index++] = 'HTML_MESSAGE'; + $modifiedColumns[':p' . $index++] = '`HTML_MESSAGE`'; } $sql = sprintf( - 'INSERT INTO message_i18n (%s) VALUES (%s)', + 'INSERT INTO `message_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class MessageI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'SUBJECT': + case '`SUBJECT`': $stmt->bindValue($identifier, $this->subject, PDO::PARAM_STR); break; - case 'TEXT_MESSAGE': + case '`TEXT_MESSAGE`': $stmt->bindValue($identifier, $this->text_message, PDO::PARAM_STR); break; - case 'HTML_MESSAGE': + case '`HTML_MESSAGE`': $stmt->bindValue($identifier, $this->html_message, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/MessageI18nQuery.php b/core/lib/Thelia/Model/Base/MessageI18nQuery.php index f63ca675a..6ef0a1c10 100644 --- a/core/lib/Thelia/Model/Base/MessageI18nQuery.php +++ b/core/lib/Thelia/Model/Base/MessageI18nQuery.php @@ -147,7 +147,7 @@ abstract class MessageI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, SUBJECT, TEXT_MESSAGE, HTML_MESSAGE FROM message_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `SUBJECT`, `TEXT_MESSAGE`, `HTML_MESSAGE` FROM `message_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/MessageQuery.php b/core/lib/Thelia/Model/Base/MessageQuery.php index 3f412191f..1492b0834 100644 --- a/core/lib/Thelia/Model/Base/MessageQuery.php +++ b/core/lib/Thelia/Model/Base/MessageQuery.php @@ -183,7 +183,7 @@ abstract class MessageQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, NAME, SECURED, TEXT_LAYOUT_FILE_NAME, TEXT_TEMPLATE_FILE_NAME, HTML_LAYOUT_FILE_NAME, HTML_TEMPLATE_FILE_NAME, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message WHERE ID = :p0'; + $sql = 'SELECT `ID`, `NAME`, `SECURED`, `TEXT_LAYOUT_FILE_NAME`, `TEXT_TEMPLATE_FILE_NAME`, `HTML_LAYOUT_FILE_NAME`, `HTML_TEMPLATE_FILE_NAME`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `message` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/MessageVersion.php b/core/lib/Thelia/Model/Base/MessageVersion.php index 6fe06658c..0db39b3ec 100644 --- a/core/lib/Thelia/Model/Base/MessageVersion.php +++ b/core/lib/Thelia/Model/Base/MessageVersion.php @@ -1142,44 +1142,44 @@ abstract class MessageVersion implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(MessageVersionTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(MessageVersionTableMap::NAME)) { - $modifiedColumns[':p' . $index++] = 'NAME'; + $modifiedColumns[':p' . $index++] = '`NAME`'; } if ($this->isColumnModified(MessageVersionTableMap::SECURED)) { - $modifiedColumns[':p' . $index++] = 'SECURED'; + $modifiedColumns[':p' . $index++] = '`SECURED`'; } if ($this->isColumnModified(MessageVersionTableMap::TEXT_LAYOUT_FILE_NAME)) { - $modifiedColumns[':p' . $index++] = 'TEXT_LAYOUT_FILE_NAME'; + $modifiedColumns[':p' . $index++] = '`TEXT_LAYOUT_FILE_NAME`'; } if ($this->isColumnModified(MessageVersionTableMap::TEXT_TEMPLATE_FILE_NAME)) { - $modifiedColumns[':p' . $index++] = 'TEXT_TEMPLATE_FILE_NAME'; + $modifiedColumns[':p' . $index++] = '`TEXT_TEMPLATE_FILE_NAME`'; } if ($this->isColumnModified(MessageVersionTableMap::HTML_LAYOUT_FILE_NAME)) { - $modifiedColumns[':p' . $index++] = 'HTML_LAYOUT_FILE_NAME'; + $modifiedColumns[':p' . $index++] = '`HTML_LAYOUT_FILE_NAME`'; } if ($this->isColumnModified(MessageVersionTableMap::HTML_TEMPLATE_FILE_NAME)) { - $modifiedColumns[':p' . $index++] = 'HTML_TEMPLATE_FILE_NAME'; + $modifiedColumns[':p' . $index++] = '`HTML_TEMPLATE_FILE_NAME`'; } if ($this->isColumnModified(MessageVersionTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(MessageVersionTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(MessageVersionTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(MessageVersionTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(MessageVersionTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO message_version (%s) VALUES (%s)', + 'INSERT INTO `message_version` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1188,40 +1188,40 @@ abstract class MessageVersion implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'NAME': + case '`NAME`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; - case 'SECURED': + case '`SECURED`': $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT); break; - case 'TEXT_LAYOUT_FILE_NAME': + case '`TEXT_LAYOUT_FILE_NAME`': $stmt->bindValue($identifier, $this->text_layout_file_name, PDO::PARAM_STR); break; - case 'TEXT_TEMPLATE_FILE_NAME': + case '`TEXT_TEMPLATE_FILE_NAME`': $stmt->bindValue($identifier, $this->text_template_file_name, PDO::PARAM_STR); break; - case 'HTML_LAYOUT_FILE_NAME': + case '`HTML_LAYOUT_FILE_NAME`': $stmt->bindValue($identifier, $this->html_layout_file_name, PDO::PARAM_STR); break; - case 'HTML_TEMPLATE_FILE_NAME': + case '`HTML_TEMPLATE_FILE_NAME`': $stmt->bindValue($identifier, $this->html_template_file_name, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/MessageVersionQuery.php b/core/lib/Thelia/Model/Base/MessageVersionQuery.php index 638ed5e5c..5a2a15a03 100644 --- a/core/lib/Thelia/Model/Base/MessageVersionQuery.php +++ b/core/lib/Thelia/Model/Base/MessageVersionQuery.php @@ -171,7 +171,7 @@ abstract class MessageVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, NAME, SECURED, TEXT_LAYOUT_FILE_NAME, TEXT_TEMPLATE_FILE_NAME, HTML_LAYOUT_FILE_NAME, HTML_TEMPLATE_FILE_NAME, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT `ID`, `NAME`, `SECURED`, `TEXT_LAYOUT_FILE_NAME`, `TEXT_TEMPLATE_FILE_NAME`, `HTML_LAYOUT_FILE_NAME`, `HTML_TEMPLATE_FILE_NAME`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `message_version` WHERE `ID` = :p0 AND `VERSION` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Module.php b/core/lib/Thelia/Model/Base/Module.php index 3331bd57c..418417a1a 100644 --- a/core/lib/Thelia/Model/Base/Module.php +++ b/core/lib/Thelia/Model/Base/Module.php @@ -1148,32 +1148,32 @@ abstract class Module implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ModuleTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ModuleTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + $modifiedColumns[':p' . $index++] = '`CODE`'; } if ($this->isColumnModified(ModuleTableMap::TYPE)) { - $modifiedColumns[':p' . $index++] = 'TYPE'; + $modifiedColumns[':p' . $index++] = '`TYPE`'; } if ($this->isColumnModified(ModuleTableMap::ACTIVATE)) { - $modifiedColumns[':p' . $index++] = 'ACTIVATE'; + $modifiedColumns[':p' . $index++] = '`ACTIVATE`'; } if ($this->isColumnModified(ModuleTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ModuleTableMap::FULL_NAMESPACE)) { - $modifiedColumns[':p' . $index++] = 'FULL_NAMESPACE'; + $modifiedColumns[':p' . $index++] = '`FULL_NAMESPACE`'; } if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ModuleTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO module (%s) VALUES (%s)', + 'INSERT INTO `module` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1182,28 +1182,28 @@ abstract class Module implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': + case '`CODE`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'TYPE': + case '`TYPE`': $stmt->bindValue($identifier, $this->type, PDO::PARAM_INT); break; - case 'ACTIVATE': + case '`ACTIVATE`': $stmt->bindValue($identifier, $this->activate, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'FULL_NAMESPACE': + case '`FULL_NAMESPACE`': $stmt->bindValue($identifier, $this->full_namespace, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ModuleI18n.php b/core/lib/Thelia/Model/Base/ModuleI18n.php index 359fb530e..7c52f409f 100644 --- a/core/lib/Thelia/Model/Base/ModuleI18n.php +++ b/core/lib/Thelia/Model/Base/ModuleI18n.php @@ -858,26 +858,26 @@ abstract class ModuleI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ModuleI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ModuleI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ModuleI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ModuleI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ModuleI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ModuleI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO module_i18n (%s) VALUES (%s)', + 'INSERT INTO `module_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class ModuleI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ModuleI18nQuery.php b/core/lib/Thelia/Model/Base/ModuleI18nQuery.php index d3d4694fb..9bf96ccd5 100644 --- a/core/lib/Thelia/Model/Base/ModuleI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ModuleI18nQuery.php @@ -147,7 +147,7 @@ abstract class ModuleI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM module_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `module_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ModuleImage.php b/core/lib/Thelia/Model/Base/ModuleImage.php index 4185d26c9..f03e149a2 100644 --- a/core/lib/Thelia/Model/Base/ModuleImage.php +++ b/core/lib/Thelia/Model/Base/ModuleImage.php @@ -930,26 +930,26 @@ abstract class ModuleImage implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ModuleImageTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ModuleImageTableMap::MODULE_ID)) { - $modifiedColumns[':p' . $index++] = 'MODULE_ID'; + $modifiedColumns[':p' . $index++] = '`MODULE_ID`'; } if ($this->isColumnModified(ModuleImageTableMap::FILE)) { - $modifiedColumns[':p' . $index++] = 'FILE'; + $modifiedColumns[':p' . $index++] = '`FILE`'; } if ($this->isColumnModified(ModuleImageTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ModuleImageTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ModuleImageTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO module_image (%s) VALUES (%s)', + 'INSERT INTO `module_image` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -958,22 +958,22 @@ abstract class ModuleImage implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'MODULE_ID': + case '`MODULE_ID`': $stmt->bindValue($identifier, $this->module_id, PDO::PARAM_INT); break; - case 'FILE': + case '`FILE`': $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ModuleImageI18n.php b/core/lib/Thelia/Model/Base/ModuleImageI18n.php index 92a19a601..d83d11229 100644 --- a/core/lib/Thelia/Model/Base/ModuleImageI18n.php +++ b/core/lib/Thelia/Model/Base/ModuleImageI18n.php @@ -858,26 +858,26 @@ abstract class ModuleImageI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ModuleImageI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ModuleImageI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ModuleImageI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ModuleImageI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ModuleImageI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ModuleImageI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO module_image_i18n (%s) VALUES (%s)', + 'INSERT INTO `module_image_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class ModuleImageI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ModuleImageI18nQuery.php b/core/lib/Thelia/Model/Base/ModuleImageI18nQuery.php index e5b6813d6..50e7e61dd 100644 --- a/core/lib/Thelia/Model/Base/ModuleImageI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ModuleImageI18nQuery.php @@ -147,7 +147,7 @@ abstract class ModuleImageI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM module_image_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `module_image_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ModuleImageQuery.php b/core/lib/Thelia/Model/Base/ModuleImageQuery.php index 966e686ad..e5813c649 100644 --- a/core/lib/Thelia/Model/Base/ModuleImageQuery.php +++ b/core/lib/Thelia/Model/Base/ModuleImageQuery.php @@ -152,7 +152,7 @@ abstract class ModuleImageQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, MODULE_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM module_image WHERE ID = :p0'; + $sql = 'SELECT `ID`, `MODULE_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `module_image` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ModuleQuery.php b/core/lib/Thelia/Model/Base/ModuleQuery.php index 84ae33f68..006bfbe7a 100644 --- a/core/lib/Thelia/Model/Base/ModuleQuery.php +++ b/core/lib/Thelia/Model/Base/ModuleQuery.php @@ -176,7 +176,7 @@ abstract class ModuleQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, TYPE, ACTIVATE, POSITION, FULL_NAMESPACE, CREATED_AT, UPDATED_AT FROM module WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CODE`, `TYPE`, `ACTIVATE`, `POSITION`, `FULL_NAMESPACE`, `CREATED_AT`, `UPDATED_AT` FROM `module` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Newsletter.php b/core/lib/Thelia/Model/Base/Newsletter.php index 5282045d3..e9cd4077c 100644 --- a/core/lib/Thelia/Model/Base/Newsletter.php +++ b/core/lib/Thelia/Model/Base/Newsletter.php @@ -896,29 +896,29 @@ abstract class Newsletter implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(NewsletterTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(NewsletterTableMap::EMAIL)) { - $modifiedColumns[':p' . $index++] = 'EMAIL'; + $modifiedColumns[':p' . $index++] = '`EMAIL`'; } if ($this->isColumnModified(NewsletterTableMap::FIRSTNAME)) { - $modifiedColumns[':p' . $index++] = 'FIRSTNAME'; + $modifiedColumns[':p' . $index++] = '`FIRSTNAME`'; } if ($this->isColumnModified(NewsletterTableMap::LASTNAME)) { - $modifiedColumns[':p' . $index++] = 'LASTNAME'; + $modifiedColumns[':p' . $index++] = '`LASTNAME`'; } if ($this->isColumnModified(NewsletterTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(NewsletterTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(NewsletterTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO newsletter (%s) VALUES (%s)', + 'INSERT INTO `newsletter` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -927,25 +927,25 @@ abstract class Newsletter implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'EMAIL': + case '`EMAIL`': $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR); break; - case 'FIRSTNAME': + case '`FIRSTNAME`': $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); break; - case 'LASTNAME': + case '`LASTNAME`': $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/NewsletterQuery.php b/core/lib/Thelia/Model/Base/NewsletterQuery.php index ef9ac0a22..7968412cf 100644 --- a/core/lib/Thelia/Model/Base/NewsletterQuery.php +++ b/core/lib/Thelia/Model/Base/NewsletterQuery.php @@ -144,7 +144,7 @@ abstract class NewsletterQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, EMAIL, FIRSTNAME, LASTNAME, LOCALE, CREATED_AT, UPDATED_AT FROM newsletter WHERE ID = :p0'; + $sql = 'SELECT `ID`, `EMAIL`, `FIRSTNAME`, `LASTNAME`, `LOCALE`, `CREATED_AT`, `UPDATED_AT` FROM `newsletter` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Order.php b/core/lib/Thelia/Model/Base/Order.php index befa2abfe..c0f5111ca 100644 --- a/core/lib/Thelia/Model/Base/Order.php +++ b/core/lib/Thelia/Model/Base/Order.php @@ -17,8 +17,6 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use Thelia\Model\CouponOrder as ChildCouponOrder; -use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery; use Thelia\Model\Currency as ChildCurrency; use Thelia\Model\CurrencyQuery as ChildCurrencyQuery; use Thelia\Model\Customer as ChildCustomer; @@ -30,6 +28,8 @@ use Thelia\Model\ModuleQuery as ChildModuleQuery; use Thelia\Model\Order as ChildOrder; use Thelia\Model\OrderAddress as ChildOrderAddress; use Thelia\Model\OrderAddressQuery as ChildOrderAddressQuery; +use Thelia\Model\OrderCoupon as ChildOrderCoupon; +use Thelia\Model\OrderCouponQuery as ChildOrderCouponQuery; use Thelia\Model\OrderProduct as ChildOrderProduct; use Thelia\Model\OrderProductQuery as ChildOrderProductQuery; use Thelia\Model\OrderQuery as ChildOrderQuery; @@ -137,6 +137,12 @@ abstract class Order implements ActiveRecordInterface */ protected $invoice_ref; + /** + * The value for the discount field. + * @var double + */ + protected $discount; + /** * The value for the postage field. * @var double @@ -226,10 +232,10 @@ abstract class Order implements ActiveRecordInterface protected $collOrderProductsPartial; /** - * @var ObjectCollection|ChildCouponOrder[] Collection to store aggregation of ChildCouponOrder objects. + * @var ObjectCollection|ChildOrderCoupon[] Collection to store aggregation of ChildOrderCoupon objects. */ - protected $collCouponOrders; - protected $collCouponOrdersPartial; + protected $collOrderCoupons; + protected $collOrderCouponsPartial; /** * Flag to prevent endless save loop, if this object is referenced @@ -249,7 +255,7 @@ abstract class Order implements ActiveRecordInterface * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $couponOrdersScheduledForDeletion = null; + protected $orderCouponsScheduledForDeletion = null; /** * Initializes internal state of Thelia\Model\Base\Order object. @@ -639,6 +645,17 @@ abstract class Order implements ActiveRecordInterface return $this->invoice_ref; } + /** + * Get the [discount] column value. + * + * @return double + */ + public function getDiscount() + { + + return $this->discount; + } + /** * Get the [postage] column value. * @@ -981,6 +998,27 @@ abstract class Order implements ActiveRecordInterface return $this; } // setInvoiceRef() + /** + * Set the value of [discount] column. + * + * @param double $v new value + * @return \Thelia\Model\Order The current object (for fluent API support) + */ + public function setDiscount($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->discount !== $v) { + $this->discount = $v; + $this->modifiedColumns[] = OrderTableMap::DISCOUNT; + } + + + return $this; + } // setDiscount() + /** * Set the value of [postage] column. * @@ -1217,28 +1255,31 @@ abstract class Order implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : OrderTableMap::translateFieldName('InvoiceRef', TableMap::TYPE_PHPNAME, $indexType)]; $this->invoice_ref = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : OrderTableMap::translateFieldName('Postage', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : OrderTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)]; + $this->discount = (null !== $col) ? (double) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : OrderTableMap::translateFieldName('Postage', TableMap::TYPE_PHPNAME, $indexType)]; $this->postage = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : OrderTableMap::translateFieldName('PaymentModuleId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderTableMap::translateFieldName('PaymentModuleId', TableMap::TYPE_PHPNAME, $indexType)]; $this->payment_module_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderTableMap::translateFieldName('DeliveryModuleId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderTableMap::translateFieldName('DeliveryModuleId', TableMap::TYPE_PHPNAME, $indexType)]; $this->delivery_module_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderTableMap::translateFieldName('StatusId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderTableMap::translateFieldName('StatusId', TableMap::TYPE_PHPNAME, $indexType)]; $this->status_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderTableMap::translateFieldName('LangId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderTableMap::translateFieldName('LangId', TableMap::TYPE_PHPNAME, $indexType)]; $this->lang_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : OrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -1251,7 +1292,7 @@ abstract class Order implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 18; // 18 = OrderTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 19; // 19 = OrderTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Order object", 0, $e); @@ -1346,7 +1387,7 @@ abstract class Order implements ActiveRecordInterface $this->aLang = null; $this->collOrderProducts = null; - $this->collCouponOrders = null; + $this->collOrderCoupons = null; } // if (deep) } @@ -1559,17 +1600,17 @@ abstract class Order implements ActiveRecordInterface } } - if ($this->couponOrdersScheduledForDeletion !== null) { - if (!$this->couponOrdersScheduledForDeletion->isEmpty()) { - \Thelia\Model\CouponOrderQuery::create() - ->filterByPrimaryKeys($this->couponOrdersScheduledForDeletion->getPrimaryKeys(false)) + if ($this->orderCouponsScheduledForDeletion !== null) { + if (!$this->orderCouponsScheduledForDeletion->isEmpty()) { + \Thelia\Model\OrderCouponQuery::create() + ->filterByPrimaryKeys($this->orderCouponsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); - $this->couponOrdersScheduledForDeletion = null; + $this->orderCouponsScheduledForDeletion = null; } } - if ($this->collCouponOrders !== null) { - foreach ($this->collCouponOrders as $referrerFK) { + if ($this->collOrderCoupons !== null) { + foreach ($this->collOrderCoupons as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } @@ -1603,62 +1644,65 @@ abstract class Order implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; + $modifiedColumns[':p' . $index++] = '`REF`'; } if ($this->isColumnModified(OrderTableMap::CUSTOMER_ID)) { - $modifiedColumns[':p' . $index++] = 'CUSTOMER_ID'; + $modifiedColumns[':p' . $index++] = '`CUSTOMER_ID`'; } if ($this->isColumnModified(OrderTableMap::INVOICE_ORDER_ADDRESS_ID)) { - $modifiedColumns[':p' . $index++] = 'INVOICE_ORDER_ADDRESS_ID'; + $modifiedColumns[':p' . $index++] = '`INVOICE_ORDER_ADDRESS_ID`'; } if ($this->isColumnModified(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID)) { - $modifiedColumns[':p' . $index++] = 'DELIVERY_ORDER_ADDRESS_ID'; + $modifiedColumns[':p' . $index++] = '`DELIVERY_ORDER_ADDRESS_ID`'; } if ($this->isColumnModified(OrderTableMap::INVOICE_DATE)) { - $modifiedColumns[':p' . $index++] = 'INVOICE_DATE'; + $modifiedColumns[':p' . $index++] = '`INVOICE_DATE`'; } if ($this->isColumnModified(OrderTableMap::CURRENCY_ID)) { - $modifiedColumns[':p' . $index++] = 'CURRENCY_ID'; + $modifiedColumns[':p' . $index++] = '`CURRENCY_ID`'; } if ($this->isColumnModified(OrderTableMap::CURRENCY_RATE)) { - $modifiedColumns[':p' . $index++] = 'CURRENCY_RATE'; + $modifiedColumns[':p' . $index++] = '`CURRENCY_RATE`'; } if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) { - $modifiedColumns[':p' . $index++] = 'TRANSACTION_REF'; + $modifiedColumns[':p' . $index++] = '`TRANSACTION_REF`'; } if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) { - $modifiedColumns[':p' . $index++] = 'DELIVERY_REF'; + $modifiedColumns[':p' . $index++] = '`DELIVERY_REF`'; } if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) { - $modifiedColumns[':p' . $index++] = 'INVOICE_REF'; + $modifiedColumns[':p' . $index++] = '`INVOICE_REF`'; + } + if ($this->isColumnModified(OrderTableMap::DISCOUNT)) { + $modifiedColumns[':p' . $index++] = '`DISCOUNT`'; } if ($this->isColumnModified(OrderTableMap::POSTAGE)) { - $modifiedColumns[':p' . $index++] = 'POSTAGE'; + $modifiedColumns[':p' . $index++] = '`POSTAGE`'; } if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) { - $modifiedColumns[':p' . $index++] = 'PAYMENT_MODULE_ID'; + $modifiedColumns[':p' . $index++] = '`PAYMENT_MODULE_ID`'; } if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) { - $modifiedColumns[':p' . $index++] = 'DELIVERY_MODULE_ID'; + $modifiedColumns[':p' . $index++] = '`DELIVERY_MODULE_ID`'; } if ($this->isColumnModified(OrderTableMap::STATUS_ID)) { - $modifiedColumns[':p' . $index++] = 'STATUS_ID'; + $modifiedColumns[':p' . $index++] = '`STATUS_ID`'; } if ($this->isColumnModified(OrderTableMap::LANG_ID)) { - $modifiedColumns[':p' . $index++] = 'LANG_ID'; + $modifiedColumns[':p' . $index++] = '`LANG_ID`'; } if ($this->isColumnModified(OrderTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(OrderTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO order (%s) VALUES (%s)', + 'INSERT INTO `order` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1667,58 +1711,61 @@ abstract class Order implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'REF': + case '`REF`': $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); break; - case 'CUSTOMER_ID': + case '`CUSTOMER_ID`': $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT); break; - case 'INVOICE_ORDER_ADDRESS_ID': + case '`INVOICE_ORDER_ADDRESS_ID`': $stmt->bindValue($identifier, $this->invoice_order_address_id, PDO::PARAM_INT); break; - case 'DELIVERY_ORDER_ADDRESS_ID': + case '`DELIVERY_ORDER_ADDRESS_ID`': $stmt->bindValue($identifier, $this->delivery_order_address_id, PDO::PARAM_INT); break; - case 'INVOICE_DATE': + case '`INVOICE_DATE`': $stmt->bindValue($identifier, $this->invoice_date ? $this->invoice_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'CURRENCY_ID': + case '`CURRENCY_ID`': $stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT); break; - case 'CURRENCY_RATE': + case '`CURRENCY_RATE`': $stmt->bindValue($identifier, $this->currency_rate, PDO::PARAM_STR); break; - case 'TRANSACTION_REF': + case '`TRANSACTION_REF`': $stmt->bindValue($identifier, $this->transaction_ref, PDO::PARAM_STR); break; - case 'DELIVERY_REF': + case '`DELIVERY_REF`': $stmt->bindValue($identifier, $this->delivery_ref, PDO::PARAM_STR); break; - case 'INVOICE_REF': + case '`INVOICE_REF`': $stmt->bindValue($identifier, $this->invoice_ref, PDO::PARAM_STR); break; - case 'POSTAGE': + case '`DISCOUNT`': + $stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR); + break; + case '`POSTAGE`': $stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR); break; - case 'PAYMENT_MODULE_ID': + case '`PAYMENT_MODULE_ID`': $stmt->bindValue($identifier, $this->payment_module_id, PDO::PARAM_INT); break; - case 'DELIVERY_MODULE_ID': + case '`DELIVERY_MODULE_ID`': $stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT); break; - case 'STATUS_ID': + case '`STATUS_ID`': $stmt->bindValue($identifier, $this->status_id, PDO::PARAM_INT); break; - case 'LANG_ID': + case '`LANG_ID`': $stmt->bindValue($identifier, $this->lang_id, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } @@ -1817,24 +1864,27 @@ abstract class Order implements ActiveRecordInterface return $this->getInvoiceRef(); break; case 11: - return $this->getPostage(); + return $this->getDiscount(); break; case 12: - return $this->getPaymentModuleId(); + return $this->getPostage(); break; case 13: - return $this->getDeliveryModuleId(); + return $this->getPaymentModuleId(); break; case 14: - return $this->getStatusId(); + return $this->getDeliveryModuleId(); break; case 15: - return $this->getLangId(); + return $this->getStatusId(); break; case 16: - return $this->getCreatedAt(); + return $this->getLangId(); break; case 17: + return $this->getCreatedAt(); + break; + case 18: return $this->getUpdatedAt(); break; default: @@ -1877,13 +1927,14 @@ abstract class Order implements ActiveRecordInterface $keys[8] => $this->getTransactionRef(), $keys[9] => $this->getDeliveryRef(), $keys[10] => $this->getInvoiceRef(), - $keys[11] => $this->getPostage(), - $keys[12] => $this->getPaymentModuleId(), - $keys[13] => $this->getDeliveryModuleId(), - $keys[14] => $this->getStatusId(), - $keys[15] => $this->getLangId(), - $keys[16] => $this->getCreatedAt(), - $keys[17] => $this->getUpdatedAt(), + $keys[11] => $this->getDiscount(), + $keys[12] => $this->getPostage(), + $keys[13] => $this->getPaymentModuleId(), + $keys[14] => $this->getDeliveryModuleId(), + $keys[15] => $this->getStatusId(), + $keys[16] => $this->getLangId(), + $keys[17] => $this->getCreatedAt(), + $keys[18] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1918,8 +1969,8 @@ abstract class Order implements ActiveRecordInterface if (null !== $this->collOrderProducts) { $result['OrderProducts'] = $this->collOrderProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } - if (null !== $this->collCouponOrders) { - $result['CouponOrders'] = $this->collCouponOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + if (null !== $this->collOrderCoupons) { + $result['OrderCoupons'] = $this->collOrderCoupons->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } @@ -1989,24 +2040,27 @@ abstract class Order implements ActiveRecordInterface $this->setInvoiceRef($value); break; case 11: - $this->setPostage($value); + $this->setDiscount($value); break; case 12: - $this->setPaymentModuleId($value); + $this->setPostage($value); break; case 13: - $this->setDeliveryModuleId($value); + $this->setPaymentModuleId($value); break; case 14: - $this->setStatusId($value); + $this->setDeliveryModuleId($value); break; case 15: - $this->setLangId($value); + $this->setStatusId($value); break; case 16: - $this->setCreatedAt($value); + $this->setLangId($value); break; case 17: + $this->setCreatedAt($value); + break; + case 18: $this->setUpdatedAt($value); break; } // switch() @@ -2044,13 +2098,14 @@ abstract class Order implements ActiveRecordInterface if (array_key_exists($keys[8], $arr)) $this->setTransactionRef($arr[$keys[8]]); if (array_key_exists($keys[9], $arr)) $this->setDeliveryRef($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setInvoiceRef($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setPostage($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setPaymentModuleId($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setDeliveryModuleId($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setStatusId($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setLangId($arr[$keys[15]]); - if (array_key_exists($keys[16], $arr)) $this->setCreatedAt($arr[$keys[16]]); - if (array_key_exists($keys[17], $arr)) $this->setUpdatedAt($arr[$keys[17]]); + if (array_key_exists($keys[11], $arr)) $this->setDiscount($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setPostage($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setPaymentModuleId($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setDeliveryModuleId($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setStatusId($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setLangId($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setUpdatedAt($arr[$keys[18]]); } /** @@ -2073,6 +2128,7 @@ abstract class Order implements ActiveRecordInterface if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) $criteria->add(OrderTableMap::TRANSACTION_REF, $this->transaction_ref); if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) $criteria->add(OrderTableMap::DELIVERY_REF, $this->delivery_ref); if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) $criteria->add(OrderTableMap::INVOICE_REF, $this->invoice_ref); + if ($this->isColumnModified(OrderTableMap::DISCOUNT)) $criteria->add(OrderTableMap::DISCOUNT, $this->discount); if ($this->isColumnModified(OrderTableMap::POSTAGE)) $criteria->add(OrderTableMap::POSTAGE, $this->postage); if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) $criteria->add(OrderTableMap::PAYMENT_MODULE_ID, $this->payment_module_id); if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) $criteria->add(OrderTableMap::DELIVERY_MODULE_ID, $this->delivery_module_id); @@ -2153,6 +2209,7 @@ abstract class Order implements ActiveRecordInterface $copyObj->setTransactionRef($this->getTransactionRef()); $copyObj->setDeliveryRef($this->getDeliveryRef()); $copyObj->setInvoiceRef($this->getInvoiceRef()); + $copyObj->setDiscount($this->getDiscount()); $copyObj->setPostage($this->getPostage()); $copyObj->setPaymentModuleId($this->getPaymentModuleId()); $copyObj->setDeliveryModuleId($this->getDeliveryModuleId()); @@ -2172,9 +2229,9 @@ abstract class Order implements ActiveRecordInterface } } - foreach ($this->getCouponOrders() as $relObj) { + foreach ($this->getOrderCoupons() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCouponOrder($relObj->copy($deepCopy)); + $copyObj->addOrderCoupon($relObj->copy($deepCopy)); } } @@ -2630,8 +2687,8 @@ abstract class Order implements ActiveRecordInterface if ('OrderProduct' == $relationName) { return $this->initOrderProducts(); } - if ('CouponOrder' == $relationName) { - return $this->initCouponOrders(); + if ('OrderCoupon' == $relationName) { + return $this->initOrderCoupons(); } } @@ -2854,31 +2911,31 @@ abstract class Order implements ActiveRecordInterface } /** - * Clears out the collCouponOrders collection + * Clears out the collOrderCoupons collection * * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * * @return void - * @see addCouponOrders() + * @see addOrderCoupons() */ - public function clearCouponOrders() + public function clearOrderCoupons() { - $this->collCouponOrders = null; // important to set this to NULL since that means it is uninitialized + $this->collOrderCoupons = null; // important to set this to NULL since that means it is uninitialized } /** - * Reset is the collCouponOrders collection loaded partially. + * Reset is the collOrderCoupons collection loaded partially. */ - public function resetPartialCouponOrders($v = true) + public function resetPartialOrderCoupons($v = true) { - $this->collCouponOrdersPartial = $v; + $this->collOrderCouponsPartial = $v; } /** - * Initializes the collCouponOrders collection. + * Initializes the collOrderCoupons collection. * - * By default this just sets the collCouponOrders collection to an empty array (like clearcollCouponOrders()); + * By default this just sets the collOrderCoupons collection to an empty array (like clearcollOrderCoupons()); * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * @@ -2887,17 +2944,17 @@ abstract class Order implements ActiveRecordInterface * * @return void */ - public function initCouponOrders($overrideExisting = true) + public function initOrderCoupons($overrideExisting = true) { - if (null !== $this->collCouponOrders && !$overrideExisting) { + if (null !== $this->collOrderCoupons && !$overrideExisting) { return; } - $this->collCouponOrders = new ObjectCollection(); - $this->collCouponOrders->setModel('\Thelia\Model\CouponOrder'); + $this->collOrderCoupons = new ObjectCollection(); + $this->collOrderCoupons->setModel('\Thelia\Model\OrderCoupon'); } /** - * Gets an array of ChildCouponOrder objects which contain a foreign key that references this object. + * Gets an array of ChildOrderCoupon objects which contain a foreign key that references this object. * * If the $criteria is not null, it is used to always fetch the results from the database. * Otherwise the results are fetched from the database the first time, then cached. @@ -2907,109 +2964,109 @@ abstract class Order implements ActiveRecordInterface * * @param Criteria $criteria optional Criteria object to narrow the query * @param ConnectionInterface $con optional connection object - * @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects + * @return Collection|ChildOrderCoupon[] List of ChildOrderCoupon objects * @throws PropelException */ - public function getCouponOrders($criteria = null, ConnectionInterface $con = null) + public function getOrderCoupons($criteria = null, ConnectionInterface $con = null) { - $partial = $this->collCouponOrdersPartial && !$this->isNew(); - if (null === $this->collCouponOrders || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCouponOrders) { + $partial = $this->collOrderCouponsPartial && !$this->isNew(); + if (null === $this->collOrderCoupons || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collOrderCoupons) { // return empty collection - $this->initCouponOrders(); + $this->initOrderCoupons(); } else { - $collCouponOrders = ChildCouponOrderQuery::create(null, $criteria) + $collOrderCoupons = ChildOrderCouponQuery::create(null, $criteria) ->filterByOrder($this) ->find($con); if (null !== $criteria) { - if (false !== $this->collCouponOrdersPartial && count($collCouponOrders)) { - $this->initCouponOrders(false); + if (false !== $this->collOrderCouponsPartial && count($collOrderCoupons)) { + $this->initOrderCoupons(false); - foreach ($collCouponOrders as $obj) { - if (false == $this->collCouponOrders->contains($obj)) { - $this->collCouponOrders->append($obj); + foreach ($collOrderCoupons as $obj) { + if (false == $this->collOrderCoupons->contains($obj)) { + $this->collOrderCoupons->append($obj); } } - $this->collCouponOrdersPartial = true; + $this->collOrderCouponsPartial = true; } - $collCouponOrders->getInternalIterator()->rewind(); + $collOrderCoupons->getInternalIterator()->rewind(); - return $collCouponOrders; + return $collOrderCoupons; } - if ($partial && $this->collCouponOrders) { - foreach ($this->collCouponOrders as $obj) { + if ($partial && $this->collOrderCoupons) { + foreach ($this->collOrderCoupons as $obj) { if ($obj->isNew()) { - $collCouponOrders[] = $obj; + $collOrderCoupons[] = $obj; } } } - $this->collCouponOrders = $collCouponOrders; - $this->collCouponOrdersPartial = false; + $this->collOrderCoupons = $collOrderCoupons; + $this->collOrderCouponsPartial = false; } } - return $this->collCouponOrders; + return $this->collOrderCoupons; } /** - * Sets a collection of CouponOrder objects related by a one-to-many relationship + * Sets a collection of OrderCoupon objects related by a one-to-many relationship * to the current object. * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $couponOrders A Propel collection. + * @param Collection $orderCoupons A Propel collection. * @param ConnectionInterface $con Optional connection object * @return ChildOrder The current object (for fluent API support) */ - public function setCouponOrders(Collection $couponOrders, ConnectionInterface $con = null) + public function setOrderCoupons(Collection $orderCoupons, ConnectionInterface $con = null) { - $couponOrdersToDelete = $this->getCouponOrders(new Criteria(), $con)->diff($couponOrders); + $orderCouponsToDelete = $this->getOrderCoupons(new Criteria(), $con)->diff($orderCoupons); - $this->couponOrdersScheduledForDeletion = $couponOrdersToDelete; + $this->orderCouponsScheduledForDeletion = $orderCouponsToDelete; - foreach ($couponOrdersToDelete as $couponOrderRemoved) { - $couponOrderRemoved->setOrder(null); + foreach ($orderCouponsToDelete as $orderCouponRemoved) { + $orderCouponRemoved->setOrder(null); } - $this->collCouponOrders = null; - foreach ($couponOrders as $couponOrder) { - $this->addCouponOrder($couponOrder); + $this->collOrderCoupons = null; + foreach ($orderCoupons as $orderCoupon) { + $this->addOrderCoupon($orderCoupon); } - $this->collCouponOrders = $couponOrders; - $this->collCouponOrdersPartial = false; + $this->collOrderCoupons = $orderCoupons; + $this->collOrderCouponsPartial = false; return $this; } /** - * Returns the number of related CouponOrder objects. + * Returns the number of related OrderCoupon objects. * * @param Criteria $criteria * @param boolean $distinct * @param ConnectionInterface $con - * @return int Count of related CouponOrder objects. + * @return int Count of related OrderCoupon objects. * @throws PropelException */ - public function countCouponOrders(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countOrderCoupons(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { - $partial = $this->collCouponOrdersPartial && !$this->isNew(); - if (null === $this->collCouponOrders || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCouponOrders) { + $partial = $this->collOrderCouponsPartial && !$this->isNew(); + if (null === $this->collOrderCoupons || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collOrderCoupons) { return 0; } if ($partial && !$criteria) { - return count($this->getCouponOrders()); + return count($this->getOrderCoupons()); } - $query = ChildCouponOrderQuery::create(null, $criteria); + $query = ChildOrderCouponQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } @@ -3019,53 +3076,53 @@ abstract class Order implements ActiveRecordInterface ->count($con); } - return count($this->collCouponOrders); + return count($this->collOrderCoupons); } /** - * Method called to associate a ChildCouponOrder object to this object - * through the ChildCouponOrder foreign key attribute. + * Method called to associate a ChildOrderCoupon object to this object + * through the ChildOrderCoupon foreign key attribute. * - * @param ChildCouponOrder $l ChildCouponOrder + * @param ChildOrderCoupon $l ChildOrderCoupon * @return \Thelia\Model\Order The current object (for fluent API support) */ - public function addCouponOrder(ChildCouponOrder $l) + public function addOrderCoupon(ChildOrderCoupon $l) { - if ($this->collCouponOrders === null) { - $this->initCouponOrders(); - $this->collCouponOrdersPartial = true; + if ($this->collOrderCoupons === null) { + $this->initOrderCoupons(); + $this->collOrderCouponsPartial = true; } - if (!in_array($l, $this->collCouponOrders->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddCouponOrder($l); + if (!in_array($l, $this->collOrderCoupons->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddOrderCoupon($l); } return $this; } /** - * @param CouponOrder $couponOrder The couponOrder object to add. + * @param OrderCoupon $orderCoupon The orderCoupon object to add. */ - protected function doAddCouponOrder($couponOrder) + protected function doAddOrderCoupon($orderCoupon) { - $this->collCouponOrders[]= $couponOrder; - $couponOrder->setOrder($this); + $this->collOrderCoupons[]= $orderCoupon; + $orderCoupon->setOrder($this); } /** - * @param CouponOrder $couponOrder The couponOrder object to remove. + * @param OrderCoupon $orderCoupon The orderCoupon object to remove. * @return ChildOrder The current object (for fluent API support) */ - public function removeCouponOrder($couponOrder) + public function removeOrderCoupon($orderCoupon) { - if ($this->getCouponOrders()->contains($couponOrder)) { - $this->collCouponOrders->remove($this->collCouponOrders->search($couponOrder)); - if (null === $this->couponOrdersScheduledForDeletion) { - $this->couponOrdersScheduledForDeletion = clone $this->collCouponOrders; - $this->couponOrdersScheduledForDeletion->clear(); + if ($this->getOrderCoupons()->contains($orderCoupon)) { + $this->collOrderCoupons->remove($this->collOrderCoupons->search($orderCoupon)); + if (null === $this->orderCouponsScheduledForDeletion) { + $this->orderCouponsScheduledForDeletion = clone $this->collOrderCoupons; + $this->orderCouponsScheduledForDeletion->clear(); } - $this->couponOrdersScheduledForDeletion[]= clone $couponOrder; - $couponOrder->setOrder(null); + $this->orderCouponsScheduledForDeletion[]= clone $orderCoupon; + $orderCoupon->setOrder(null); } return $this; @@ -3087,6 +3144,7 @@ abstract class Order implements ActiveRecordInterface $this->transaction_ref = null; $this->delivery_ref = null; $this->invoice_ref = null; + $this->discount = null; $this->postage = null; $this->payment_module_id = null; $this->delivery_module_id = null; @@ -3118,8 +3176,8 @@ abstract class Order implements ActiveRecordInterface $o->clearAllReferences($deep); } } - if ($this->collCouponOrders) { - foreach ($this->collCouponOrders as $o) { + if ($this->collOrderCoupons) { + foreach ($this->collOrderCoupons as $o) { $o->clearAllReferences($deep); } } @@ -3129,10 +3187,10 @@ abstract class Order implements ActiveRecordInterface $this->collOrderProducts->clearIterator(); } $this->collOrderProducts = null; - if ($this->collCouponOrders instanceof Collection) { - $this->collCouponOrders->clearIterator(); + if ($this->collOrderCoupons instanceof Collection) { + $this->collOrderCoupons->clearIterator(); } - $this->collCouponOrders = null; + $this->collOrderCoupons = null; $this->aCurrency = null; $this->aCustomer = null; $this->aOrderAddressRelatedByInvoiceOrderAddressId = null; diff --git a/core/lib/Thelia/Model/Base/OrderAddress.php b/core/lib/Thelia/Model/Base/OrderAddress.php index d52fd9de3..b04e302f7 100644 --- a/core/lib/Thelia/Model/Base/OrderAddress.php +++ b/core/lib/Thelia/Model/Base/OrderAddress.php @@ -1248,50 +1248,50 @@ abstract class OrderAddress implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderAddressTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderAddressTableMap::CUSTOMER_TITLE_ID)) { - $modifiedColumns[':p' . $index++] = 'CUSTOMER_TITLE_ID'; + $modifiedColumns[':p' . $index++] = '`CUSTOMER_TITLE_ID`'; } if ($this->isColumnModified(OrderAddressTableMap::COMPANY)) { - $modifiedColumns[':p' . $index++] = 'COMPANY'; + $modifiedColumns[':p' . $index++] = '`COMPANY`'; } if ($this->isColumnModified(OrderAddressTableMap::FIRSTNAME)) { - $modifiedColumns[':p' . $index++] = 'FIRSTNAME'; + $modifiedColumns[':p' . $index++] = '`FIRSTNAME`'; } if ($this->isColumnModified(OrderAddressTableMap::LASTNAME)) { - $modifiedColumns[':p' . $index++] = 'LASTNAME'; + $modifiedColumns[':p' . $index++] = '`LASTNAME`'; } if ($this->isColumnModified(OrderAddressTableMap::ADDRESS1)) { - $modifiedColumns[':p' . $index++] = 'ADDRESS1'; + $modifiedColumns[':p' . $index++] = '`ADDRESS1`'; } if ($this->isColumnModified(OrderAddressTableMap::ADDRESS2)) { - $modifiedColumns[':p' . $index++] = 'ADDRESS2'; + $modifiedColumns[':p' . $index++] = '`ADDRESS2`'; } if ($this->isColumnModified(OrderAddressTableMap::ADDRESS3)) { - $modifiedColumns[':p' . $index++] = 'ADDRESS3'; + $modifiedColumns[':p' . $index++] = '`ADDRESS3`'; } if ($this->isColumnModified(OrderAddressTableMap::ZIPCODE)) { - $modifiedColumns[':p' . $index++] = 'ZIPCODE'; + $modifiedColumns[':p' . $index++] = '`ZIPCODE`'; } if ($this->isColumnModified(OrderAddressTableMap::CITY)) { - $modifiedColumns[':p' . $index++] = 'CITY'; + $modifiedColumns[':p' . $index++] = '`CITY`'; } if ($this->isColumnModified(OrderAddressTableMap::PHONE)) { - $modifiedColumns[':p' . $index++] = 'PHONE'; + $modifiedColumns[':p' . $index++] = '`PHONE`'; } if ($this->isColumnModified(OrderAddressTableMap::COUNTRY_ID)) { - $modifiedColumns[':p' . $index++] = 'COUNTRY_ID'; + $modifiedColumns[':p' . $index++] = '`COUNTRY_ID`'; } if ($this->isColumnModified(OrderAddressTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(OrderAddressTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO order_address (%s) VALUES (%s)', + 'INSERT INTO `order_address` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1300,46 +1300,46 @@ abstract class OrderAddress implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CUSTOMER_TITLE_ID': + case '`CUSTOMER_TITLE_ID`': $stmt->bindValue($identifier, $this->customer_title_id, PDO::PARAM_INT); break; - case 'COMPANY': + case '`COMPANY`': $stmt->bindValue($identifier, $this->company, PDO::PARAM_STR); break; - case 'FIRSTNAME': + case '`FIRSTNAME`': $stmt->bindValue($identifier, $this->firstname, PDO::PARAM_STR); break; - case 'LASTNAME': + case '`LASTNAME`': $stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR); break; - case 'ADDRESS1': + case '`ADDRESS1`': $stmt->bindValue($identifier, $this->address1, PDO::PARAM_STR); break; - case 'ADDRESS2': + case '`ADDRESS2`': $stmt->bindValue($identifier, $this->address2, PDO::PARAM_STR); break; - case 'ADDRESS3': + case '`ADDRESS3`': $stmt->bindValue($identifier, $this->address3, PDO::PARAM_STR); break; - case 'ZIPCODE': + case '`ZIPCODE`': $stmt->bindValue($identifier, $this->zipcode, PDO::PARAM_STR); break; - case 'CITY': + case '`CITY`': $stmt->bindValue($identifier, $this->city, PDO::PARAM_STR); break; - case 'PHONE': + case '`PHONE`': $stmt->bindValue($identifier, $this->phone, PDO::PARAM_STR); break; - case 'COUNTRY_ID': + case '`COUNTRY_ID`': $stmt->bindValue($identifier, $this->country_id, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/OrderAddressQuery.php b/core/lib/Thelia/Model/Base/OrderAddressQuery.php index 41f417872..575e24338 100644 --- a/core/lib/Thelia/Model/Base/OrderAddressQuery.php +++ b/core/lib/Thelia/Model/Base/OrderAddressQuery.php @@ -183,7 +183,7 @@ abstract class OrderAddressQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CUSTOMER_TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, PHONE, COUNTRY_ID, CREATED_AT, UPDATED_AT FROM order_address WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CUSTOMER_TITLE_ID`, `COMPANY`, `FIRSTNAME`, `LASTNAME`, `ADDRESS1`, `ADDRESS2`, `ADDRESS3`, `ZIPCODE`, `CITY`, `PHONE`, `COUNTRY_ID`, `CREATED_AT`, `UPDATED_AT` FROM `order_address` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/CouponOrder.php b/core/lib/Thelia/Model/Base/OrderCoupon.php similarity index 57% rename from core/lib/Thelia/Model/Base/CouponOrder.php rename to core/lib/Thelia/Model/Base/OrderCoupon.php index 4488e8ec6..da1921ec2 100644 --- a/core/lib/Thelia/Model/Base/CouponOrder.php +++ b/core/lib/Thelia/Model/Base/OrderCoupon.php @@ -16,18 +16,18 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use Thelia\Model\CouponOrder as ChildCouponOrder; -use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery; use Thelia\Model\Order as ChildOrder; +use Thelia\Model\OrderCoupon as ChildOrderCoupon; +use Thelia\Model\OrderCouponQuery as ChildOrderCouponQuery; use Thelia\Model\OrderQuery as ChildOrderQuery; -use Thelia\Model\Map\CouponOrderTableMap; +use Thelia\Model\Map\OrderCouponTableMap; -abstract class CouponOrder implements ActiveRecordInterface +abstract class OrderCoupon implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\CouponOrderTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\OrderCouponTableMap'; /** @@ -69,10 +69,76 @@ abstract class CouponOrder implements ActiveRecordInterface protected $order_id; /** - * The value for the value field. + * The value for the code field. + * @var string + */ + protected $code; + + /** + * The value for the type field. + * @var string + */ + protected $type; + + /** + * The value for the amount field. * @var double */ - protected $value; + protected $amount; + + /** + * The value for the title field. + * @var string + */ + protected $title; + + /** + * The value for the short_description field. + * @var string + */ + protected $short_description; + + /** + * The value for the description field. + * @var string + */ + protected $description; + + /** + * The value for the expiration_date field. + * @var string + */ + protected $expiration_date; + + /** + * The value for the max_usage field. + * @var int + */ + protected $max_usage; + + /** + * The value for the is_cumulative field. + * @var boolean + */ + protected $is_cumulative; + + /** + * The value for the is_removing_postage field. + * @var boolean + */ + protected $is_removing_postage; + + /** + * The value for the is_available_on_special_offers field. + * @var boolean + */ + protected $is_available_on_special_offers; + + /** + * The value for the serialized_conditions field. + * @var string + */ + protected $serialized_conditions; /** * The value for the created_at field. @@ -100,7 +166,7 @@ abstract class CouponOrder implements ActiveRecordInterface protected $alreadyInSave = false; /** - * Initializes internal state of Thelia\Model\Base\CouponOrder object. + * Initializes internal state of Thelia\Model\Base\OrderCoupon object. */ public function __construct() { @@ -195,9 +261,9 @@ abstract class CouponOrder implements ActiveRecordInterface } /** - * Compares this with another CouponOrder instance. If - * obj is an instance of CouponOrder, delegates to - * equals(CouponOrder). Otherwise, returns false. + * Compares this with another OrderCoupon instance. If + * obj is an instance of OrderCoupon, delegates to + * equals(OrderCoupon). Otherwise, returns false. * * @param mixed $obj The object to compare to. * @return boolean Whether equal to the object specified. @@ -280,7 +346,7 @@ abstract class CouponOrder implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return CouponOrder The current object, for fluid interface + * @return OrderCoupon The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -312,7 +378,7 @@ abstract class CouponOrder implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return CouponOrder The current object, for fluid interface + * @return OrderCoupon The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -380,14 +446,144 @@ abstract class CouponOrder implements ActiveRecordInterface } /** - * Get the [value] column value. + * Get the [code] column value. + * + * @return string + */ + public function getCode() + { + + return $this->code; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getType() + { + + return $this->type; + } + + /** + * Get the [amount] column value. * * @return double */ - public function getValue() + public function getAmount() { - return $this->value; + return $this->amount; + } + + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + + return $this->title; + } + + /** + * Get the [short_description] column value. + * + * @return string + */ + public function getShortDescription() + { + + return $this->short_description; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + + return $this->description; + } + + /** + * Get the [optionally formatted] temporal [expiration_date] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw \DateTime object will be returned. + * + * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getExpirationDate($format = NULL) + { + if ($format === null) { + return $this->expiration_date; + } else { + return $this->expiration_date instanceof \DateTime ? $this->expiration_date->format($format) : null; + } + } + + /** + * Get the [max_usage] column value. + * + * @return int + */ + public function getMaxUsage() + { + + return $this->max_usage; + } + + /** + * Get the [is_cumulative] column value. + * + * @return boolean + */ + public function getIsCumulative() + { + + return $this->is_cumulative; + } + + /** + * Get the [is_removing_postage] column value. + * + * @return boolean + */ + public function getIsRemovingPostage() + { + + return $this->is_removing_postage; + } + + /** + * Get the [is_available_on_special_offers] column value. + * + * @return boolean + */ + public function getIsAvailableOnSpecialOffers() + { + + return $this->is_available_on_special_offers; + } + + /** + * Get the [serialized_conditions] column value. + * + * @return string + */ + public function getSerializedConditions() + { + + return $this->serialized_conditions; } /** @@ -434,7 +630,7 @@ abstract class CouponOrder implements ActiveRecordInterface * Set the value of [id] column. * * @param int $v new value - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) */ public function setId($v) { @@ -444,7 +640,7 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[] = CouponOrderTableMap::ID; + $this->modifiedColumns[] = OrderCouponTableMap::ID; } @@ -455,7 +651,7 @@ abstract class CouponOrder implements ActiveRecordInterface * Set the value of [order_id] column. * * @param int $v new value - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) */ public function setOrderId($v) { @@ -465,7 +661,7 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->order_id !== $v) { $this->order_id = $v; - $this->modifiedColumns[] = CouponOrderTableMap::ORDER_ID; + $this->modifiedColumns[] = OrderCouponTableMap::ORDER_ID; } if ($this->aOrder !== null && $this->aOrder->getId() !== $v) { @@ -477,32 +673,287 @@ abstract class CouponOrder implements ActiveRecordInterface } // setOrderId() /** - * Set the value of [value] column. + * Set the value of [code] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setCode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->code !== $v) { + $this->code = $v; + $this->modifiedColumns[] = OrderCouponTableMap::CODE; + } + + + return $this; + } // setCode() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = OrderCouponTableMap::TYPE; + } + + + return $this; + } // setType() + + /** + * Set the value of [amount] column. * * @param double $v new value - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) */ - public function setValue($v) + public function setAmount($v) { if ($v !== null) { $v = (double) $v; } - if ($this->value !== $v) { - $this->value = $v; - $this->modifiedColumns[] = CouponOrderTableMap::VALUE; + if ($this->amount !== $v) { + $this->amount = $v; + $this->modifiedColumns[] = OrderCouponTableMap::AMOUNT; } return $this; - } // setValue() + } // setAmount() + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->title !== $v) { + $this->title = $v; + $this->modifiedColumns[] = OrderCouponTableMap::TITLE; + } + + + return $this; + } // setTitle() + + /** + * Set the value of [short_description] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setShortDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->short_description !== $v) { + $this->short_description = $v; + $this->modifiedColumns[] = OrderCouponTableMap::SHORT_DESCRIPTION; + } + + + return $this; + } // setShortDescription() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = OrderCouponTableMap::DESCRIPTION; + } + + + return $this; + } // setDescription() + + /** + * Sets the value of [expiration_date] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or \DateTime value. + * Empty strings are treated as NULL. + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setExpirationDate($v) + { + $dt = PropelDateTime::newInstance($v, null, '\DateTime'); + if ($this->expiration_date !== null || $dt !== null) { + if ($dt !== $this->expiration_date) { + $this->expiration_date = $dt; + $this->modifiedColumns[] = OrderCouponTableMap::EXPIRATION_DATE; + } + } // if either are not null + + + return $this; + } // setExpirationDate() + + /** + * Set the value of [max_usage] column. + * + * @param int $v new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setMaxUsage($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->max_usage !== $v) { + $this->max_usage = $v; + $this->modifiedColumns[] = OrderCouponTableMap::MAX_USAGE; + } + + + return $this; + } // setMaxUsage() + + /** + * Sets the value of the [is_cumulative] column. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * + * @param boolean|integer|string $v The new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setIsCumulative($v) + { + if ($v !== null) { + if (is_string($v)) { + $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } else { + $v = (boolean) $v; + } + } + + if ($this->is_cumulative !== $v) { + $this->is_cumulative = $v; + $this->modifiedColumns[] = OrderCouponTableMap::IS_CUMULATIVE; + } + + + return $this; + } // setIsCumulative() + + /** + * Sets the value of the [is_removing_postage] column. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * + * @param boolean|integer|string $v The new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setIsRemovingPostage($v) + { + if ($v !== null) { + if (is_string($v)) { + $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } else { + $v = (boolean) $v; + } + } + + if ($this->is_removing_postage !== $v) { + $this->is_removing_postage = $v; + $this->modifiedColumns[] = OrderCouponTableMap::IS_REMOVING_POSTAGE; + } + + + return $this; + } // setIsRemovingPostage() + + /** + * Sets the value of the [is_available_on_special_offers] column. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * + * @param boolean|integer|string $v The new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setIsAvailableOnSpecialOffers($v) + { + if ($v !== null) { + if (is_string($v)) { + $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } else { + $v = (boolean) $v; + } + } + + if ($this->is_available_on_special_offers !== $v) { + $this->is_available_on_special_offers = $v; + $this->modifiedColumns[] = OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS; + } + + + return $this; + } // setIsAvailableOnSpecialOffers() + + /** + * Set the value of [serialized_conditions] column. + * + * @param string $v new value + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) + */ + public function setSerializedConditions($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->serialized_conditions !== $v) { + $this->serialized_conditions = $v; + $this->modifiedColumns[] = OrderCouponTableMap::SERIALIZED_CONDITIONS; + } + + + return $this; + } // setSerializedConditions() /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) */ public function setCreatedAt($v) { @@ -510,7 +961,7 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->created_at !== null || $dt !== null) { if ($dt !== $this->created_at) { $this->created_at = $dt; - $this->modifiedColumns[] = CouponOrderTableMap::CREATED_AT; + $this->modifiedColumns[] = OrderCouponTableMap::CREATED_AT; } } // if either are not null @@ -523,7 +974,7 @@ abstract class CouponOrder implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) */ public function setUpdatedAt($v) { @@ -531,7 +982,7 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->updated_at !== null || $dt !== null) { if ($dt !== $this->updated_at) { $this->updated_at = $dt; - $this->modifiedColumns[] = CouponOrderTableMap::UPDATED_AT; + $this->modifiedColumns[] = OrderCouponTableMap::UPDATED_AT; } } // if either are not null @@ -576,22 +1027,58 @@ abstract class CouponOrder implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : CouponOrderTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : OrderCouponTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponOrderTableMap::translateFieldName('OrderId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : OrderCouponTableMap::translateFieldName('OrderId', TableMap::TYPE_PHPNAME, $indexType)]; $this->order_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponOrderTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; - $this->value = (null !== $col) ? (double) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : OrderCouponTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; + $this->code = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponOrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : OrderCouponTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)]; + $this->type = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : OrderCouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; + $this->amount = (null !== $col) ? (double) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : OrderCouponTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $this->title = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : OrderCouponTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)]; + $this->short_description = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : OrderCouponTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; + $this->description = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : OrderCouponTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; + if ($col === '0000-00-00 00:00:00') { + $col = null; + } + $this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : OrderCouponTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->max_usage = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : OrderCouponTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_cumulative = (null !== $col) ? (boolean) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : OrderCouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_removing_postage = (null !== $col) ? (boolean) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : OrderCouponTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_available_on_special_offers = (null !== $col) ? (boolean) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderCouponTableMap::translateFieldName('SerializedConditions', TableMap::TYPE_PHPNAME, $indexType)]; + $this->serialized_conditions = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderCouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponOrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderCouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -604,10 +1091,10 @@ abstract class CouponOrder implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 5; // 5 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 16; // 16 = OrderCouponTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\CouponOrder object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\OrderCoupon object", 0, $e); } } @@ -652,13 +1139,13 @@ abstract class CouponOrder implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(CouponOrderTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(OrderCouponTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildCouponOrderQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildOrderCouponQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -678,8 +1165,8 @@ abstract class CouponOrder implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see CouponOrder::setDeleted() - * @see CouponOrder::isDeleted() + * @see OrderCoupon::setDeleted() + * @see OrderCoupon::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -688,12 +1175,12 @@ abstract class CouponOrder implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(OrderCouponTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildCouponOrderQuery::create() + $deleteQuery = ChildOrderCouponQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -730,7 +1217,7 @@ abstract class CouponOrder implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(OrderCouponTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -740,16 +1227,16 @@ abstract class CouponOrder implements ActiveRecordInterface if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - if (!$this->isColumnModified(CouponOrderTableMap::CREATED_AT)) { + if (!$this->isColumnModified(OrderCouponTableMap::CREATED_AT)) { $this->setCreatedAt(time()); } - if (!$this->isColumnModified(CouponOrderTableMap::UPDATED_AT)) { + if (!$this->isColumnModified(OrderCouponTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(CouponOrderTableMap::UPDATED_AT)) { + if ($this->isModified() && !$this->isColumnModified(OrderCouponTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } @@ -761,7 +1248,7 @@ abstract class CouponOrder implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - CouponOrderTableMap::addInstanceToPool($this); + OrderCouponTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -834,30 +1321,63 @@ abstract class CouponOrder implements ActiveRecordInterface $modifiedColumns = array(); $index = 0; - $this->modifiedColumns[] = CouponOrderTableMap::ID; + $this->modifiedColumns[] = OrderCouponTableMap::ID; if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . CouponOrderTableMap::ID . ')'); + throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderCouponTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(CouponOrderTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + if ($this->isColumnModified(OrderCouponTableMap::ID)) { + $modifiedColumns[':p' . $index++] = '`ID`'; } - if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) { - $modifiedColumns[':p' . $index++] = 'ORDER_ID'; + if ($this->isColumnModified(OrderCouponTableMap::ORDER_ID)) { + $modifiedColumns[':p' . $index++] = '`ORDER_ID`'; } - if ($this->isColumnModified(CouponOrderTableMap::VALUE)) { - $modifiedColumns[':p' . $index++] = 'VALUE'; + if ($this->isColumnModified(OrderCouponTableMap::CODE)) { + $modifiedColumns[':p' . $index++] = '`CODE`'; } - if ($this->isColumnModified(CouponOrderTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + if ($this->isColumnModified(OrderCouponTableMap::TYPE)) { + $modifiedColumns[':p' . $index++] = '`TYPE`'; } - if ($this->isColumnModified(CouponOrderTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + if ($this->isColumnModified(OrderCouponTableMap::AMOUNT)) { + $modifiedColumns[':p' . $index++] = '`AMOUNT`'; + } + if ($this->isColumnModified(OrderCouponTableMap::TITLE)) { + $modifiedColumns[':p' . $index++] = '`TITLE`'; + } + if ($this->isColumnModified(OrderCouponTableMap::SHORT_DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = '`SHORT_DESCRIPTION`'; + } + if ($this->isColumnModified(OrderCouponTableMap::DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; + } + if ($this->isColumnModified(OrderCouponTableMap::EXPIRATION_DATE)) { + $modifiedColumns[':p' . $index++] = '`EXPIRATION_DATE`'; + } + if ($this->isColumnModified(OrderCouponTableMap::MAX_USAGE)) { + $modifiedColumns[':p' . $index++] = '`MAX_USAGE`'; + } + if ($this->isColumnModified(OrderCouponTableMap::IS_CUMULATIVE)) { + $modifiedColumns[':p' . $index++] = '`IS_CUMULATIVE`'; + } + if ($this->isColumnModified(OrderCouponTableMap::IS_REMOVING_POSTAGE)) { + $modifiedColumns[':p' . $index++] = '`IS_REMOVING_POSTAGE`'; + } + if ($this->isColumnModified(OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) { + $modifiedColumns[':p' . $index++] = '`IS_AVAILABLE_ON_SPECIAL_OFFERS`'; + } + if ($this->isColumnModified(OrderCouponTableMap::SERIALIZED_CONDITIONS)) { + $modifiedColumns[':p' . $index++] = '`SERIALIZED_CONDITIONS`'; + } + if ($this->isColumnModified(OrderCouponTableMap::CREATED_AT)) { + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; + } + if ($this->isColumnModified(OrderCouponTableMap::UPDATED_AT)) { + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO coupon_order (%s) VALUES (%s)', + 'INSERT INTO `order_coupon` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -866,19 +1386,52 @@ abstract class CouponOrder implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'ORDER_ID': + case '`ORDER_ID`': $stmt->bindValue($identifier, $this->order_id, PDO::PARAM_INT); break; - case 'VALUE': - $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); + case '`CODE`': + $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`TYPE`': + $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); + break; + case '`AMOUNT`': + $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); + break; + case '`TITLE`': + $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); + break; + case '`SHORT_DESCRIPTION`': + $stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR); + break; + case '`DESCRIPTION`': + $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; + case '`EXPIRATION_DATE`': + $stmt->bindValue($identifier, $this->expiration_date ? $this->expiration_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); + break; + case '`MAX_USAGE`': + $stmt->bindValue($identifier, $this->max_usage, PDO::PARAM_INT); + break; + case '`IS_CUMULATIVE`': + $stmt->bindValue($identifier, (int) $this->is_cumulative, PDO::PARAM_INT); + break; + case '`IS_REMOVING_POSTAGE`': + $stmt->bindValue($identifier, (int) $this->is_removing_postage, PDO::PARAM_INT); + break; + case '`IS_AVAILABLE_ON_SPECIAL_OFFERS`': + $stmt->bindValue($identifier, (int) $this->is_available_on_special_offers, PDO::PARAM_INT); + break; + case '`SERIALIZED_CONDITIONS`': + $stmt->bindValue($identifier, $this->serialized_conditions, PDO::PARAM_STR); + break; + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } @@ -927,7 +1480,7 @@ abstract class CouponOrder implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = CouponOrderTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = OrderCouponTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -950,12 +1503,45 @@ abstract class CouponOrder implements ActiveRecordInterface return $this->getOrderId(); break; case 2: - return $this->getValue(); + return $this->getCode(); break; case 3: - return $this->getCreatedAt(); + return $this->getType(); break; case 4: + return $this->getAmount(); + break; + case 5: + return $this->getTitle(); + break; + case 6: + return $this->getShortDescription(); + break; + case 7: + return $this->getDescription(); + break; + case 8: + return $this->getExpirationDate(); + break; + case 9: + return $this->getMaxUsage(); + break; + case 10: + return $this->getIsCumulative(); + break; + case 11: + return $this->getIsRemovingPostage(); + break; + case 12: + return $this->getIsAvailableOnSpecialOffers(); + break; + case 13: + return $this->getSerializedConditions(); + break; + case 14: + return $this->getCreatedAt(); + break; + case 15: return $this->getUpdatedAt(); break; default: @@ -981,17 +1567,28 @@ abstract class CouponOrder implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['CouponOrder'][$this->getPrimaryKey()])) { + if (isset($alreadyDumpedObjects['OrderCoupon'][$this->getPrimaryKey()])) { return '*RECURSION*'; } - $alreadyDumpedObjects['CouponOrder'][$this->getPrimaryKey()] = true; - $keys = CouponOrderTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['OrderCoupon'][$this->getPrimaryKey()] = true; + $keys = OrderCouponTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getOrderId(), - $keys[2] => $this->getValue(), - $keys[3] => $this->getCreatedAt(), - $keys[4] => $this->getUpdatedAt(), + $keys[2] => $this->getCode(), + $keys[3] => $this->getType(), + $keys[4] => $this->getAmount(), + $keys[5] => $this->getTitle(), + $keys[6] => $this->getShortDescription(), + $keys[7] => $this->getDescription(), + $keys[8] => $this->getExpirationDate(), + $keys[9] => $this->getMaxUsage(), + $keys[10] => $this->getIsCumulative(), + $keys[11] => $this->getIsRemovingPostage(), + $keys[12] => $this->getIsAvailableOnSpecialOffers(), + $keys[13] => $this->getSerializedConditions(), + $keys[14] => $this->getCreatedAt(), + $keys[15] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1020,7 +1617,7 @@ abstract class CouponOrder implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = CouponOrderTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = OrderCouponTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -1043,12 +1640,45 @@ abstract class CouponOrder implements ActiveRecordInterface $this->setOrderId($value); break; case 2: - $this->setValue($value); + $this->setCode($value); break; case 3: - $this->setCreatedAt($value); + $this->setType($value); break; case 4: + $this->setAmount($value); + break; + case 5: + $this->setTitle($value); + break; + case 6: + $this->setShortDescription($value); + break; + case 7: + $this->setDescription($value); + break; + case 8: + $this->setExpirationDate($value); + break; + case 9: + $this->setMaxUsage($value); + break; + case 10: + $this->setIsCumulative($value); + break; + case 11: + $this->setIsRemovingPostage($value); + break; + case 12: + $this->setIsAvailableOnSpecialOffers($value); + break; + case 13: + $this->setSerializedConditions($value); + break; + case 14: + $this->setCreatedAt($value); + break; + case 15: $this->setUpdatedAt($value); break; } // switch() @@ -1073,13 +1703,24 @@ abstract class CouponOrder implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = CouponOrderTableMap::getFieldNames($keyType); + $keys = OrderCouponTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setOrderId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setValue($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); + if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setType($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setAmount($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setTitle($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setShortDescription($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDescription($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setExpirationDate($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setMaxUsage($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setIsCumulative($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setIsRemovingPostage($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setSerializedConditions($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setCreatedAt($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setUpdatedAt($arr[$keys[15]]); } /** @@ -1089,13 +1730,24 @@ abstract class CouponOrder implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(CouponOrderTableMap::DATABASE_NAME); + $criteria = new Criteria(OrderCouponTableMap::DATABASE_NAME); - if ($this->isColumnModified(CouponOrderTableMap::ID)) $criteria->add(CouponOrderTableMap::ID, $this->id); - if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) $criteria->add(CouponOrderTableMap::ORDER_ID, $this->order_id); - if ($this->isColumnModified(CouponOrderTableMap::VALUE)) $criteria->add(CouponOrderTableMap::VALUE, $this->value); - if ($this->isColumnModified(CouponOrderTableMap::CREATED_AT)) $criteria->add(CouponOrderTableMap::CREATED_AT, $this->created_at); - if ($this->isColumnModified(CouponOrderTableMap::UPDATED_AT)) $criteria->add(CouponOrderTableMap::UPDATED_AT, $this->updated_at); + if ($this->isColumnModified(OrderCouponTableMap::ID)) $criteria->add(OrderCouponTableMap::ID, $this->id); + if ($this->isColumnModified(OrderCouponTableMap::ORDER_ID)) $criteria->add(OrderCouponTableMap::ORDER_ID, $this->order_id); + if ($this->isColumnModified(OrderCouponTableMap::CODE)) $criteria->add(OrderCouponTableMap::CODE, $this->code); + if ($this->isColumnModified(OrderCouponTableMap::TYPE)) $criteria->add(OrderCouponTableMap::TYPE, $this->type); + if ($this->isColumnModified(OrderCouponTableMap::AMOUNT)) $criteria->add(OrderCouponTableMap::AMOUNT, $this->amount); + if ($this->isColumnModified(OrderCouponTableMap::TITLE)) $criteria->add(OrderCouponTableMap::TITLE, $this->title); + if ($this->isColumnModified(OrderCouponTableMap::SHORT_DESCRIPTION)) $criteria->add(OrderCouponTableMap::SHORT_DESCRIPTION, $this->short_description); + if ($this->isColumnModified(OrderCouponTableMap::DESCRIPTION)) $criteria->add(OrderCouponTableMap::DESCRIPTION, $this->description); + if ($this->isColumnModified(OrderCouponTableMap::EXPIRATION_DATE)) $criteria->add(OrderCouponTableMap::EXPIRATION_DATE, $this->expiration_date); + if ($this->isColumnModified(OrderCouponTableMap::MAX_USAGE)) $criteria->add(OrderCouponTableMap::MAX_USAGE, $this->max_usage); + if ($this->isColumnModified(OrderCouponTableMap::IS_CUMULATIVE)) $criteria->add(OrderCouponTableMap::IS_CUMULATIVE, $this->is_cumulative); + if ($this->isColumnModified(OrderCouponTableMap::IS_REMOVING_POSTAGE)) $criteria->add(OrderCouponTableMap::IS_REMOVING_POSTAGE, $this->is_removing_postage); + if ($this->isColumnModified(OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) $criteria->add(OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $this->is_available_on_special_offers); + if ($this->isColumnModified(OrderCouponTableMap::SERIALIZED_CONDITIONS)) $criteria->add(OrderCouponTableMap::SERIALIZED_CONDITIONS, $this->serialized_conditions); + if ($this->isColumnModified(OrderCouponTableMap::CREATED_AT)) $criteria->add(OrderCouponTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(OrderCouponTableMap::UPDATED_AT)) $criteria->add(OrderCouponTableMap::UPDATED_AT, $this->updated_at); return $criteria; } @@ -1110,8 +1762,8 @@ abstract class CouponOrder implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(CouponOrderTableMap::DATABASE_NAME); - $criteria->add(CouponOrderTableMap::ID, $this->id); + $criteria = new Criteria(OrderCouponTableMap::DATABASE_NAME); + $criteria->add(OrderCouponTableMap::ID, $this->id); return $criteria; } @@ -1152,7 +1804,7 @@ abstract class CouponOrder implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\CouponOrder (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\OrderCoupon (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException @@ -1160,7 +1812,18 @@ abstract class CouponOrder implements ActiveRecordInterface public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setOrderId($this->getOrderId()); - $copyObj->setValue($this->getValue()); + $copyObj->setCode($this->getCode()); + $copyObj->setType($this->getType()); + $copyObj->setAmount($this->getAmount()); + $copyObj->setTitle($this->getTitle()); + $copyObj->setShortDescription($this->getShortDescription()); + $copyObj->setDescription($this->getDescription()); + $copyObj->setExpirationDate($this->getExpirationDate()); + $copyObj->setMaxUsage($this->getMaxUsage()); + $copyObj->setIsCumulative($this->getIsCumulative()); + $copyObj->setIsRemovingPostage($this->getIsRemovingPostage()); + $copyObj->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers()); + $copyObj->setSerializedConditions($this->getSerializedConditions()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($makeNew) { @@ -1178,7 +1841,7 @@ abstract class CouponOrder implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\CouponOrder Clone of current object. + * @return \Thelia\Model\OrderCoupon Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1195,7 +1858,7 @@ abstract class CouponOrder implements ActiveRecordInterface * Declares an association between this object and a ChildOrder object. * * @param ChildOrder $v - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) + * @return \Thelia\Model\OrderCoupon The current object (for fluent API support) * @throws PropelException */ public function setOrder(ChildOrder $v = null) @@ -1211,7 +1874,7 @@ abstract class CouponOrder implements ActiveRecordInterface // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildOrder object, it will not be re-added. if ($v !== null) { - $v->addCouponOrder($this); + $v->addOrderCoupon($this); } @@ -1235,7 +1898,7 @@ abstract class CouponOrder implements ActiveRecordInterface to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. - $this->aOrder->addCouponOrders($this); + $this->aOrder->addOrderCoupons($this); */ } @@ -1249,7 +1912,18 @@ abstract class CouponOrder implements ActiveRecordInterface { $this->id = null; $this->order_id = null; - $this->value = null; + $this->code = null; + $this->type = null; + $this->amount = null; + $this->title = null; + $this->short_description = null; + $this->description = null; + $this->expiration_date = null; + $this->max_usage = null; + $this->is_cumulative = null; + $this->is_removing_postage = null; + $this->is_available_on_special_offers = null; + $this->serialized_conditions = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; @@ -1283,7 +1957,7 @@ abstract class CouponOrder implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(CouponOrderTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(OrderCouponTableMap::DEFAULT_STRING_FORMAT); } // timestampable behavior @@ -1291,11 +1965,11 @@ abstract class CouponOrder implements ActiveRecordInterface /** * Mark the current object so that the update date doesn't get updated during next save * - * @return ChildCouponOrder The current object (for fluent API support) + * @return ChildOrderCoupon The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { - $this->modifiedColumns[] = CouponOrderTableMap::UPDATED_AT; + $this->modifiedColumns[] = OrderCouponTableMap::UPDATED_AT; return $this; } diff --git a/core/lib/Thelia/Model/Base/OrderCouponQuery.php b/core/lib/Thelia/Model/Base/OrderCouponQuery.php new file mode 100644 index 000000000..77281b29f --- /dev/null +++ b/core/lib/Thelia/Model/Base/OrderCouponQuery.php @@ -0,0 +1,1061 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + + return $query; + } + + /** + * Find object by primary key. + * Propel uses the instance pool to skip the database if the object exists. + * Go fast if the query is untouched. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildOrderCoupon|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = OrderCouponTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(OrderCouponTableMap::DATABASE_NAME); + } + $this->basePreSelect($con); + if ($this->formatter || $this->modelAlias || $this->with || $this->select + || $this->selectColumns || $this->asColumns || $this->selectModifiers + || $this->map || $this->having || $this->joins) { + return $this->findPkComplex($key, $con); + } else { + return $this->findPkSimple($key, $con); + } + } + + /** + * Find object by primary key using raw SQL to go fast. + * Bypass doSelect() and the object formatter by using generated code. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildOrderCoupon A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT `ID`, `ORDER_ID`, `CODE`, `TYPE`, `AMOUNT`, `TITLE`, `SHORT_DESCRIPTION`, `DESCRIPTION`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `SERIALIZED_CONDITIONS`, `CREATED_AT`, `UPDATED_AT` FROM `order_coupon` WHERE `ID` = :p0'; + try { + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $key, PDO::PARAM_INT); + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); + } + $obj = null; + if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { + $obj = new ChildOrderCoupon(); + $obj->hydrate($row); + OrderCouponTableMap::addInstanceToPool($obj, (string) $key); + } + $stmt->closeCursor(); + + return $obj; + } + + /** + * Find object by primary key. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildOrderCoupon|array|mixed the result, formatted by the current formatter + */ + protected function findPkComplex($key, $con) + { + // As the query uses a PK condition, no limit(1) is necessary. + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKey($key) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); + } + $this->basePreSelect($con); + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKeys($keys) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->format($dataFetcher); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(OrderCouponTableMap::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(OrderCouponTableMap::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @param mixed $id The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id)) { + $useMinMax = false; + if (isset($id['min'])) { + $this->addUsingAlias(OrderCouponTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(OrderCouponTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the order_id column + * + * Example usage: + * + * $query->filterByOrderId(1234); // WHERE order_id = 1234 + * $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34) + * $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12 + * + * + * @see filterByOrder() + * + * @param mixed $orderId The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByOrderId($orderId = null, $comparison = null) + { + if (is_array($orderId)) { + $useMinMax = false; + if (isset($orderId['min'])) { + $this->addUsingAlias(OrderCouponTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($orderId['max'])) { + $this->addUsingAlias(OrderCouponTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::ORDER_ID, $orderId, $comparison); + } + + /** + * Filter the query on the code column + * + * Example usage: + * + * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' + * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * + * + * @param string $code The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByCode($code = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($code)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $code)) { + $code = str_replace('*', '%', $code); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::CODE, $code, $comparison); + } + + /** + * Filter the query on the type column + * + * Example usage: + * + * $query->filterByType('fooValue'); // WHERE type = 'fooValue' + * $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%' + * + * + * @param string $type The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByType($type = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($type)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $type)) { + $type = str_replace('*', '%', $type); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::TYPE, $type, $comparison); + } + + /** + * Filter the query on the amount column + * + * Example usage: + * + * $query->filterByAmount(1234); // WHERE amount = 1234 + * $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34) + * $query->filterByAmount(array('min' => 12)); // WHERE amount > 12 + * + * + * @param mixed $amount The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByAmount($amount = null, $comparison = null) + { + if (is_array($amount)) { + $useMinMax = false; + if (isset($amount['min'])) { + $this->addUsingAlias(OrderCouponTableMap::AMOUNT, $amount['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($amount['max'])) { + $this->addUsingAlias(OrderCouponTableMap::AMOUNT, $amount['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::AMOUNT, $amount, $comparison); + } + + /** + * Filter the query on the title column + * + * Example usage: + * + * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' + * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' + * + * + * @param string $title The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByTitle($title = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($title)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $title)) { + $title = str_replace('*', '%', $title); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::TITLE, $title, $comparison); + } + + /** + * Filter the query on the short_description column + * + * Example usage: + * + * $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue' + * $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%' + * + * + * @param string $shortDescription The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByShortDescription($shortDescription = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($shortDescription)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $shortDescription)) { + $shortDescription = str_replace('*', '%', $shortDescription); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::SHORT_DESCRIPTION, $shortDescription, $comparison); + } + + /** + * Filter the query on the description column + * + * Example usage: + * + * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' + * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' + * + * + * @param string $description The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByDescription($description = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($description)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $description)) { + $description = str_replace('*', '%', $description); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::DESCRIPTION, $description, $comparison); + } + + /** + * Filter the query on the expiration_date column + * + * Example usage: + * + * $query->filterByExpirationDate('2011-03-14'); // WHERE expiration_date = '2011-03-14' + * $query->filterByExpirationDate('now'); // WHERE expiration_date = '2011-03-14' + * $query->filterByExpirationDate(array('max' => 'yesterday')); // WHERE expiration_date > '2011-03-13' + * + * + * @param mixed $expirationDate The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByExpirationDate($expirationDate = null, $comparison = null) + { + if (is_array($expirationDate)) { + $useMinMax = false; + if (isset($expirationDate['min'])) { + $this->addUsingAlias(OrderCouponTableMap::EXPIRATION_DATE, $expirationDate['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($expirationDate['max'])) { + $this->addUsingAlias(OrderCouponTableMap::EXPIRATION_DATE, $expirationDate['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::EXPIRATION_DATE, $expirationDate, $comparison); + } + + /** + * Filter the query on the max_usage column + * + * Example usage: + * + * $query->filterByMaxUsage(1234); // WHERE max_usage = 1234 + * $query->filterByMaxUsage(array(12, 34)); // WHERE max_usage IN (12, 34) + * $query->filterByMaxUsage(array('min' => 12)); // WHERE max_usage > 12 + * + * + * @param mixed $maxUsage The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByMaxUsage($maxUsage = null, $comparison = null) + { + if (is_array($maxUsage)) { + $useMinMax = false; + if (isset($maxUsage['min'])) { + $this->addUsingAlias(OrderCouponTableMap::MAX_USAGE, $maxUsage['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($maxUsage['max'])) { + $this->addUsingAlias(OrderCouponTableMap::MAX_USAGE, $maxUsage['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::MAX_USAGE, $maxUsage, $comparison); + } + + /** + * Filter the query on the is_cumulative column + * + * Example usage: + * + * $query->filterByIsCumulative(true); // WHERE is_cumulative = true + * $query->filterByIsCumulative('yes'); // WHERE is_cumulative = true + * + * + * @param boolean|string $isCumulative The value to use as filter. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByIsCumulative($isCumulative = null, $comparison = null) + { + if (is_string($isCumulative)) { + $is_cumulative = in_array(strtolower($isCumulative), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } + + return $this->addUsingAlias(OrderCouponTableMap::IS_CUMULATIVE, $isCumulative, $comparison); + } + + /** + * Filter the query on the is_removing_postage column + * + * Example usage: + * + * $query->filterByIsRemovingPostage(true); // WHERE is_removing_postage = true + * $query->filterByIsRemovingPostage('yes'); // WHERE is_removing_postage = true + * + * + * @param boolean|string $isRemovingPostage The value to use as filter. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByIsRemovingPostage($isRemovingPostage = null, $comparison = null) + { + if (is_string($isRemovingPostage)) { + $is_removing_postage = in_array(strtolower($isRemovingPostage), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } + + return $this->addUsingAlias(OrderCouponTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage, $comparison); + } + + /** + * Filter the query on the is_available_on_special_offers column + * + * Example usage: + * + * $query->filterByIsAvailableOnSpecialOffers(true); // WHERE is_available_on_special_offers = true + * $query->filterByIsAvailableOnSpecialOffers('yes'); // WHERE is_available_on_special_offers = true + * + * + * @param boolean|string $isAvailableOnSpecialOffers The value to use as filter. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers = null, $comparison = null) + { + if (is_string($isAvailableOnSpecialOffers)) { + $is_available_on_special_offers = in_array(strtolower($isAvailableOnSpecialOffers), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } + + return $this->addUsingAlias(OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $isAvailableOnSpecialOffers, $comparison); + } + + /** + * Filter the query on the serialized_conditions column + * + * Example usage: + * + * $query->filterBySerializedConditions('fooValue'); // WHERE serialized_conditions = 'fooValue' + * $query->filterBySerializedConditions('%fooValue%'); // WHERE serialized_conditions LIKE '%fooValue%' + * + * + * @param string $serializedConditions The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterBySerializedConditions($serializedConditions = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($serializedConditions)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $serializedConditions)) { + $serializedConditions = str_replace('*', '%', $serializedConditions); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::SERIALIZED_CONDITIONS, $serializedConditions, $comparison); + } + + /** + * Filter the query on the created_at column + * + * Example usage: + * + * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' + * + * + * @param mixed $createdAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByCreatedAt($createdAt = null, $comparison = null) + { + if (is_array($createdAt)) { + $useMinMax = false; + if (isset($createdAt['min'])) { + $this->addUsingAlias(OrderCouponTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($createdAt['max'])) { + $this->addUsingAlias(OrderCouponTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::CREATED_AT, $createdAt, $comparison); + } + + /** + * Filter the query on the updated_at column + * + * Example usage: + * + * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' + * + * + * @param mixed $updatedAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByUpdatedAt($updatedAt = null, $comparison = null) + { + if (is_array($updatedAt)) { + $useMinMax = false; + if (isset($updatedAt['min'])) { + $this->addUsingAlias(OrderCouponTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($updatedAt['max'])) { + $this->addUsingAlias(OrderCouponTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderCouponTableMap::UPDATED_AT, $updatedAt, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\Order object + * + * @param \Thelia\Model\Order|ObjectCollection $order The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function filterByOrder($order, $comparison = null) + { + if ($order instanceof \Thelia\Model\Order) { + return $this + ->addUsingAlias(OrderCouponTableMap::ORDER_ID, $order->getId(), $comparison); + } elseif ($order instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(OrderCouponTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByOrder() only accepts arguments of type \Thelia\Model\Order or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Order relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Order'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'Order'); + } + + return $this; + } + + /** + * Use the Order relation Order object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query + */ + public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinOrder($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery'); + } + + /** + * Exclude object from result + * + * @param ChildOrderCoupon $orderCoupon Object to remove from the list of results + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function prune($orderCoupon = null) + { + if ($orderCoupon) { + $this->addUsingAlias(OrderCouponTableMap::ID, $orderCoupon->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the order_coupon table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public function doDeleteAll(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(OrderCouponTableMap::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += parent::doDeleteAll($con); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + OrderCouponTableMap::clearInstancePool(); + OrderCouponTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildOrderCoupon or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildOrderCoupon object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public function delete(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(OrderCouponTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(OrderCouponTableMap::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + + OrderCouponTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + OrderCouponTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + // timestampable behavior + + /** + * Filter by the latest updated + * + * @param int $nbDays Maximum age of the latest update in days + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function recentlyUpdated($nbDays = 7) + { + return $this->addUsingAlias(OrderCouponTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Filter by the latest created + * + * @param int $nbDays Maximum age of in days + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function recentlyCreated($nbDays = 7) + { + return $this->addUsingAlias(OrderCouponTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Order by update date desc + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function lastUpdatedFirst() + { + return $this->addDescendingOrderByColumn(OrderCouponTableMap::UPDATED_AT); + } + + /** + * Order by update date asc + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function firstUpdatedFirst() + { + return $this->addAscendingOrderByColumn(OrderCouponTableMap::UPDATED_AT); + } + + /** + * Order by create date desc + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function lastCreatedFirst() + { + return $this->addDescendingOrderByColumn(OrderCouponTableMap::CREATED_AT); + } + + /** + * Order by create date asc + * + * @return ChildOrderCouponQuery The current query, for fluid interface + */ + public function firstCreatedFirst() + { + return $this->addAscendingOrderByColumn(OrderCouponTableMap::CREATED_AT); + } + +} // OrderCouponQuery diff --git a/core/lib/Thelia/Model/Base/OrderProduct.php b/core/lib/Thelia/Model/Base/OrderProduct.php index 0cf8c80b6..1c7309b77 100644 --- a/core/lib/Thelia/Model/Base/OrderProduct.php +++ b/core/lib/Thelia/Model/Base/OrderProduct.php @@ -1523,68 +1523,68 @@ abstract class OrderProduct implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderProductTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderProductTableMap::ORDER_ID)) { - $modifiedColumns[':p' . $index++] = 'ORDER_ID'; + $modifiedColumns[':p' . $index++] = '`ORDER_ID`'; } if ($this->isColumnModified(OrderProductTableMap::PRODUCT_REF)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_REF'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_REF`'; } if ($this->isColumnModified(OrderProductTableMap::PRODUCT_SALE_ELEMENTS_REF)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_SALE_ELEMENTS_REF'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_SALE_ELEMENTS_REF`'; } if ($this->isColumnModified(OrderProductTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(OrderProductTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(OrderProductTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(OrderProductTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } if ($this->isColumnModified(OrderProductTableMap::QUANTITY)) { - $modifiedColumns[':p' . $index++] = 'QUANTITY'; + $modifiedColumns[':p' . $index++] = '`QUANTITY`'; } if ($this->isColumnModified(OrderProductTableMap::PRICE)) { - $modifiedColumns[':p' . $index++] = 'PRICE'; + $modifiedColumns[':p' . $index++] = '`PRICE`'; } if ($this->isColumnModified(OrderProductTableMap::PROMO_PRICE)) { - $modifiedColumns[':p' . $index++] = 'PROMO_PRICE'; + $modifiedColumns[':p' . $index++] = '`PROMO_PRICE`'; } if ($this->isColumnModified(OrderProductTableMap::WAS_NEW)) { - $modifiedColumns[':p' . $index++] = 'WAS_NEW'; + $modifiedColumns[':p' . $index++] = '`WAS_NEW`'; } if ($this->isColumnModified(OrderProductTableMap::WAS_IN_PROMO)) { - $modifiedColumns[':p' . $index++] = 'WAS_IN_PROMO'; + $modifiedColumns[':p' . $index++] = '`WAS_IN_PROMO`'; } if ($this->isColumnModified(OrderProductTableMap::WEIGHT)) { - $modifiedColumns[':p' . $index++] = 'WEIGHT'; + $modifiedColumns[':p' . $index++] = '`WEIGHT`'; } if ($this->isColumnModified(OrderProductTableMap::EAN_CODE)) { - $modifiedColumns[':p' . $index++] = 'EAN_CODE'; + $modifiedColumns[':p' . $index++] = '`EAN_CODE`'; } if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_TITLE)) { - $modifiedColumns[':p' . $index++] = 'TAX_RULE_TITLE'; + $modifiedColumns[':p' . $index++] = '`TAX_RULE_TITLE`'; } if ($this->isColumnModified(OrderProductTableMap::TAX_RULE_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'TAX_RULE_DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`TAX_RULE_DESCRIPTION`'; } if ($this->isColumnModified(OrderProductTableMap::PARENT)) { - $modifiedColumns[':p' . $index++] = 'PARENT'; + $modifiedColumns[':p' . $index++] = '`PARENT`'; } if ($this->isColumnModified(OrderProductTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(OrderProductTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO order_product (%s) VALUES (%s)', + 'INSERT INTO `order_product` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1593,64 +1593,64 @@ abstract class OrderProduct implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'ORDER_ID': + case '`ORDER_ID`': $stmt->bindValue($identifier, $this->order_id, PDO::PARAM_INT); break; - case 'PRODUCT_REF': + case '`PRODUCT_REF`': $stmt->bindValue($identifier, $this->product_ref, PDO::PARAM_STR); break; - case 'PRODUCT_SALE_ELEMENTS_REF': + case '`PRODUCT_SALE_ELEMENTS_REF`': $stmt->bindValue($identifier, $this->product_sale_elements_ref, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; - case 'QUANTITY': + case '`QUANTITY`': $stmt->bindValue($identifier, $this->quantity, PDO::PARAM_STR); break; - case 'PRICE': + case '`PRICE`': $stmt->bindValue($identifier, $this->price, PDO::PARAM_STR); break; - case 'PROMO_PRICE': + case '`PROMO_PRICE`': $stmt->bindValue($identifier, $this->promo_price, PDO::PARAM_STR); break; - case 'WAS_NEW': + case '`WAS_NEW`': $stmt->bindValue($identifier, $this->was_new, PDO::PARAM_INT); break; - case 'WAS_IN_PROMO': + case '`WAS_IN_PROMO`': $stmt->bindValue($identifier, $this->was_in_promo, PDO::PARAM_INT); break; - case 'WEIGHT': + case '`WEIGHT`': $stmt->bindValue($identifier, $this->weight, PDO::PARAM_STR); break; - case 'EAN_CODE': + case '`EAN_CODE`': $stmt->bindValue($identifier, $this->ean_code, PDO::PARAM_STR); break; - case 'TAX_RULE_TITLE': + case '`TAX_RULE_TITLE`': $stmt->bindValue($identifier, $this->tax_rule_title, PDO::PARAM_STR); break; - case 'TAX_RULE_DESCRIPTION': + case '`TAX_RULE_DESCRIPTION`': $stmt->bindValue($identifier, $this->tax_rule_description, PDO::PARAM_STR); break; - case 'PARENT': + case '`PARENT`': $stmt->bindValue($identifier, $this->parent, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/OrderProductAttributeCombination.php b/core/lib/Thelia/Model/Base/OrderProductAttributeCombination.php index bcdcada7a..79409f735 100644 --- a/core/lib/Thelia/Model/Base/OrderProductAttributeCombination.php +++ b/core/lib/Thelia/Model/Base/OrderProductAttributeCombination.php @@ -1128,44 +1128,44 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ORDER_PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'ORDER_PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`ORDER_PRODUCT_ID`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ATTRIBUTE_TITLE)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_TITLE'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_TITLE`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ATTRIBUTE_CHAPO)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_CHAPO'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_CHAPO`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ATTRIBUTE_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_DESCRIPTION`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ATTRIBUTE_POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_POSTSCRIPTUM`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_TITLE)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_AV_TITLE'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_AV_TITLE`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_CHAPO)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_AV_CHAPO'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_AV_CHAPO`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_AV_DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_AV_DESCRIPTION`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::ATTRIBUTE_AV_POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'ATTRIBUTE_AV_POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`ATTRIBUTE_AV_POSTSCRIPTUM`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(OrderProductAttributeCombinationTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO order_product_attribute_combination (%s) VALUES (%s)', + 'INSERT INTO `order_product_attribute_combination` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1174,40 +1174,40 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'ORDER_PRODUCT_ID': + case '`ORDER_PRODUCT_ID`': $stmt->bindValue($identifier, $this->order_product_id, PDO::PARAM_INT); break; - case 'ATTRIBUTE_TITLE': + case '`ATTRIBUTE_TITLE`': $stmt->bindValue($identifier, $this->attribute_title, PDO::PARAM_STR); break; - case 'ATTRIBUTE_CHAPO': + case '`ATTRIBUTE_CHAPO`': $stmt->bindValue($identifier, $this->attribute_chapo, PDO::PARAM_STR); break; - case 'ATTRIBUTE_DESCRIPTION': + case '`ATTRIBUTE_DESCRIPTION`': $stmt->bindValue($identifier, $this->attribute_description, PDO::PARAM_STR); break; - case 'ATTRIBUTE_POSTSCRIPTUM': + case '`ATTRIBUTE_POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->attribute_postscriptum, PDO::PARAM_STR); break; - case 'ATTRIBUTE_AV_TITLE': + case '`ATTRIBUTE_AV_TITLE`': $stmt->bindValue($identifier, $this->attribute_av_title, PDO::PARAM_STR); break; - case 'ATTRIBUTE_AV_CHAPO': + case '`ATTRIBUTE_AV_CHAPO`': $stmt->bindValue($identifier, $this->attribute_av_chapo, PDO::PARAM_STR); break; - case 'ATTRIBUTE_AV_DESCRIPTION': + case '`ATTRIBUTE_AV_DESCRIPTION`': $stmt->bindValue($identifier, $this->attribute_av_description, PDO::PARAM_STR); break; - case 'ATTRIBUTE_AV_POSTSCRIPTUM': + case '`ATTRIBUTE_AV_POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->attribute_av_postscriptum, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/OrderProductAttributeCombinationQuery.php b/core/lib/Thelia/Model/Base/OrderProductAttributeCombinationQuery.php index 886b75c5f..cddfb5bbc 100644 --- a/core/lib/Thelia/Model/Base/OrderProductAttributeCombinationQuery.php +++ b/core/lib/Thelia/Model/Base/OrderProductAttributeCombinationQuery.php @@ -171,7 +171,7 @@ abstract class OrderProductAttributeCombinationQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ORDER_PRODUCT_ID, ATTRIBUTE_TITLE, ATTRIBUTE_CHAPO, ATTRIBUTE_DESCRIPTION, ATTRIBUTE_POSTSCRIPTUM, ATTRIBUTE_AV_TITLE, ATTRIBUTE_AV_CHAPO, ATTRIBUTE_AV_DESCRIPTION, ATTRIBUTE_AV_POSTSCRIPTUM, CREATED_AT, UPDATED_AT FROM order_product_attribute_combination WHERE ID = :p0'; + $sql = 'SELECT `ID`, `ORDER_PRODUCT_ID`, `ATTRIBUTE_TITLE`, `ATTRIBUTE_CHAPO`, `ATTRIBUTE_DESCRIPTION`, `ATTRIBUTE_POSTSCRIPTUM`, `ATTRIBUTE_AV_TITLE`, `ATTRIBUTE_AV_CHAPO`, `ATTRIBUTE_AV_DESCRIPTION`, `ATTRIBUTE_AV_POSTSCRIPTUM`, `CREATED_AT`, `UPDATED_AT` FROM `order_product_attribute_combination` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/OrderProductQuery.php b/core/lib/Thelia/Model/Base/OrderProductQuery.php index 4bf32e83d..4ab5d4721 100644 --- a/core/lib/Thelia/Model/Base/OrderProductQuery.php +++ b/core/lib/Thelia/Model/Base/OrderProductQuery.php @@ -211,7 +211,7 @@ abstract class OrderProductQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ORDER_ID, PRODUCT_REF, PRODUCT_SALE_ELEMENTS_REF, TITLE, CHAPO, DESCRIPTION, POSTSCRIPTUM, QUANTITY, PRICE, PROMO_PRICE, WAS_NEW, WAS_IN_PROMO, WEIGHT, EAN_CODE, TAX_RULE_TITLE, TAX_RULE_DESCRIPTION, PARENT, CREATED_AT, UPDATED_AT FROM order_product WHERE ID = :p0'; + $sql = 'SELECT `ID`, `ORDER_ID`, `PRODUCT_REF`, `PRODUCT_SALE_ELEMENTS_REF`, `TITLE`, `CHAPO`, `DESCRIPTION`, `POSTSCRIPTUM`, `QUANTITY`, `PRICE`, `PROMO_PRICE`, `WAS_NEW`, `WAS_IN_PROMO`, `WEIGHT`, `EAN_CODE`, `TAX_RULE_TITLE`, `TAX_RULE_DESCRIPTION`, `PARENT`, `CREATED_AT`, `UPDATED_AT` FROM `order_product` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/OrderProductTax.php b/core/lib/Thelia/Model/Base/OrderProductTax.php index 91d3492e1..f60c85bc8 100644 --- a/core/lib/Thelia/Model/Base/OrderProductTax.php +++ b/core/lib/Thelia/Model/Base/OrderProductTax.php @@ -964,32 +964,32 @@ abstract class OrderProductTax implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderProductTaxTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderProductTaxTableMap::ORDER_PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'ORDER_PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`ORDER_PRODUCT_ID`'; } if ($this->isColumnModified(OrderProductTaxTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(OrderProductTaxTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(OrderProductTaxTableMap::AMOUNT)) { - $modifiedColumns[':p' . $index++] = 'AMOUNT'; + $modifiedColumns[':p' . $index++] = '`AMOUNT`'; } if ($this->isColumnModified(OrderProductTaxTableMap::PROMO_AMOUNT)) { - $modifiedColumns[':p' . $index++] = 'PROMO_AMOUNT'; + $modifiedColumns[':p' . $index++] = '`PROMO_AMOUNT`'; } if ($this->isColumnModified(OrderProductTaxTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(OrderProductTaxTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO order_product_tax (%s) VALUES (%s)', + 'INSERT INTO `order_product_tax` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -998,28 +998,28 @@ abstract class OrderProductTax implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'ORDER_PRODUCT_ID': + case '`ORDER_PRODUCT_ID`': $stmt->bindValue($identifier, $this->order_product_id, PDO::PARAM_INT); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'AMOUNT': + case '`AMOUNT`': $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); break; - case 'PROMO_AMOUNT': + case '`PROMO_AMOUNT`': $stmt->bindValue($identifier, $this->promo_amount, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/OrderProductTaxQuery.php b/core/lib/Thelia/Model/Base/OrderProductTaxQuery.php index d0153d0cd..4bb59bf0d 100644 --- a/core/lib/Thelia/Model/Base/OrderProductTaxQuery.php +++ b/core/lib/Thelia/Model/Base/OrderProductTaxQuery.php @@ -155,7 +155,7 @@ abstract class OrderProductTaxQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ORDER_PRODUCT_ID, TITLE, DESCRIPTION, AMOUNT, PROMO_AMOUNT, CREATED_AT, UPDATED_AT FROM order_product_tax WHERE ID = :p0'; + $sql = 'SELECT `ID`, `ORDER_PRODUCT_ID`, `TITLE`, `DESCRIPTION`, `AMOUNT`, `PROMO_AMOUNT`, `CREATED_AT`, `UPDATED_AT` FROM `order_product_tax` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/OrderQuery.php b/core/lib/Thelia/Model/Base/OrderQuery.php index 592864f1f..96aa3d30b 100644 --- a/core/lib/Thelia/Model/Base/OrderQuery.php +++ b/core/lib/Thelia/Model/Base/OrderQuery.php @@ -32,6 +32,7 @@ use Thelia\Model\Map\OrderTableMap; * @method ChildOrderQuery orderByTransactionRef($order = Criteria::ASC) Order by the transaction_ref column * @method ChildOrderQuery orderByDeliveryRef($order = Criteria::ASC) Order by the delivery_ref column * @method ChildOrderQuery orderByInvoiceRef($order = Criteria::ASC) Order by the invoice_ref column + * @method ChildOrderQuery orderByDiscount($order = Criteria::ASC) Order by the discount column * @method ChildOrderQuery orderByPostage($order = Criteria::ASC) Order by the postage column * @method ChildOrderQuery orderByPaymentModuleId($order = Criteria::ASC) Order by the payment_module_id column * @method ChildOrderQuery orderByDeliveryModuleId($order = Criteria::ASC) Order by the delivery_module_id column @@ -51,6 +52,7 @@ use Thelia\Model\Map\OrderTableMap; * @method ChildOrderQuery groupByTransactionRef() Group by the transaction_ref column * @method ChildOrderQuery groupByDeliveryRef() Group by the delivery_ref column * @method ChildOrderQuery groupByInvoiceRef() Group by the invoice_ref column + * @method ChildOrderQuery groupByDiscount() Group by the discount column * @method ChildOrderQuery groupByPostage() Group by the postage column * @method ChildOrderQuery groupByPaymentModuleId() Group by the payment_module_id column * @method ChildOrderQuery groupByDeliveryModuleId() Group by the delivery_module_id column @@ -99,9 +101,9 @@ use Thelia\Model\Map\OrderTableMap; * @method ChildOrderQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation * @method ChildOrderQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation * - * @method ChildOrderQuery leftJoinCouponOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponOrder relation - * @method ChildOrderQuery rightJoinCouponOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponOrder relation - * @method ChildOrderQuery innerJoinCouponOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponOrder relation + * @method ChildOrderQuery leftJoinOrderCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderCoupon relation + * @method ChildOrderQuery rightJoinOrderCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderCoupon relation + * @method ChildOrderQuery innerJoinOrderCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderCoupon relation * * @method ChildOrder findOne(ConnectionInterface $con = null) Return the first ChildOrder matching the query * @method ChildOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrder matching the query, or a new ChildOrder object populated from the query conditions when no match is found @@ -117,6 +119,7 @@ use Thelia\Model\Map\OrderTableMap; * @method ChildOrder findOneByTransactionRef(string $transaction_ref) Return the first ChildOrder filtered by the transaction_ref column * @method ChildOrder findOneByDeliveryRef(string $delivery_ref) Return the first ChildOrder filtered by the delivery_ref column * @method ChildOrder findOneByInvoiceRef(string $invoice_ref) Return the first ChildOrder filtered by the invoice_ref column + * @method ChildOrder findOneByDiscount(double $discount) Return the first ChildOrder filtered by the discount column * @method ChildOrder findOneByPostage(double $postage) Return the first ChildOrder filtered by the postage column * @method ChildOrder findOneByPaymentModuleId(int $payment_module_id) Return the first ChildOrder filtered by the payment_module_id column * @method ChildOrder findOneByDeliveryModuleId(int $delivery_module_id) Return the first ChildOrder filtered by the delivery_module_id column @@ -136,6 +139,7 @@ use Thelia\Model\Map\OrderTableMap; * @method array findByTransactionRef(string $transaction_ref) Return ChildOrder objects filtered by the transaction_ref column * @method array findByDeliveryRef(string $delivery_ref) Return ChildOrder objects filtered by the delivery_ref column * @method array findByInvoiceRef(string $invoice_ref) Return ChildOrder objects filtered by the invoice_ref column + * @method array findByDiscount(double $discount) Return ChildOrder objects filtered by the discount column * @method array findByPostage(double $postage) Return ChildOrder objects filtered by the postage column * @method array findByPaymentModuleId(int $payment_module_id) Return ChildOrder objects filtered by the payment_module_id column * @method array findByDeliveryModuleId(int $delivery_module_id) Return ChildOrder objects filtered by the delivery_module_id column @@ -231,7 +235,7 @@ abstract class OrderQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, REF, CUSTOMER_ID, INVOICE_ORDER_ADDRESS_ID, DELIVERY_ORDER_ADDRESS_ID, INVOICE_DATE, CURRENCY_ID, CURRENCY_RATE, TRANSACTION_REF, DELIVERY_REF, INVOICE_REF, POSTAGE, PAYMENT_MODULE_ID, DELIVERY_MODULE_ID, STATUS_ID, LANG_ID, CREATED_AT, UPDATED_AT FROM order WHERE ID = :p0'; + $sql = 'SELECT `ID`, `REF`, `CUSTOMER_ID`, `INVOICE_ORDER_ADDRESS_ID`, `DELIVERY_ORDER_ADDRESS_ID`, `INVOICE_DATE`, `CURRENCY_ID`, `CURRENCY_RATE`, `TRANSACTION_REF`, `DELIVERY_REF`, `INVOICE_REF`, `DISCOUNT`, `POSTAGE`, `PAYMENT_MODULE_ID`, `DELIVERY_MODULE_ID`, `STATUS_ID`, `LANG_ID`, `CREATED_AT`, `UPDATED_AT` FROM `order` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -733,6 +737,47 @@ abstract class OrderQuery extends ModelCriteria return $this->addUsingAlias(OrderTableMap::INVOICE_REF, $invoiceRef, $comparison); } + /** + * Filter the query on the discount column + * + * Example usage: + * + * $query->filterByDiscount(1234); // WHERE discount = 1234 + * $query->filterByDiscount(array(12, 34)); // WHERE discount IN (12, 34) + * $query->filterByDiscount(array('min' => 12)); // WHERE discount > 12 + * + * + * @param mixed $discount The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildOrderQuery The current query, for fluid interface + */ + public function filterByDiscount($discount = null, $comparison = null) + { + if (is_array($discount)) { + $useMinMax = false; + if (isset($discount['min'])) { + $this->addUsingAlias(OrderTableMap::DISCOUNT, $discount['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($discount['max'])) { + $this->addUsingAlias(OrderTableMap::DISCOUNT, $discount['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(OrderTableMap::DISCOUNT, $discount, $comparison); + } + /** * Filter the query on the postage column * @@ -1706,40 +1751,40 @@ abstract class OrderQuery extends ModelCriteria } /** - * Filter the query by a related \Thelia\Model\CouponOrder object + * Filter the query by a related \Thelia\Model\OrderCoupon object * - * @param \Thelia\Model\CouponOrder|ObjectCollection $couponOrder the related object to use as filter + * @param \Thelia\Model\OrderCoupon|ObjectCollection $orderCoupon the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildOrderQuery The current query, for fluid interface */ - public function filterByCouponOrder($couponOrder, $comparison = null) + public function filterByOrderCoupon($orderCoupon, $comparison = null) { - if ($couponOrder instanceof \Thelia\Model\CouponOrder) { + if ($orderCoupon instanceof \Thelia\Model\OrderCoupon) { return $this - ->addUsingAlias(OrderTableMap::ID, $couponOrder->getOrderId(), $comparison); - } elseif ($couponOrder instanceof ObjectCollection) { + ->addUsingAlias(OrderTableMap::ID, $orderCoupon->getOrderId(), $comparison); + } elseif ($orderCoupon instanceof ObjectCollection) { return $this - ->useCouponOrderQuery() - ->filterByPrimaryKeys($couponOrder->getPrimaryKeys()) + ->useOrderCouponQuery() + ->filterByPrimaryKeys($orderCoupon->getPrimaryKeys()) ->endUse(); } else { - throw new PropelException('filterByCouponOrder() only accepts arguments of type \Thelia\Model\CouponOrder or Collection'); + throw new PropelException('filterByOrderCoupon() only accepts arguments of type \Thelia\Model\OrderCoupon or Collection'); } } /** - * Adds a JOIN clause to the query using the CouponOrder relation + * Adds a JOIN clause to the query using the OrderCoupon relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return ChildOrderQuery The current query, for fluid interface */ - public function joinCouponOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinOrderCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CouponOrder'); + $relationMap = $tableMap->getRelation('OrderCoupon'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -1754,14 +1799,14 @@ abstract class OrderQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'CouponOrder'); + $this->addJoinObject($join, 'OrderCoupon'); } return $this; } /** - * Use the CouponOrder relation CouponOrder object + * Use the OrderCoupon relation OrderCoupon object * * @see useQuery() * @@ -1769,13 +1814,13 @@ abstract class OrderQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \Thelia\Model\CouponOrderQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\OrderCouponQuery A secondary query class using the current class as primary query */ - public function useCouponOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function useOrderCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this - ->joinCouponOrder($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CouponOrder', '\Thelia\Model\CouponOrderQuery'); + ->joinOrderCoupon($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'OrderCoupon', '\Thelia\Model\OrderCouponQuery'); } /** diff --git a/core/lib/Thelia/Model/Base/OrderStatus.php b/core/lib/Thelia/Model/Base/OrderStatus.php index 4a5e49436..754876942 100644 --- a/core/lib/Thelia/Model/Base/OrderStatus.php +++ b/core/lib/Thelia/Model/Base/OrderStatus.php @@ -854,20 +854,20 @@ abstract class OrderStatus implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderStatusTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderStatusTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + $modifiedColumns[':p' . $index++] = '`CODE`'; } if ($this->isColumnModified(OrderStatusTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(OrderStatusTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO order_status (%s) VALUES (%s)', + 'INSERT INTO `order_status` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -876,16 +876,16 @@ abstract class OrderStatus implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': + case '`CODE`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/OrderStatusI18n.php b/core/lib/Thelia/Model/Base/OrderStatusI18n.php index d9f7f3b52..82a84fcea 100644 --- a/core/lib/Thelia/Model/Base/OrderStatusI18n.php +++ b/core/lib/Thelia/Model/Base/OrderStatusI18n.php @@ -858,26 +858,26 @@ abstract class OrderStatusI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(OrderStatusI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(OrderStatusI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(OrderStatusI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(OrderStatusI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(OrderStatusI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(OrderStatusI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO order_status_i18n (%s) VALUES (%s)', + 'INSERT INTO `order_status_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class OrderStatusI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/OrderStatusI18nQuery.php b/core/lib/Thelia/Model/Base/OrderStatusI18nQuery.php index 58127979f..1de0e360d 100644 --- a/core/lib/Thelia/Model/Base/OrderStatusI18nQuery.php +++ b/core/lib/Thelia/Model/Base/OrderStatusI18nQuery.php @@ -147,7 +147,7 @@ abstract class OrderStatusI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM order_status_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `order_status_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/OrderStatusQuery.php b/core/lib/Thelia/Model/Base/OrderStatusQuery.php index 7050b4a5a..3fa57cb4b 100644 --- a/core/lib/Thelia/Model/Base/OrderStatusQuery.php +++ b/core/lib/Thelia/Model/Base/OrderStatusQuery.php @@ -144,7 +144,7 @@ abstract class OrderStatusQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, CREATED_AT, UPDATED_AT FROM order_status WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CODE`, `CREATED_AT`, `UPDATED_AT` FROM `order_status` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Product.php b/core/lib/Thelia/Model/Base/Product.php index 50d8e96a3..2f7cb3468 100644 --- a/core/lib/Thelia/Model/Base/Product.php +++ b/core/lib/Thelia/Model/Base/Product.php @@ -1661,41 +1661,41 @@ abstract class Product implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductTableMap::TAX_RULE_ID)) { - $modifiedColumns[':p' . $index++] = 'TAX_RULE_ID'; + $modifiedColumns[':p' . $index++] = '`TAX_RULE_ID`'; } if ($this->isColumnModified(ProductTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; + $modifiedColumns[':p' . $index++] = '`REF`'; } if ($this->isColumnModified(ProductTableMap::VISIBLE)) { - $modifiedColumns[':p' . $index++] = 'VISIBLE'; + $modifiedColumns[':p' . $index++] = '`VISIBLE`'; } if ($this->isColumnModified(ProductTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) { - $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID'; + $modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`'; } if ($this->isColumnModified(ProductTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProductTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(ProductTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(ProductTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(ProductTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO product (%s) VALUES (%s)', + 'INSERT INTO `product` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1704,37 +1704,37 @@ abstract class Product implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'TAX_RULE_ID': + case '`TAX_RULE_ID`': $stmt->bindValue($identifier, $this->tax_rule_id, PDO::PARAM_INT); break; - case 'REF': + case '`REF`': $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); break; - case 'VISIBLE': + case '`VISIBLE`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'TEMPLATE_ID': + case '`TEMPLATE_ID`': $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductAssociatedContent.php b/core/lib/Thelia/Model/Base/ProductAssociatedContent.php index 764a7370c..a0ce4312c 100644 --- a/core/lib/Thelia/Model/Base/ProductAssociatedContent.php +++ b/core/lib/Thelia/Model/Base/ProductAssociatedContent.php @@ -904,26 +904,26 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductAssociatedContentTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductAssociatedContentTableMap::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_ID`'; } if ($this->isColumnModified(ProductAssociatedContentTableMap::CONTENT_ID)) { - $modifiedColumns[':p' . $index++] = 'CONTENT_ID'; + $modifiedColumns[':p' . $index++] = '`CONTENT_ID`'; } if ($this->isColumnModified(ProductAssociatedContentTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ProductAssociatedContentTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProductAssociatedContentTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO product_associated_content (%s) VALUES (%s)', + 'INSERT INTO `product_associated_content` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -932,22 +932,22 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PRODUCT_ID': + case '`PRODUCT_ID`': $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); break; - case 'CONTENT_ID': + case '`CONTENT_ID`': $stmt->bindValue($identifier, $this->content_id, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php b/core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php index d387f40ed..6ce76b876 100644 --- a/core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php +++ b/core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php @@ -151,7 +151,7 @@ abstract class ProductAssociatedContentQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PRODUCT_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM product_associated_content WHERE ID = :p0'; + $sql = 'SELECT `ID`, `PRODUCT_ID`, `CONTENT_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `product_associated_content` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductCategory.php b/core/lib/Thelia/Model/Base/ProductCategory.php index 2e00db24a..99448c960 100644 --- a/core/lib/Thelia/Model/Base/ProductCategory.php +++ b/core/lib/Thelia/Model/Base/ProductCategory.php @@ -867,23 +867,23 @@ abstract class ProductCategory implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductCategoryTableMap::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_ID`'; } if ($this->isColumnModified(ProductCategoryTableMap::CATEGORY_ID)) { - $modifiedColumns[':p' . $index++] = 'CATEGORY_ID'; + $modifiedColumns[':p' . $index++] = '`CATEGORY_ID`'; } if ($this->isColumnModified(ProductCategoryTableMap::DEFAULT_CATEGORY)) { - $modifiedColumns[':p' . $index++] = 'DEFAULT_CATEGORY'; + $modifiedColumns[':p' . $index++] = '`DEFAULT_CATEGORY`'; } if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProductCategoryTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO product_category (%s) VALUES (%s)', + 'INSERT INTO `product_category` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -892,19 +892,19 @@ abstract class ProductCategory implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'PRODUCT_ID': + case '`PRODUCT_ID`': $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); break; - case 'CATEGORY_ID': + case '`CATEGORY_ID`': $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); break; - case 'DEFAULT_CATEGORY': + case '`DEFAULT_CATEGORY`': $stmt->bindValue($identifier, (int) $this->default_category, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductCategoryQuery.php b/core/lib/Thelia/Model/Base/ProductCategoryQuery.php index df9fc630b..1d1e28830 100644 --- a/core/lib/Thelia/Model/Base/ProductCategoryQuery.php +++ b/core/lib/Thelia/Model/Base/ProductCategoryQuery.php @@ -147,7 +147,7 @@ abstract class ProductCategoryQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT PRODUCT_ID, CATEGORY_ID, DEFAULT_CATEGORY, CREATED_AT, UPDATED_AT FROM product_category WHERE PRODUCT_ID = :p0 AND CATEGORY_ID = :p1'; + $sql = 'SELECT `PRODUCT_ID`, `CATEGORY_ID`, `DEFAULT_CATEGORY`, `CREATED_AT`, `UPDATED_AT` FROM `product_category` WHERE `PRODUCT_ID` = :p0 AND `CATEGORY_ID` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductDocument.php b/core/lib/Thelia/Model/Base/ProductDocument.php index 507539f45..e29fc582a 100644 --- a/core/lib/Thelia/Model/Base/ProductDocument.php +++ b/core/lib/Thelia/Model/Base/ProductDocument.php @@ -930,26 +930,26 @@ abstract class ProductDocument implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductDocumentTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductDocumentTableMap::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_ID`'; } if ($this->isColumnModified(ProductDocumentTableMap::FILE)) { - $modifiedColumns[':p' . $index++] = 'FILE'; + $modifiedColumns[':p' . $index++] = '`FILE`'; } if ($this->isColumnModified(ProductDocumentTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ProductDocumentTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProductDocumentTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO product_document (%s) VALUES (%s)', + 'INSERT INTO `product_document` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -958,22 +958,22 @@ abstract class ProductDocument implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PRODUCT_ID': + case '`PRODUCT_ID`': $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); break; - case 'FILE': + case '`FILE`': $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductDocumentI18n.php b/core/lib/Thelia/Model/Base/ProductDocumentI18n.php index 2dff23586..18ec53fa2 100644 --- a/core/lib/Thelia/Model/Base/ProductDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/ProductDocumentI18n.php @@ -858,26 +858,26 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductDocumentI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductDocumentI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ProductDocumentI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ProductDocumentI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ProductDocumentI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ProductDocumentI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO product_document_i18n (%s) VALUES (%s)', + 'INSERT INTO `product_document_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductDocumentI18nQuery.php b/core/lib/Thelia/Model/Base/ProductDocumentI18nQuery.php index 5bd94d297..79d4854b4 100644 --- a/core/lib/Thelia/Model/Base/ProductDocumentI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ProductDocumentI18nQuery.php @@ -147,7 +147,7 @@ abstract class ProductDocumentI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM product_document_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `product_document_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductDocumentQuery.php b/core/lib/Thelia/Model/Base/ProductDocumentQuery.php index 06af05a9c..f5d9d446c 100644 --- a/core/lib/Thelia/Model/Base/ProductDocumentQuery.php +++ b/core/lib/Thelia/Model/Base/ProductDocumentQuery.php @@ -152,7 +152,7 @@ abstract class ProductDocumentQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PRODUCT_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM product_document WHERE ID = :p0'; + $sql = 'SELECT `ID`, `PRODUCT_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `product_document` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductI18n.php b/core/lib/Thelia/Model/Base/ProductI18n.php index 44f67373d..b76519fe0 100644 --- a/core/lib/Thelia/Model/Base/ProductI18n.php +++ b/core/lib/Thelia/Model/Base/ProductI18n.php @@ -981,35 +981,35 @@ abstract class ProductI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ProductI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ProductI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ProductI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ProductI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } if ($this->isColumnModified(ProductI18nTableMap::META_TITLE)) { - $modifiedColumns[':p' . $index++] = 'META_TITLE'; + $modifiedColumns[':p' . $index++] = '`META_TITLE`'; } if ($this->isColumnModified(ProductI18nTableMap::META_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'META_DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`META_DESCRIPTION`'; } if ($this->isColumnModified(ProductI18nTableMap::META_KEYWORDS)) { - $modifiedColumns[':p' . $index++] = 'META_KEYWORDS'; + $modifiedColumns[':p' . $index++] = '`META_KEYWORDS`'; } $sql = sprintf( - 'INSERT INTO product_i18n (%s) VALUES (%s)', + 'INSERT INTO `product_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1018,31 +1018,31 @@ abstract class ProductI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; - case 'META_TITLE': + case '`META_TITLE`': $stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR); break; - case 'META_DESCRIPTION': + case '`META_DESCRIPTION`': $stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR); break; - case 'META_KEYWORDS': + case '`META_KEYWORDS`': $stmt->bindValue($identifier, $this->meta_keywords, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductI18nQuery.php b/core/lib/Thelia/Model/Base/ProductI18nQuery.php index c9eae20ad..ab99a0ef2 100644 --- a/core/lib/Thelia/Model/Base/ProductI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ProductI18nQuery.php @@ -159,7 +159,7 @@ abstract class ProductI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM product_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `META_TITLE`, `META_DESCRIPTION`, `META_KEYWORDS` FROM `product_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductImage.php b/core/lib/Thelia/Model/Base/ProductImage.php index 873aa0ec7..450cf5b91 100644 --- a/core/lib/Thelia/Model/Base/ProductImage.php +++ b/core/lib/Thelia/Model/Base/ProductImage.php @@ -930,26 +930,26 @@ abstract class ProductImage implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductImageTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductImageTableMap::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_ID`'; } if ($this->isColumnModified(ProductImageTableMap::FILE)) { - $modifiedColumns[':p' . $index++] = 'FILE'; + $modifiedColumns[':p' . $index++] = '`FILE`'; } if ($this->isColumnModified(ProductImageTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ProductImageTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProductImageTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO product_image (%s) VALUES (%s)', + 'INSERT INTO `product_image` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -958,22 +958,22 @@ abstract class ProductImage implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PRODUCT_ID': + case '`PRODUCT_ID`': $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); break; - case 'FILE': + case '`FILE`': $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductImageI18n.php b/core/lib/Thelia/Model/Base/ProductImageI18n.php index 76f9b38a9..2b725e831 100644 --- a/core/lib/Thelia/Model/Base/ProductImageI18n.php +++ b/core/lib/Thelia/Model/Base/ProductImageI18n.php @@ -858,26 +858,26 @@ abstract class ProductImageI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductImageI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductImageI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ProductImageI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ProductImageI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ProductImageI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ProductImageI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO product_image_i18n (%s) VALUES (%s)', + 'INSERT INTO `product_image_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class ProductImageI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductImageI18nQuery.php b/core/lib/Thelia/Model/Base/ProductImageI18nQuery.php index c1f34fbb9..cb588e56c 100644 --- a/core/lib/Thelia/Model/Base/ProductImageI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ProductImageI18nQuery.php @@ -147,7 +147,7 @@ abstract class ProductImageI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM product_image_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `product_image_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductImageQuery.php b/core/lib/Thelia/Model/Base/ProductImageQuery.php index 94cb1b361..cb73e994b 100644 --- a/core/lib/Thelia/Model/Base/ProductImageQuery.php +++ b/core/lib/Thelia/Model/Base/ProductImageQuery.php @@ -152,7 +152,7 @@ abstract class ProductImageQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PRODUCT_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM product_image WHERE ID = :p0'; + $sql = 'SELECT `ID`, `PRODUCT_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `product_image` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductPrice.php b/core/lib/Thelia/Model/Base/ProductPrice.php index e5c5b3f27..aa92b460a 100644 --- a/core/lib/Thelia/Model/Base/ProductPrice.php +++ b/core/lib/Thelia/Model/Base/ProductPrice.php @@ -979,29 +979,29 @@ abstract class ProductPrice implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_SALE_ELEMENTS_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_SALE_ELEMENTS_ID`'; } if ($this->isColumnModified(ProductPriceTableMap::CURRENCY_ID)) { - $modifiedColumns[':p' . $index++] = 'CURRENCY_ID'; + $modifiedColumns[':p' . $index++] = '`CURRENCY_ID`'; } if ($this->isColumnModified(ProductPriceTableMap::PRICE)) { - $modifiedColumns[':p' . $index++] = 'PRICE'; + $modifiedColumns[':p' . $index++] = '`PRICE`'; } if ($this->isColumnModified(ProductPriceTableMap::PROMO_PRICE)) { - $modifiedColumns[':p' . $index++] = 'PROMO_PRICE'; + $modifiedColumns[':p' . $index++] = '`PROMO_PRICE`'; } if ($this->isColumnModified(ProductPriceTableMap::FROM_DEFAULT_CURRENCY)) { - $modifiedColumns[':p' . $index++] = 'FROM_DEFAULT_CURRENCY'; + $modifiedColumns[':p' . $index++] = '`FROM_DEFAULT_CURRENCY`'; } if ($this->isColumnModified(ProductPriceTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProductPriceTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO product_price (%s) VALUES (%s)', + 'INSERT INTO `product_price` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1010,25 +1010,25 @@ abstract class ProductPrice implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'PRODUCT_SALE_ELEMENTS_ID': + case '`PRODUCT_SALE_ELEMENTS_ID`': $stmt->bindValue($identifier, $this->product_sale_elements_id, PDO::PARAM_INT); break; - case 'CURRENCY_ID': + case '`CURRENCY_ID`': $stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT); break; - case 'PRICE': + case '`PRICE`': $stmt->bindValue($identifier, $this->price, PDO::PARAM_STR); break; - case 'PROMO_PRICE': + case '`PROMO_PRICE`': $stmt->bindValue($identifier, $this->promo_price, PDO::PARAM_STR); break; - case 'FROM_DEFAULT_CURRENCY': + case '`FROM_DEFAULT_CURRENCY`': $stmt->bindValue($identifier, (int) $this->from_default_currency, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductPriceQuery.php b/core/lib/Thelia/Model/Base/ProductPriceQuery.php index 1ea364459..269fc833c 100644 --- a/core/lib/Thelia/Model/Base/ProductPriceQuery.php +++ b/core/lib/Thelia/Model/Base/ProductPriceQuery.php @@ -155,7 +155,7 @@ abstract class ProductPriceQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, FROM_DEFAULT_CURRENCY, CREATED_AT, UPDATED_AT FROM product_price WHERE PRODUCT_SALE_ELEMENTS_ID = :p0 AND CURRENCY_ID = :p1'; + $sql = 'SELECT `PRODUCT_SALE_ELEMENTS_ID`, `CURRENCY_ID`, `PRICE`, `PROMO_PRICE`, `FROM_DEFAULT_CURRENCY`, `CREATED_AT`, `UPDATED_AT` FROM `product_price` WHERE `PRODUCT_SALE_ELEMENTS_ID` = :p0 AND `CURRENCY_ID` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductQuery.php b/core/lib/Thelia/Model/Base/ProductQuery.php index 9c3b0759c..352b5cc68 100644 --- a/core/lib/Thelia/Model/Base/ProductQuery.php +++ b/core/lib/Thelia/Model/Base/ProductQuery.php @@ -223,7 +223,7 @@ abstract class ProductQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, TEMPLATE_ID, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product WHERE ID = :p0'; + $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductSaleElements.php b/core/lib/Thelia/Model/Base/ProductSaleElements.php index 7911b63f7..3ace78d00 100644 --- a/core/lib/Thelia/Model/Base/ProductSaleElements.php +++ b/core/lib/Thelia/Model/Base/ProductSaleElements.php @@ -1231,41 +1231,41 @@ abstract class ProductSaleElements implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductSaleElementsTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; + $modifiedColumns[':p' . $index++] = '`PRODUCT_ID`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; + $modifiedColumns[':p' . $index++] = '`REF`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::QUANTITY)) { - $modifiedColumns[':p' . $index++] = 'QUANTITY'; + $modifiedColumns[':p' . $index++] = '`QUANTITY`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::PROMO)) { - $modifiedColumns[':p' . $index++] = 'PROMO'; + $modifiedColumns[':p' . $index++] = '`PROMO`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::NEWNESS)) { - $modifiedColumns[':p' . $index++] = 'NEWNESS'; + $modifiedColumns[':p' . $index++] = '`NEWNESS`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::WEIGHT)) { - $modifiedColumns[':p' . $index++] = 'WEIGHT'; + $modifiedColumns[':p' . $index++] = '`WEIGHT`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::IS_DEFAULT)) { - $modifiedColumns[':p' . $index++] = 'IS_DEFAULT'; + $modifiedColumns[':p' . $index++] = '`IS_DEFAULT`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::EAN_CODE)) { - $modifiedColumns[':p' . $index++] = 'EAN_CODE'; + $modifiedColumns[':p' . $index++] = '`EAN_CODE`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProductSaleElementsTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO product_sale_elements (%s) VALUES (%s)', + 'INSERT INTO `product_sale_elements` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1274,37 +1274,37 @@ abstract class ProductSaleElements implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'PRODUCT_ID': + case '`PRODUCT_ID`': $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); break; - case 'REF': + case '`REF`': $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); break; - case 'QUANTITY': + case '`QUANTITY`': $stmt->bindValue($identifier, $this->quantity, PDO::PARAM_STR); break; - case 'PROMO': + case '`PROMO`': $stmt->bindValue($identifier, $this->promo, PDO::PARAM_INT); break; - case 'NEWNESS': + case '`NEWNESS`': $stmt->bindValue($identifier, $this->newness, PDO::PARAM_INT); break; - case 'WEIGHT': + case '`WEIGHT`': $stmt->bindValue($identifier, $this->weight, PDO::PARAM_STR); break; - case 'IS_DEFAULT': + case '`IS_DEFAULT`': $stmt->bindValue($identifier, (int) $this->is_default, PDO::PARAM_INT); break; - case 'EAN_CODE': + case '`EAN_CODE`': $stmt->bindValue($identifier, $this->ean_code, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductSaleElementsQuery.php b/core/lib/Thelia/Model/Base/ProductSaleElementsQuery.php index 3d169d24b..3a46a016d 100644 --- a/core/lib/Thelia/Model/Base/ProductSaleElementsQuery.php +++ b/core/lib/Thelia/Model/Base/ProductSaleElementsQuery.php @@ -179,7 +179,7 @@ abstract class ProductSaleElementsQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PRODUCT_ID, REF, QUANTITY, PROMO, NEWNESS, WEIGHT, IS_DEFAULT, EAN_CODE, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0'; + $sql = 'SELECT `ID`, `PRODUCT_ID`, `REF`, `QUANTITY`, `PROMO`, `NEWNESS`, `WEIGHT`, `IS_DEFAULT`, `EAN_CODE`, `CREATED_AT`, `UPDATED_AT` FROM `product_sale_elements` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProductVersion.php b/core/lib/Thelia/Model/Base/ProductVersion.php index f4327e4f1..54c628afa 100644 --- a/core/lib/Thelia/Model/Base/ProductVersion.php +++ b/core/lib/Thelia/Model/Base/ProductVersion.php @@ -1107,41 +1107,41 @@ abstract class ProductVersion implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProductVersionTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProductVersionTableMap::TAX_RULE_ID)) { - $modifiedColumns[':p' . $index++] = 'TAX_RULE_ID'; + $modifiedColumns[':p' . $index++] = '`TAX_RULE_ID`'; } if ($this->isColumnModified(ProductVersionTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; + $modifiedColumns[':p' . $index++] = '`REF`'; } if ($this->isColumnModified(ProductVersionTableMap::VISIBLE)) { - $modifiedColumns[':p' . $index++] = 'VISIBLE'; + $modifiedColumns[':p' . $index++] = '`VISIBLE`'; } if ($this->isColumnModified(ProductVersionTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) { - $modifiedColumns[':p' . $index++] = 'TEMPLATE_ID'; + $modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`'; } if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProductVersionTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } if ($this->isColumnModified(ProductVersionTableMap::VERSION)) { - $modifiedColumns[':p' . $index++] = 'VERSION'; + $modifiedColumns[':p' . $index++] = '`VERSION`'; } if ($this->isColumnModified(ProductVersionTableMap::VERSION_CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`'; } if ($this->isColumnModified(ProductVersionTableMap::VERSION_CREATED_BY)) { - $modifiedColumns[':p' . $index++] = 'VERSION_CREATED_BY'; + $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`'; } $sql = sprintf( - 'INSERT INTO product_version (%s) VALUES (%s)', + 'INSERT INTO `product_version` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1150,37 +1150,37 @@ abstract class ProductVersion implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'TAX_RULE_ID': + case '`TAX_RULE_ID`': $stmt->bindValue($identifier, $this->tax_rule_id, PDO::PARAM_INT); break; - case 'REF': + case '`REF`': $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); break; - case 'VISIBLE': + case '`VISIBLE`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'TEMPLATE_ID': + case '`TEMPLATE_ID`': $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION': + case '`VERSION`': $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); break; - case 'VERSION_CREATED_AT': + case '`VERSION_CREATED_AT`': $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'VERSION_CREATED_BY': + case '`VERSION_CREATED_BY`': $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProductVersionQuery.php b/core/lib/Thelia/Model/Base/ProductVersionQuery.php index b659becb9..cf017b048 100644 --- a/core/lib/Thelia/Model/Base/ProductVersionQuery.php +++ b/core/lib/Thelia/Model/Base/ProductVersionQuery.php @@ -167,7 +167,7 @@ abstract class ProductVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, TAX_RULE_ID, REF, VISIBLE, POSITION, TEMPLATE_ID, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM product_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product_version` WHERE `ID` = :p0 AND `VERSION` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Profile.php b/core/lib/Thelia/Model/Base/Profile.php index f4796c58e..bbf597814 100644 --- a/core/lib/Thelia/Model/Base/Profile.php +++ b/core/lib/Thelia/Model/Base/Profile.php @@ -962,20 +962,20 @@ abstract class Profile implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProfileTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProfileTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + $modifiedColumns[':p' . $index++] = '`CODE`'; } if ($this->isColumnModified(ProfileTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProfileTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO profile (%s) VALUES (%s)', + 'INSERT INTO `profile` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -984,16 +984,16 @@ abstract class Profile implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': + case '`CODE`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProfileI18n.php b/core/lib/Thelia/Model/Base/ProfileI18n.php index e9f026d6d..8fb69fa12 100644 --- a/core/lib/Thelia/Model/Base/ProfileI18n.php +++ b/core/lib/Thelia/Model/Base/ProfileI18n.php @@ -858,26 +858,26 @@ abstract class ProfileI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProfileI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ProfileI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ProfileI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ProfileI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ProfileI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ProfileI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO profile_i18n (%s) VALUES (%s)', + 'INSERT INTO `profile_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class ProfileI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProfileI18nQuery.php b/core/lib/Thelia/Model/Base/ProfileI18nQuery.php index 3c9367fb4..79a5510df 100644 --- a/core/lib/Thelia/Model/Base/ProfileI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ProfileI18nQuery.php @@ -147,7 +147,7 @@ abstract class ProfileI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM profile_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `profile_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProfileModule.php b/core/lib/Thelia/Model/Base/ProfileModule.php index 11523f35c..52e2986a6 100644 --- a/core/lib/Thelia/Model/Base/ProfileModule.php +++ b/core/lib/Thelia/Model/Base/ProfileModule.php @@ -877,23 +877,23 @@ abstract class ProfileModule implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProfileModuleTableMap::PROFILE_ID)) { - $modifiedColumns[':p' . $index++] = 'PROFILE_ID'; + $modifiedColumns[':p' . $index++] = '`PROFILE_ID`'; } if ($this->isColumnModified(ProfileModuleTableMap::MODULE_ID)) { - $modifiedColumns[':p' . $index++] = 'MODULE_ID'; + $modifiedColumns[':p' . $index++] = '`MODULE_ID`'; } if ($this->isColumnModified(ProfileModuleTableMap::ACCESS)) { - $modifiedColumns[':p' . $index++] = 'ACCESS'; + $modifiedColumns[':p' . $index++] = '`ACCESS`'; } if ($this->isColumnModified(ProfileModuleTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProfileModuleTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO profile_module (%s) VALUES (%s)', + 'INSERT INTO `profile_module` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -902,19 +902,19 @@ abstract class ProfileModule implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'PROFILE_ID': + case '`PROFILE_ID`': $stmt->bindValue($identifier, $this->profile_id, PDO::PARAM_INT); break; - case 'MODULE_ID': + case '`MODULE_ID`': $stmt->bindValue($identifier, $this->module_id, PDO::PARAM_INT); break; - case 'ACCESS': + case '`ACCESS`': $stmt->bindValue($identifier, $this->access, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProfileModuleQuery.php b/core/lib/Thelia/Model/Base/ProfileModuleQuery.php index 6622eae9e..4f49ccb2f 100644 --- a/core/lib/Thelia/Model/Base/ProfileModuleQuery.php +++ b/core/lib/Thelia/Model/Base/ProfileModuleQuery.php @@ -147,7 +147,7 @@ abstract class ProfileModuleQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT PROFILE_ID, MODULE_ID, ACCESS, CREATED_AT, UPDATED_AT FROM profile_module WHERE PROFILE_ID = :p0 AND MODULE_ID = :p1'; + $sql = 'SELECT `PROFILE_ID`, `MODULE_ID`, `ACCESS`, `CREATED_AT`, `UPDATED_AT` FROM `profile_module` WHERE `PROFILE_ID` = :p0 AND `MODULE_ID` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProfileQuery.php b/core/lib/Thelia/Model/Base/ProfileQuery.php index 7937776c5..ad778a354 100644 --- a/core/lib/Thelia/Model/Base/ProfileQuery.php +++ b/core/lib/Thelia/Model/Base/ProfileQuery.php @@ -152,7 +152,7 @@ abstract class ProfileQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, CREATED_AT, UPDATED_AT FROM profile WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CODE`, `CREATED_AT`, `UPDATED_AT` FROM `profile` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ProfileResource.php b/core/lib/Thelia/Model/Base/ProfileResource.php index e4efc6f6a..06f0b8773 100644 --- a/core/lib/Thelia/Model/Base/ProfileResource.php +++ b/core/lib/Thelia/Model/Base/ProfileResource.php @@ -877,23 +877,23 @@ abstract class ProfileResource implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ProfileResourceTableMap::PROFILE_ID)) { - $modifiedColumns[':p' . $index++] = 'PROFILE_ID'; + $modifiedColumns[':p' . $index++] = '`PROFILE_ID`'; } if ($this->isColumnModified(ProfileResourceTableMap::RESOURCE_ID)) { - $modifiedColumns[':p' . $index++] = 'RESOURCE_ID'; + $modifiedColumns[':p' . $index++] = '`RESOURCE_ID`'; } if ($this->isColumnModified(ProfileResourceTableMap::ACCESS)) { - $modifiedColumns[':p' . $index++] = 'ACCESS'; + $modifiedColumns[':p' . $index++] = '`ACCESS`'; } if ($this->isColumnModified(ProfileResourceTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ProfileResourceTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO profile_resource (%s) VALUES (%s)', + 'INSERT INTO `profile_resource` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -902,19 +902,19 @@ abstract class ProfileResource implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'PROFILE_ID': + case '`PROFILE_ID`': $stmt->bindValue($identifier, $this->profile_id, PDO::PARAM_INT); break; - case 'RESOURCE_ID': + case '`RESOURCE_ID`': $stmt->bindValue($identifier, $this->resource_id, PDO::PARAM_INT); break; - case 'ACCESS': + case '`ACCESS`': $stmt->bindValue($identifier, $this->access, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ProfileResourceQuery.php b/core/lib/Thelia/Model/Base/ProfileResourceQuery.php index c33ba7daa..e836ec5e0 100644 --- a/core/lib/Thelia/Model/Base/ProfileResourceQuery.php +++ b/core/lib/Thelia/Model/Base/ProfileResourceQuery.php @@ -147,7 +147,7 @@ abstract class ProfileResourceQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT PROFILE_ID, RESOURCE_ID, ACCESS, CREATED_AT, UPDATED_AT FROM profile_resource WHERE PROFILE_ID = :p0 AND RESOURCE_ID = :p1'; + $sql = 'SELECT `PROFILE_ID`, `RESOURCE_ID`, `ACCESS`, `CREATED_AT`, `UPDATED_AT` FROM `profile_resource` WHERE `PROFILE_ID` = :p0 AND `RESOURCE_ID` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Resource.php b/core/lib/Thelia/Model/Base/Resource.php index 166fa7a16..1f899ec81 100644 --- a/core/lib/Thelia/Model/Base/Resource.php +++ b/core/lib/Thelia/Model/Base/Resource.php @@ -895,20 +895,20 @@ abstract class Resource implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ResourceTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ResourceTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + $modifiedColumns[':p' . $index++] = '`CODE`'; } if ($this->isColumnModified(ResourceTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(ResourceTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO resource (%s) VALUES (%s)', + 'INSERT INTO `resource` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -917,16 +917,16 @@ abstract class Resource implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': + case '`CODE`': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ResourceI18n.php b/core/lib/Thelia/Model/Base/ResourceI18n.php index bd1104a90..3a9ac35be 100644 --- a/core/lib/Thelia/Model/Base/ResourceI18n.php +++ b/core/lib/Thelia/Model/Base/ResourceI18n.php @@ -858,26 +858,26 @@ abstract class ResourceI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(ResourceI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(ResourceI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(ResourceI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(ResourceI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } if ($this->isColumnModified(ResourceI18nTableMap::CHAPO)) { - $modifiedColumns[':p' . $index++] = 'CHAPO'; + $modifiedColumns[':p' . $index++] = '`CHAPO`'; } if ($this->isColumnModified(ResourceI18nTableMap::POSTSCRIPTUM)) { - $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; + $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`'; } $sql = sprintf( - 'INSERT INTO resource_i18n (%s) VALUES (%s)', + 'INSERT INTO `resource_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -886,22 +886,22 @@ abstract class ResourceI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; - case 'CHAPO': + case '`CHAPO`': $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR); break; - case 'POSTSCRIPTUM': + case '`POSTSCRIPTUM`': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/ResourceI18nQuery.php b/core/lib/Thelia/Model/Base/ResourceI18nQuery.php index 8c9872943..839d212dc 100644 --- a/core/lib/Thelia/Model/Base/ResourceI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ResourceI18nQuery.php @@ -147,7 +147,7 @@ abstract class ResourceI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM resource_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `resource_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/ResourceQuery.php b/core/lib/Thelia/Model/Base/ResourceQuery.php index 72888d6a9..613ab700a 100644 --- a/core/lib/Thelia/Model/Base/ResourceQuery.php +++ b/core/lib/Thelia/Model/Base/ResourceQuery.php @@ -144,7 +144,7 @@ abstract class ResourceQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, CREATED_AT, UPDATED_AT FROM resource WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CODE`, `CREATED_AT`, `UPDATED_AT` FROM `resource` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/RewritingArgument.php b/core/lib/Thelia/Model/Base/RewritingArgument.php index e34778574..66ad972de 100644 --- a/core/lib/Thelia/Model/Base/RewritingArgument.php +++ b/core/lib/Thelia/Model/Base/RewritingArgument.php @@ -837,23 +837,23 @@ abstract class RewritingArgument implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(RewritingArgumentTableMap::REWRITING_URL_ID)) { - $modifiedColumns[':p' . $index++] = 'REWRITING_URL_ID'; + $modifiedColumns[':p' . $index++] = '`REWRITING_URL_ID`'; } if ($this->isColumnModified(RewritingArgumentTableMap::PARAMETER)) { - $modifiedColumns[':p' . $index++] = 'PARAMETER'; + $modifiedColumns[':p' . $index++] = '`PARAMETER`'; } if ($this->isColumnModified(RewritingArgumentTableMap::VALUE)) { - $modifiedColumns[':p' . $index++] = 'VALUE'; + $modifiedColumns[':p' . $index++] = '`VALUE`'; } if ($this->isColumnModified(RewritingArgumentTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(RewritingArgumentTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO rewriting_argument (%s) VALUES (%s)', + 'INSERT INTO `rewriting_argument` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -862,19 +862,19 @@ abstract class RewritingArgument implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'REWRITING_URL_ID': + case '`REWRITING_URL_ID`': $stmt->bindValue($identifier, $this->rewriting_url_id, PDO::PARAM_INT); break; - case 'PARAMETER': + case '`PARAMETER`': $stmt->bindValue($identifier, $this->parameter, PDO::PARAM_STR); break; - case 'VALUE': + case '`VALUE`': $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/RewritingArgumentQuery.php b/core/lib/Thelia/Model/Base/RewritingArgumentQuery.php index cd9ca4fd3..bb4dd9a6d 100644 --- a/core/lib/Thelia/Model/Base/RewritingArgumentQuery.php +++ b/core/lib/Thelia/Model/Base/RewritingArgumentQuery.php @@ -143,7 +143,7 @@ abstract class RewritingArgumentQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT REWRITING_URL_ID, PARAMETER, VALUE, CREATED_AT, UPDATED_AT FROM rewriting_argument WHERE REWRITING_URL_ID = :p0 AND PARAMETER = :p1 AND VALUE = :p2'; + $sql = 'SELECT `REWRITING_URL_ID`, `PARAMETER`, `VALUE`, `CREATED_AT`, `UPDATED_AT` FROM `rewriting_argument` WHERE `REWRITING_URL_ID` = :p0 AND `PARAMETER` = :p1 AND `VALUE` = :p2'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/RewritingUrl.php b/core/lib/Thelia/Model/Base/RewritingUrl.php index 06fa093b2..979ce378c 100644 --- a/core/lib/Thelia/Model/Base/RewritingUrl.php +++ b/core/lib/Thelia/Model/Base/RewritingUrl.php @@ -1028,32 +1028,32 @@ abstract class RewritingUrl implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(RewritingUrlTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(RewritingUrlTableMap::URL)) { - $modifiedColumns[':p' . $index++] = 'URL'; + $modifiedColumns[':p' . $index++] = '`URL`'; } if ($this->isColumnModified(RewritingUrlTableMap::VIEW)) { - $modifiedColumns[':p' . $index++] = 'VIEW'; + $modifiedColumns[':p' . $index++] = '`VIEW`'; } if ($this->isColumnModified(RewritingUrlTableMap::VIEW_ID)) { - $modifiedColumns[':p' . $index++] = 'VIEW_ID'; + $modifiedColumns[':p' . $index++] = '`VIEW_ID`'; } if ($this->isColumnModified(RewritingUrlTableMap::VIEW_LOCALE)) { - $modifiedColumns[':p' . $index++] = 'VIEW_LOCALE'; + $modifiedColumns[':p' . $index++] = '`VIEW_LOCALE`'; } if ($this->isColumnModified(RewritingUrlTableMap::REDIRECTED)) { - $modifiedColumns[':p' . $index++] = 'REDIRECTED'; + $modifiedColumns[':p' . $index++] = '`REDIRECTED`'; } if ($this->isColumnModified(RewritingUrlTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(RewritingUrlTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO rewriting_url (%s) VALUES (%s)', + 'INSERT INTO `rewriting_url` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1062,28 +1062,28 @@ abstract class RewritingUrl implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'URL': + case '`URL`': $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); break; - case 'VIEW': + case '`VIEW`': $stmt->bindValue($identifier, $this->view, PDO::PARAM_STR); break; - case 'VIEW_ID': + case '`VIEW_ID`': $stmt->bindValue($identifier, $this->view_id, PDO::PARAM_STR); break; - case 'VIEW_LOCALE': + case '`VIEW_LOCALE`': $stmt->bindValue($identifier, $this->view_locale, PDO::PARAM_STR); break; - case 'REDIRECTED': + case '`REDIRECTED`': $stmt->bindValue($identifier, $this->redirected, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/RewritingUrlQuery.php b/core/lib/Thelia/Model/Base/RewritingUrlQuery.php index c3c73b923..9c6a0450b 100644 --- a/core/lib/Thelia/Model/Base/RewritingUrlQuery.php +++ b/core/lib/Thelia/Model/Base/RewritingUrlQuery.php @@ -163,7 +163,7 @@ abstract class RewritingUrlQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, URL, VIEW, VIEW_ID, VIEW_LOCALE, REDIRECTED, CREATED_AT, UPDATED_AT FROM rewriting_url WHERE ID = :p0'; + $sql = 'SELECT `ID`, `URL`, `VIEW`, `VIEW_ID`, `VIEW_LOCALE`, `REDIRECTED`, `CREATED_AT`, `UPDATED_AT` FROM `rewriting_url` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Tax.php b/core/lib/Thelia/Model/Base/Tax.php index 2ca5a8735..51a5aed11 100644 --- a/core/lib/Thelia/Model/Base/Tax.php +++ b/core/lib/Thelia/Model/Base/Tax.php @@ -895,23 +895,23 @@ abstract class Tax implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(TaxTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(TaxTableMap::TYPE)) { - $modifiedColumns[':p' . $index++] = 'TYPE'; + $modifiedColumns[':p' . $index++] = '`TYPE`'; } if ($this->isColumnModified(TaxTableMap::SERIALIZED_REQUIREMENTS)) { - $modifiedColumns[':p' . $index++] = 'SERIALIZED_REQUIREMENTS'; + $modifiedColumns[':p' . $index++] = '`SERIALIZED_REQUIREMENTS`'; } if ($this->isColumnModified(TaxTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(TaxTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO tax (%s) VALUES (%s)', + 'INSERT INTO `tax` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -920,19 +920,19 @@ abstract class Tax implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'TYPE': + case '`TYPE`': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; - case 'SERIALIZED_REQUIREMENTS': + case '`SERIALIZED_REQUIREMENTS`': $stmt->bindValue($identifier, $this->serialized_requirements, PDO::PARAM_STR); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/TaxI18n.php b/core/lib/Thelia/Model/Base/TaxI18n.php index cedf8b348..2a4a2d316 100644 --- a/core/lib/Thelia/Model/Base/TaxI18n.php +++ b/core/lib/Thelia/Model/Base/TaxI18n.php @@ -776,20 +776,20 @@ abstract class TaxI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(TaxI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(TaxI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(TaxI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(TaxI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } $sql = sprintf( - 'INSERT INTO tax_i18n (%s) VALUES (%s)', + 'INSERT INTO `tax_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -798,16 +798,16 @@ abstract class TaxI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/TaxI18nQuery.php b/core/lib/Thelia/Model/Base/TaxI18nQuery.php index e23b36155..7514a394a 100644 --- a/core/lib/Thelia/Model/Base/TaxI18nQuery.php +++ b/core/lib/Thelia/Model/Base/TaxI18nQuery.php @@ -139,7 +139,7 @@ abstract class TaxI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION FROM tax_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION` FROM `tax_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/TaxQuery.php b/core/lib/Thelia/Model/Base/TaxQuery.php index 93da10f53..67fc3a3ec 100644 --- a/core/lib/Thelia/Model/Base/TaxQuery.php +++ b/core/lib/Thelia/Model/Base/TaxQuery.php @@ -148,7 +148,7 @@ abstract class TaxQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, TYPE, SERIALIZED_REQUIREMENTS, CREATED_AT, UPDATED_AT FROM tax WHERE ID = :p0'; + $sql = 'SELECT `ID`, `TYPE`, `SERIALIZED_REQUIREMENTS`, `CREATED_AT`, `UPDATED_AT` FROM `tax` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/TaxRule.php b/core/lib/Thelia/Model/Base/TaxRule.php index 7accb0df8..e56dfa622 100644 --- a/core/lib/Thelia/Model/Base/TaxRule.php +++ b/core/lib/Thelia/Model/Base/TaxRule.php @@ -914,20 +914,20 @@ abstract class TaxRule implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(TaxRuleTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(TaxRuleTableMap::IS_DEFAULT)) { - $modifiedColumns[':p' . $index++] = 'IS_DEFAULT'; + $modifiedColumns[':p' . $index++] = '`IS_DEFAULT`'; } if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(TaxRuleTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO tax_rule (%s) VALUES (%s)', + 'INSERT INTO `tax_rule` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -936,16 +936,16 @@ abstract class TaxRule implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'IS_DEFAULT': + case '`IS_DEFAULT`': $stmt->bindValue($identifier, (int) $this->is_default, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/TaxRuleCountry.php b/core/lib/Thelia/Model/Base/TaxRuleCountry.php index de527540c..a6d24e68a 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleCountry.php +++ b/core/lib/Thelia/Model/Base/TaxRuleCountry.php @@ -922,26 +922,26 @@ abstract class TaxRuleCountry implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_RULE_ID)) { - $modifiedColumns[':p' . $index++] = 'TAX_RULE_ID'; + $modifiedColumns[':p' . $index++] = '`TAX_RULE_ID`'; } if ($this->isColumnModified(TaxRuleCountryTableMap::COUNTRY_ID)) { - $modifiedColumns[':p' . $index++] = 'COUNTRY_ID'; + $modifiedColumns[':p' . $index++] = '`COUNTRY_ID`'; } if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_ID)) { - $modifiedColumns[':p' . $index++] = 'TAX_ID'; + $modifiedColumns[':p' . $index++] = '`TAX_ID`'; } if ($this->isColumnModified(TaxRuleCountryTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + $modifiedColumns[':p' . $index++] = '`POSITION`'; } if ($this->isColumnModified(TaxRuleCountryTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(TaxRuleCountryTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO tax_rule_country (%s) VALUES (%s)', + 'INSERT INTO `tax_rule_country` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -950,22 +950,22 @@ abstract class TaxRuleCountry implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'TAX_RULE_ID': + case '`TAX_RULE_ID`': $stmt->bindValue($identifier, $this->tax_rule_id, PDO::PARAM_INT); break; - case 'COUNTRY_ID': + case '`COUNTRY_ID`': $stmt->bindValue($identifier, $this->country_id, PDO::PARAM_INT); break; - case 'TAX_ID': + case '`TAX_ID`': $stmt->bindValue($identifier, $this->tax_id, PDO::PARAM_INT); break; - case 'POSITION': + case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/TaxRuleCountryQuery.php b/core/lib/Thelia/Model/Base/TaxRuleCountryQuery.php index 5674643f7..02f5079af 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleCountryQuery.php +++ b/core/lib/Thelia/Model/Base/TaxRuleCountryQuery.php @@ -155,7 +155,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT TAX_RULE_ID, COUNTRY_ID, TAX_ID, POSITION, CREATED_AT, UPDATED_AT FROM tax_rule_country WHERE TAX_RULE_ID = :p0 AND COUNTRY_ID = :p1 AND TAX_ID = :p2'; + $sql = 'SELECT `TAX_RULE_ID`, `COUNTRY_ID`, `TAX_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `tax_rule_country` WHERE `TAX_RULE_ID` = :p0 AND `COUNTRY_ID` = :p1 AND `TAX_ID` = :p2'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/TaxRuleI18n.php b/core/lib/Thelia/Model/Base/TaxRuleI18n.php index 535195fb7..b28787f05 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleI18n.php +++ b/core/lib/Thelia/Model/Base/TaxRuleI18n.php @@ -776,20 +776,20 @@ abstract class TaxRuleI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(TaxRuleI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(TaxRuleI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(TaxRuleI18nTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; + $modifiedColumns[':p' . $index++] = '`TITLE`'; } if ($this->isColumnModified(TaxRuleI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } $sql = sprintf( - 'INSERT INTO tax_rule_i18n (%s) VALUES (%s)', + 'INSERT INTO `tax_rule_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -798,16 +798,16 @@ abstract class TaxRuleI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'TITLE': + case '`TITLE`': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': + case '`DESCRIPTION`': $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/TaxRuleI18nQuery.php b/core/lib/Thelia/Model/Base/TaxRuleI18nQuery.php index dfb3e100c..25ad51db5 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleI18nQuery.php +++ b/core/lib/Thelia/Model/Base/TaxRuleI18nQuery.php @@ -139,7 +139,7 @@ abstract class TaxRuleI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION FROM tax_rule_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION` FROM `tax_rule_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/TaxRuleQuery.php b/core/lib/Thelia/Model/Base/TaxRuleQuery.php index bc20c44b1..5d2743bfd 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleQuery.php +++ b/core/lib/Thelia/Model/Base/TaxRuleQuery.php @@ -148,7 +148,7 @@ abstract class TaxRuleQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM tax_rule WHERE ID = :p0'; + $sql = 'SELECT `ID`, `IS_DEFAULT`, `CREATED_AT`, `UPDATED_AT` FROM `tax_rule` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/Template.php b/core/lib/Thelia/Model/Base/Template.php index fdb767c96..922c9e5a4 100644 --- a/core/lib/Thelia/Model/Base/Template.php +++ b/core/lib/Thelia/Model/Base/Template.php @@ -962,17 +962,17 @@ abstract class Template implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(TemplateTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(TemplateTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } if ($this->isColumnModified(TemplateTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO template (%s) VALUES (%s)', + 'INSERT INTO `template` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -981,13 +981,13 @@ abstract class Template implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CREATED_AT': + case '`CREATED_AT`': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'UPDATED_AT': + case '`UPDATED_AT`': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/TemplateI18n.php b/core/lib/Thelia/Model/Base/TemplateI18n.php index 67ec21bc5..00f022d65 100644 --- a/core/lib/Thelia/Model/Base/TemplateI18n.php +++ b/core/lib/Thelia/Model/Base/TemplateI18n.php @@ -735,17 +735,17 @@ abstract class TemplateI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(TemplateI18nTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + $modifiedColumns[':p' . $index++] = '`ID`'; } if ($this->isColumnModified(TemplateI18nTableMap::LOCALE)) { - $modifiedColumns[':p' . $index++] = 'LOCALE'; + $modifiedColumns[':p' . $index++] = '`LOCALE`'; } if ($this->isColumnModified(TemplateI18nTableMap::NAME)) { - $modifiedColumns[':p' . $index++] = 'NAME'; + $modifiedColumns[':p' . $index++] = '`NAME`'; } $sql = sprintf( - 'INSERT INTO template_i18n (%s) VALUES (%s)', + 'INSERT INTO `template_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -754,13 +754,13 @@ abstract class TemplateI18n implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': + case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'LOCALE': + case '`LOCALE`': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; - case 'NAME': + case '`NAME`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; } diff --git a/core/lib/Thelia/Model/Base/TemplateI18nQuery.php b/core/lib/Thelia/Model/Base/TemplateI18nQuery.php index 12e7b7d1f..2607e770f 100644 --- a/core/lib/Thelia/Model/Base/TemplateI18nQuery.php +++ b/core/lib/Thelia/Model/Base/TemplateI18nQuery.php @@ -135,7 +135,7 @@ abstract class TemplateI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, NAME FROM template_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `NAME` FROM `template_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Base/TemplateQuery.php b/core/lib/Thelia/Model/Base/TemplateQuery.php index 98c588dd8..f6821b35d 100644 --- a/core/lib/Thelia/Model/Base/TemplateQuery.php +++ b/core/lib/Thelia/Model/Base/TemplateQuery.php @@ -148,7 +148,7 @@ abstract class TemplateQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CREATED_AT, UPDATED_AT FROM template WHERE ID = :p0'; + $sql = 'SELECT `ID`, `CREATED_AT`, `UPDATED_AT` FROM `template` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); diff --git a/core/lib/Thelia/Model/Cart.php b/core/lib/Thelia/Model/Cart.php index c1f28bc3d..88d2caa2e 100755 --- a/core/lib/Thelia/Model/Cart.php +++ b/core/lib/Thelia/Model/Cart.php @@ -83,7 +83,6 @@ class Cart extends BaseCart foreach($this->getCartItems() as $cartItem) { $subtotal = $cartItem->getRealPrice(); - $subtotal -= $cartItem->getDiscount(); /* we round it for the unit price, before the quantity factor */ $subtotal = round($taxCalculator->load($cartItem->getProduct(), $country)->getTaxedPrice($subtotal), 2); $subtotal *= $cartItem->getQuantity(); @@ -102,7 +101,6 @@ class Cart extends BaseCart foreach($this->getCartItems() as $cartItem) { $subtotal = $cartItem->getRealPrice(); - $subtotal -= $cartItem->getDiscount(); $subtotal *= $cartItem->getQuantity(); $total += $subtotal; diff --git a/core/lib/Thelia/Model/CouponOrder.php b/core/lib/Thelia/Model/CouponOrder.php deleted file mode 100755 index 65c326e60..000000000 --- a/core/lib/Thelia/Model/CouponOrder.php +++ /dev/null @@ -1,9 +0,0 @@ - array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'Discount', 'Promo', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', 'discount', 'promo', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(CartItemTableMap::ID, CartItemTableMap::CART_ID, CartItemTableMap::PRODUCT_ID, CartItemTableMap::QUANTITY, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, CartItemTableMap::PRICE, CartItemTableMap::PROMO_PRICE, CartItemTableMap::PRICE_END_OF_LIFE, CartItemTableMap::DISCOUNT, CartItemTableMap::PROMO, CartItemTableMap::CREATED_AT, CartItemTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'CART_ID', 'PRODUCT_ID', 'QUANTITY', 'PRODUCT_SALE_ELEMENTS_ID', 'PRICE', 'PROMO_PRICE', 'PRICE_END_OF_LIFE', 'DISCOUNT', 'PROMO', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'cart_id', 'product_id', 'quantity', 'product_sale_elements_id', 'price', 'promo_price', 'price_end_of_life', 'discount', 'promo', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'Promo', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', 'promo', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(CartItemTableMap::ID, CartItemTableMap::CART_ID, CartItemTableMap::PRODUCT_ID, CartItemTableMap::QUANTITY, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, CartItemTableMap::PRICE, CartItemTableMap::PROMO_PRICE, CartItemTableMap::PRICE_END_OF_LIFE, CartItemTableMap::PROMO, CartItemTableMap::CREATED_AT, CartItemTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'CART_ID', 'PRODUCT_ID', 'QUANTITY', 'PRODUCT_SALE_ELEMENTS_ID', 'PRICE', 'PROMO_PRICE', 'PRICE_END_OF_LIFE', 'PROMO', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'cart_id', 'product_id', 'quantity', 'product_sale_elements_id', 'price', 'promo_price', 'price_end_of_life', 'promo', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); /** @@ -156,12 +151,12 @@ class CartItemTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'Discount' => 8, 'Promo' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'discount' => 8, 'promo' => 9, 'createdAt' => 10, 'updatedAt' => 11, ), - self::TYPE_COLNAME => array(CartItemTableMap::ID => 0, CartItemTableMap::CART_ID => 1, CartItemTableMap::PRODUCT_ID => 2, CartItemTableMap::QUANTITY => 3, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID => 4, CartItemTableMap::PRICE => 5, CartItemTableMap::PROMO_PRICE => 6, CartItemTableMap::PRICE_END_OF_LIFE => 7, CartItemTableMap::DISCOUNT => 8, CartItemTableMap::PROMO => 9, CartItemTableMap::CREATED_AT => 10, CartItemTableMap::UPDATED_AT => 11, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CART_ID' => 1, 'PRODUCT_ID' => 2, 'QUANTITY' => 3, 'PRODUCT_SALE_ELEMENTS_ID' => 4, 'PRICE' => 5, 'PROMO_PRICE' => 6, 'PRICE_END_OF_LIFE' => 7, 'DISCOUNT' => 8, 'PROMO' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ), - self::TYPE_FIELDNAME => array('id' => 0, 'cart_id' => 1, 'product_id' => 2, 'quantity' => 3, 'product_sale_elements_id' => 4, 'price' => 5, 'promo_price' => 6, 'price_end_of_life' => 7, 'discount' => 8, 'promo' => 9, 'created_at' => 10, 'updated_at' => 11, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'Promo' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'promo' => 8, 'createdAt' => 9, 'updatedAt' => 10, ), + self::TYPE_COLNAME => array(CartItemTableMap::ID => 0, CartItemTableMap::CART_ID => 1, CartItemTableMap::PRODUCT_ID => 2, CartItemTableMap::QUANTITY => 3, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID => 4, CartItemTableMap::PRICE => 5, CartItemTableMap::PROMO_PRICE => 6, CartItemTableMap::PRICE_END_OF_LIFE => 7, CartItemTableMap::PROMO => 8, CartItemTableMap::CREATED_AT => 9, CartItemTableMap::UPDATED_AT => 10, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CART_ID' => 1, 'PRODUCT_ID' => 2, 'QUANTITY' => 3, 'PRODUCT_SALE_ELEMENTS_ID' => 4, 'PRICE' => 5, 'PROMO_PRICE' => 6, 'PRICE_END_OF_LIFE' => 7, 'PROMO' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ), + self::TYPE_FIELDNAME => array('id' => 0, 'cart_id' => 1, 'product_id' => 2, 'quantity' => 3, 'product_sale_elements_id' => 4, 'price' => 5, 'promo_price' => 6, 'price_end_of_life' => 7, 'promo' => 8, 'created_at' => 9, 'updated_at' => 10, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); /** @@ -188,7 +183,6 @@ class CartItemTableMap extends TableMap $this->addColumn('PRICE', 'Price', 'FLOAT', false, null, null); $this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null); $this->addColumn('PRICE_END_OF_LIFE', 'PriceEndOfLife', 'TIMESTAMP', false, null, null); - $this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, 0); $this->addColumn('PROMO', 'Promo', 'INTEGER', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -363,7 +357,6 @@ class CartItemTableMap extends TableMap $criteria->addSelectColumn(CartItemTableMap::PRICE); $criteria->addSelectColumn(CartItemTableMap::PROMO_PRICE); $criteria->addSelectColumn(CartItemTableMap::PRICE_END_OF_LIFE); - $criteria->addSelectColumn(CartItemTableMap::DISCOUNT); $criteria->addSelectColumn(CartItemTableMap::PROMO); $criteria->addSelectColumn(CartItemTableMap::CREATED_AT); $criteria->addSelectColumn(CartItemTableMap::UPDATED_AT); @@ -376,7 +369,6 @@ class CartItemTableMap extends TableMap $criteria->addSelectColumn($alias . '.PRICE'); $criteria->addSelectColumn($alias . '.PROMO_PRICE'); $criteria->addSelectColumn($alias . '.PRICE_END_OF_LIFE'); - $criteria->addSelectColumn($alias . '.DISCOUNT'); $criteria->addSelectColumn($alias . '.PROMO'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); diff --git a/core/lib/Thelia/Model/Map/CouponOrderTableMap.php b/core/lib/Thelia/Model/Map/OrderCouponTableMap.php similarity index 53% rename from core/lib/Thelia/Model/Map/CouponOrderTableMap.php rename to core/lib/Thelia/Model/Map/OrderCouponTableMap.php index d96183505..b430668c6 100644 --- a/core/lib/Thelia/Model/Map/CouponOrderTableMap.php +++ b/core/lib/Thelia/Model/Map/OrderCouponTableMap.php @@ -10,12 +10,12 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\RelationMap; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMapTrait; -use Thelia\Model\CouponOrder; -use Thelia\Model\CouponOrderQuery; +use Thelia\Model\OrderCoupon; +use Thelia\Model\OrderCouponQuery; /** - * This class defines the structure of the 'coupon_order' table. + * This class defines the structure of the 'order_coupon' table. * * * @@ -25,14 +25,14 @@ use Thelia\Model\CouponOrderQuery; * (i.e. if it's a text column type). * */ -class CouponOrderTableMap extends TableMap +class OrderCouponTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.CouponOrderTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.OrderCouponTableMap'; /** * The default database name for this class @@ -42,22 +42,22 @@ class CouponOrderTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'coupon_order'; + const TABLE_NAME = 'order_coupon'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\CouponOrder'; + const OM_CLASS = '\\Thelia\\Model\\OrderCoupon'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.CouponOrder'; + const CLASS_DEFAULT = 'Thelia.Model.OrderCoupon'; /** * The total number of columns */ - const NUM_COLUMNS = 5; + const NUM_COLUMNS = 16; /** * The number of lazy-loaded columns @@ -67,32 +67,87 @@ class CouponOrderTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + const NUM_HYDRATE_COLUMNS = 16; /** * the column name for the ID field */ - const ID = 'coupon_order.ID'; + const ID = 'order_coupon.ID'; /** * the column name for the ORDER_ID field */ - const ORDER_ID = 'coupon_order.ORDER_ID'; + const ORDER_ID = 'order_coupon.ORDER_ID'; /** - * the column name for the VALUE field + * the column name for the CODE field */ - const VALUE = 'coupon_order.VALUE'; + const CODE = 'order_coupon.CODE'; + + /** + * the column name for the TYPE field + */ + const TYPE = 'order_coupon.TYPE'; + + /** + * the column name for the AMOUNT field + */ + const AMOUNT = 'order_coupon.AMOUNT'; + + /** + * the column name for the TITLE field + */ + const TITLE = 'order_coupon.TITLE'; + + /** + * the column name for the SHORT_DESCRIPTION field + */ + const SHORT_DESCRIPTION = 'order_coupon.SHORT_DESCRIPTION'; + + /** + * the column name for the DESCRIPTION field + */ + const DESCRIPTION = 'order_coupon.DESCRIPTION'; + + /** + * the column name for the EXPIRATION_DATE field + */ + const EXPIRATION_DATE = 'order_coupon.EXPIRATION_DATE'; + + /** + * the column name for the MAX_USAGE field + */ + const MAX_USAGE = 'order_coupon.MAX_USAGE'; + + /** + * the column name for the IS_CUMULATIVE field + */ + const IS_CUMULATIVE = 'order_coupon.IS_CUMULATIVE'; + + /** + * the column name for the IS_REMOVING_POSTAGE field + */ + const IS_REMOVING_POSTAGE = 'order_coupon.IS_REMOVING_POSTAGE'; + + /** + * the column name for the IS_AVAILABLE_ON_SPECIAL_OFFERS field + */ + const IS_AVAILABLE_ON_SPECIAL_OFFERS = 'order_coupon.IS_AVAILABLE_ON_SPECIAL_OFFERS'; + + /** + * the column name for the SERIALIZED_CONDITIONS field + */ + const SERIALIZED_CONDITIONS = 'order_coupon.SERIALIZED_CONDITIONS'; /** * the column name for the CREATED_AT field */ - const CREATED_AT = 'coupon_order.CREATED_AT'; + const CREATED_AT = 'order_coupon.CREATED_AT'; /** * the column name for the UPDATED_AT field */ - const UPDATED_AT = 'coupon_order.UPDATED_AT'; + const UPDATED_AT = 'order_coupon.UPDATED_AT'; /** * The default string format for model objects of the related table @@ -106,12 +161,12 @@ class CouponOrderTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'OrderId', 'Value', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'value', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'order_id', 'value', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id', 'OrderId', 'Code', 'Type', 'Amount', 'Title', 'ShortDescription', 'Description', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'SerializedConditions', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'code', 'type', 'amount', 'title', 'shortDescription', 'description', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'serializedConditions', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(OrderCouponTableMap::ID, OrderCouponTableMap::ORDER_ID, OrderCouponTableMap::CODE, OrderCouponTableMap::TYPE, OrderCouponTableMap::AMOUNT, OrderCouponTableMap::TITLE, OrderCouponTableMap::SHORT_DESCRIPTION, OrderCouponTableMap::DESCRIPTION, OrderCouponTableMap::EXPIRATION_DATE, OrderCouponTableMap::MAX_USAGE, OrderCouponTableMap::IS_CUMULATIVE, OrderCouponTableMap::IS_REMOVING_POSTAGE, OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, OrderCouponTableMap::SERIALIZED_CONDITIONS, OrderCouponTableMap::CREATED_AT, OrderCouponTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'CODE', 'TYPE', 'AMOUNT', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'SERIALIZED_CONDITIONS', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'order_id', 'code', 'type', 'amount', 'title', 'short_description', 'description', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'serialized_conditions', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) ); /** @@ -121,12 +176,12 @@ class CouponOrderTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Value' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'value' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), - self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::VALUE => 2, CouponOrderTableMap::CREATED_AT => 3, CouponOrderTableMap::UPDATED_AT => 4, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'VALUE' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'value' => 2, 'created_at' => 3, 'updated_at' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Code' => 2, 'Type' => 3, 'Amount' => 4, 'Title' => 5, 'ShortDescription' => 6, 'Description' => 7, 'ExpirationDate' => 8, 'MaxUsage' => 9, 'IsCumulative' => 10, 'IsRemovingPostage' => 11, 'IsAvailableOnSpecialOffers' => 12, 'SerializedConditions' => 13, 'CreatedAt' => 14, 'UpdatedAt' => 15, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'code' => 2, 'type' => 3, 'amount' => 4, 'title' => 5, 'shortDescription' => 6, 'description' => 7, 'expirationDate' => 8, 'maxUsage' => 9, 'isCumulative' => 10, 'isRemovingPostage' => 11, 'isAvailableOnSpecialOffers' => 12, 'serializedConditions' => 13, 'createdAt' => 14, 'updatedAt' => 15, ), + self::TYPE_COLNAME => array(OrderCouponTableMap::ID => 0, OrderCouponTableMap::ORDER_ID => 1, OrderCouponTableMap::CODE => 2, OrderCouponTableMap::TYPE => 3, OrderCouponTableMap::AMOUNT => 4, OrderCouponTableMap::TITLE => 5, OrderCouponTableMap::SHORT_DESCRIPTION => 6, OrderCouponTableMap::DESCRIPTION => 7, OrderCouponTableMap::EXPIRATION_DATE => 8, OrderCouponTableMap::MAX_USAGE => 9, OrderCouponTableMap::IS_CUMULATIVE => 10, OrderCouponTableMap::IS_REMOVING_POSTAGE => 11, OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 12, OrderCouponTableMap::SERIALIZED_CONDITIONS => 13, OrderCouponTableMap::CREATED_AT => 14, OrderCouponTableMap::UPDATED_AT => 15, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'CODE' => 2, 'TYPE' => 3, 'AMOUNT' => 4, 'TITLE' => 5, 'SHORT_DESCRIPTION' => 6, 'DESCRIPTION' => 7, 'EXPIRATION_DATE' => 8, 'MAX_USAGE' => 9, 'IS_CUMULATIVE' => 10, 'IS_REMOVING_POSTAGE' => 11, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 12, 'SERIALIZED_CONDITIONS' => 13, 'CREATED_AT' => 14, 'UPDATED_AT' => 15, ), + self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'code' => 2, 'type' => 3, 'amount' => 4, 'title' => 5, 'short_description' => 6, 'description' => 7, 'expiration_date' => 8, 'max_usage' => 9, 'is_cumulative' => 10, 'is_removing_postage' => 11, 'is_available_on_special_offers' => 12, 'serialized_conditions' => 13, 'created_at' => 14, 'updated_at' => 15, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ) ); /** @@ -139,15 +194,26 @@ class CouponOrderTableMap extends TableMap public function initialize() { // attributes - $this->setName('coupon_order'); - $this->setPhpName('CouponOrder'); - $this->setClassName('\\Thelia\\Model\\CouponOrder'); + $this->setName('order_coupon'); + $this->setPhpName('OrderCoupon'); + $this->setClassName('\\Thelia\\Model\\OrderCoupon'); $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null); - $this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null); + $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); + $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null); + $this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null); + $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); + $this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null); + $this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null); + $this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null); + $this->addColumn('MAX_USAGE', 'MaxUsage', 'INTEGER', true, null, null); + $this->addColumn('IS_CUMULATIVE', 'IsCumulative', 'BOOLEAN', true, 1, null); + $this->addColumn('IS_REMOVING_POSTAGE', 'IsRemovingPostage', 'BOOLEAN', true, 1, null); + $this->addColumn('IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IsAvailableOnSpecialOffers', 'BOOLEAN', true, 1, null); + $this->addColumn('SERIALIZED_CONDITIONS', 'SerializedConditions', 'LONGVARCHAR', true, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -229,7 +295,7 @@ class CouponOrderTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? CouponOrderTableMap::CLASS_DEFAULT : CouponOrderTableMap::OM_CLASS; + return $withPrefix ? OrderCouponTableMap::CLASS_DEFAULT : OrderCouponTableMap::OM_CLASS; } /** @@ -243,21 +309,21 @@ class CouponOrderTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (CouponOrder object, last column rank) + * @return array (OrderCoupon object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = CouponOrderTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = CouponOrderTableMap::getInstanceFromPool($key))) { + $key = OrderCouponTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = OrderCouponTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, $offset, true); // rehydrate - $col = $offset + CouponOrderTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + OrderCouponTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = CouponOrderTableMap::OM_CLASS; + $cls = OrderCouponTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - CouponOrderTableMap::addInstanceToPool($obj, $key); + OrderCouponTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -280,8 +346,8 @@ class CouponOrderTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = CouponOrderTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = CouponOrderTableMap::getInstanceFromPool($key))) { + $key = OrderCouponTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = OrderCouponTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, 0, true); // rehydrate @@ -290,7 +356,7 @@ class CouponOrderTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - CouponOrderTableMap::addInstanceToPool($obj, $key); + OrderCouponTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -311,15 +377,37 @@ class CouponOrderTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(CouponOrderTableMap::ID); - $criteria->addSelectColumn(CouponOrderTableMap::ORDER_ID); - $criteria->addSelectColumn(CouponOrderTableMap::VALUE); - $criteria->addSelectColumn(CouponOrderTableMap::CREATED_AT); - $criteria->addSelectColumn(CouponOrderTableMap::UPDATED_AT); + $criteria->addSelectColumn(OrderCouponTableMap::ID); + $criteria->addSelectColumn(OrderCouponTableMap::ORDER_ID); + $criteria->addSelectColumn(OrderCouponTableMap::CODE); + $criteria->addSelectColumn(OrderCouponTableMap::TYPE); + $criteria->addSelectColumn(OrderCouponTableMap::AMOUNT); + $criteria->addSelectColumn(OrderCouponTableMap::TITLE); + $criteria->addSelectColumn(OrderCouponTableMap::SHORT_DESCRIPTION); + $criteria->addSelectColumn(OrderCouponTableMap::DESCRIPTION); + $criteria->addSelectColumn(OrderCouponTableMap::EXPIRATION_DATE); + $criteria->addSelectColumn(OrderCouponTableMap::MAX_USAGE); + $criteria->addSelectColumn(OrderCouponTableMap::IS_CUMULATIVE); + $criteria->addSelectColumn(OrderCouponTableMap::IS_REMOVING_POSTAGE); + $criteria->addSelectColumn(OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS); + $criteria->addSelectColumn(OrderCouponTableMap::SERIALIZED_CONDITIONS); + $criteria->addSelectColumn(OrderCouponTableMap::CREATED_AT); + $criteria->addSelectColumn(OrderCouponTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ORDER_ID'); - $criteria->addSelectColumn($alias . '.VALUE'); + $criteria->addSelectColumn($alias . '.CODE'); + $criteria->addSelectColumn($alias . '.TYPE'); + $criteria->addSelectColumn($alias . '.AMOUNT'); + $criteria->addSelectColumn($alias . '.TITLE'); + $criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION'); + $criteria->addSelectColumn($alias . '.DESCRIPTION'); + $criteria->addSelectColumn($alias . '.EXPIRATION_DATE'); + $criteria->addSelectColumn($alias . '.MAX_USAGE'); + $criteria->addSelectColumn($alias . '.IS_CUMULATIVE'); + $criteria->addSelectColumn($alias . '.IS_REMOVING_POSTAGE'); + $criteria->addSelectColumn($alias . '.IS_AVAILABLE_ON_SPECIAL_OFFERS'); + $criteria->addSelectColumn($alias . '.SERIALIZED_CONDITIONS'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } @@ -334,7 +422,7 @@ class CouponOrderTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(CouponOrderTableMap::DATABASE_NAME)->getTable(CouponOrderTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(OrderCouponTableMap::DATABASE_NAME)->getTable(OrderCouponTableMap::TABLE_NAME); } /** @@ -342,16 +430,16 @@ class CouponOrderTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponOrderTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(CouponOrderTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new CouponOrderTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderCouponTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(OrderCouponTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new OrderCouponTableMap()); } } /** - * Performs a DELETE on the database, given a CouponOrder or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a OrderCoupon or Criteria object OR a primary key value. * - * @param mixed $values Criteria or CouponOrder object or primary key or array of primary keys + * @param mixed $values Criteria or OrderCoupon object or primary key or array of primary keys * which is used to create the DELETE statement * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows @@ -362,25 +450,25 @@ class CouponOrderTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(OrderCouponTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\CouponOrder) { // it's a model object + } elseif ($values instanceof \Thelia\Model\OrderCoupon) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks - $criteria = new Criteria(CouponOrderTableMap::DATABASE_NAME); - $criteria->add(CouponOrderTableMap::ID, (array) $values, Criteria::IN); + $criteria = new Criteria(OrderCouponTableMap::DATABASE_NAME); + $criteria->add(OrderCouponTableMap::ID, (array) $values, Criteria::IN); } - $query = CouponOrderQuery::create()->mergeWith($criteria); + $query = OrderCouponQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { CouponOrderTableMap::clearInstancePool(); + if ($values instanceof Criteria) { OrderCouponTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { CouponOrderTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { OrderCouponTableMap::removeInstanceFromPool($singleval); } } @@ -388,20 +476,20 @@ class CouponOrderTableMap extends TableMap } /** - * Deletes all rows from the coupon_order table. + * Deletes all rows from the order_coupon table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ public static function doDeleteAll(ConnectionInterface $con = null) { - return CouponOrderQuery::create()->doDeleteAll($con); + return OrderCouponQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a CouponOrder or Criteria object. + * Performs an INSERT on the database, given a OrderCoupon or Criteria object. * - * @param mixed $criteria Criteria or CouponOrder object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or OrderCoupon object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use * @return mixed The new primary key. * @throws PropelException Any exceptions caught during processing will be @@ -410,22 +498,22 @@ class CouponOrderTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(OrderCouponTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from CouponOrder object + $criteria = $criteria->buildCriteria(); // build Criteria from OrderCoupon object } - if ($criteria->containsKey(CouponOrderTableMap::ID) && $criteria->keyContainsValue(CouponOrderTableMap::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CouponOrderTableMap::ID.')'); + if ($criteria->containsKey(OrderCouponTableMap::ID) && $criteria->keyContainsValue(OrderCouponTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrderCouponTableMap::ID.')'); } // Set the correct dbName - $query = CouponOrderQuery::create()->mergeWith($criteria); + $query = OrderCouponQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -441,7 +529,7 @@ class CouponOrderTableMap extends TableMap return $pk; } -} // CouponOrderTableMap +} // OrderCouponTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -CouponOrderTableMap::buildTableMap(); +OrderCouponTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/OrderTableMap.php b/core/lib/Thelia/Model/Map/OrderTableMap.php index 7daabb665..fcf0ba70d 100644 --- a/core/lib/Thelia/Model/Map/OrderTableMap.php +++ b/core/lib/Thelia/Model/Map/OrderTableMap.php @@ -57,7 +57,7 @@ class OrderTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 18; + const NUM_COLUMNS = 19; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class OrderTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 18; + const NUM_HYDRATE_COLUMNS = 19; /** * the column name for the ID field @@ -124,6 +124,11 @@ class OrderTableMap extends TableMap */ const INVOICE_REF = 'order.INVOICE_REF'; + /** + * the column name for the DISCOUNT field + */ + const DISCOUNT = 'order.DISCOUNT'; + /** * the column name for the POSTAGE field */ @@ -171,12 +176,12 @@ class OrderTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Ref', 'CustomerId', 'InvoiceOrderAddressId', 'DeliveryOrderAddressId', 'InvoiceDate', 'CurrencyId', 'CurrencyRate', 'TransactionRef', 'DeliveryRef', 'InvoiceRef', 'Postage', 'PaymentModuleId', 'DeliveryModuleId', 'StatusId', 'LangId', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'customerId', 'invoiceOrderAddressId', 'deliveryOrderAddressId', 'invoiceDate', 'currencyId', 'currencyRate', 'transactionRef', 'deliveryRef', 'invoiceRef', 'postage', 'paymentModuleId', 'deliveryModuleId', 'statusId', 'langId', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(OrderTableMap::ID, OrderTableMap::REF, OrderTableMap::CUSTOMER_ID, OrderTableMap::INVOICE_ORDER_ADDRESS_ID, OrderTableMap::DELIVERY_ORDER_ADDRESS_ID, OrderTableMap::INVOICE_DATE, OrderTableMap::CURRENCY_ID, OrderTableMap::CURRENCY_RATE, OrderTableMap::TRANSACTION_REF, OrderTableMap::DELIVERY_REF, OrderTableMap::INVOICE_REF, OrderTableMap::POSTAGE, OrderTableMap::PAYMENT_MODULE_ID, OrderTableMap::DELIVERY_MODULE_ID, OrderTableMap::STATUS_ID, OrderTableMap::LANG_ID, OrderTableMap::CREATED_AT, OrderTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'REF', 'CUSTOMER_ID', 'INVOICE_ORDER_ADDRESS_ID', 'DELIVERY_ORDER_ADDRESS_ID', 'INVOICE_DATE', 'CURRENCY_ID', 'CURRENCY_RATE', 'TRANSACTION_REF', 'DELIVERY_REF', 'INVOICE_REF', 'POSTAGE', 'PAYMENT_MODULE_ID', 'DELIVERY_MODULE_ID', 'STATUS_ID', 'LANG_ID', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'ref', 'customer_id', 'invoice_order_address_id', 'delivery_order_address_id', 'invoice_date', 'currency_id', 'currency_rate', 'transaction_ref', 'delivery_ref', 'invoice_ref', 'postage', 'payment_module_id', 'delivery_module_id', 'status_id', 'lang_id', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id', 'Ref', 'CustomerId', 'InvoiceOrderAddressId', 'DeliveryOrderAddressId', 'InvoiceDate', 'CurrencyId', 'CurrencyRate', 'TransactionRef', 'DeliveryRef', 'InvoiceRef', 'Discount', 'Postage', 'PaymentModuleId', 'DeliveryModuleId', 'StatusId', 'LangId', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'customerId', 'invoiceOrderAddressId', 'deliveryOrderAddressId', 'invoiceDate', 'currencyId', 'currencyRate', 'transactionRef', 'deliveryRef', 'invoiceRef', 'discount', 'postage', 'paymentModuleId', 'deliveryModuleId', 'statusId', 'langId', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(OrderTableMap::ID, OrderTableMap::REF, OrderTableMap::CUSTOMER_ID, OrderTableMap::INVOICE_ORDER_ADDRESS_ID, OrderTableMap::DELIVERY_ORDER_ADDRESS_ID, OrderTableMap::INVOICE_DATE, OrderTableMap::CURRENCY_ID, OrderTableMap::CURRENCY_RATE, OrderTableMap::TRANSACTION_REF, OrderTableMap::DELIVERY_REF, OrderTableMap::INVOICE_REF, OrderTableMap::DISCOUNT, OrderTableMap::POSTAGE, OrderTableMap::PAYMENT_MODULE_ID, OrderTableMap::DELIVERY_MODULE_ID, OrderTableMap::STATUS_ID, OrderTableMap::LANG_ID, OrderTableMap::CREATED_AT, OrderTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'REF', 'CUSTOMER_ID', 'INVOICE_ORDER_ADDRESS_ID', 'DELIVERY_ORDER_ADDRESS_ID', 'INVOICE_DATE', 'CURRENCY_ID', 'CURRENCY_RATE', 'TRANSACTION_REF', 'DELIVERY_REF', 'INVOICE_REF', 'DISCOUNT', 'POSTAGE', 'PAYMENT_MODULE_ID', 'DELIVERY_MODULE_ID', 'STATUS_ID', 'LANG_ID', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'ref', 'customer_id', 'invoice_order_address_id', 'delivery_order_address_id', 'invoice_date', 'currency_id', 'currency_rate', 'transaction_ref', 'delivery_ref', 'invoice_ref', 'discount', 'postage', 'payment_module_id', 'delivery_module_id', 'status_id', 'lang_id', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -186,12 +191,12 @@ class OrderTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'CustomerId' => 2, 'InvoiceOrderAddressId' => 3, 'DeliveryOrderAddressId' => 4, 'InvoiceDate' => 5, 'CurrencyId' => 6, 'CurrencyRate' => 7, 'TransactionRef' => 8, 'DeliveryRef' => 9, 'InvoiceRef' => 10, 'Postage' => 11, 'PaymentModuleId' => 12, 'DeliveryModuleId' => 13, 'StatusId' => 14, 'LangId' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'customerId' => 2, 'invoiceOrderAddressId' => 3, 'deliveryOrderAddressId' => 4, 'invoiceDate' => 5, 'currencyId' => 6, 'currencyRate' => 7, 'transactionRef' => 8, 'deliveryRef' => 9, 'invoiceRef' => 10, 'postage' => 11, 'paymentModuleId' => 12, 'deliveryModuleId' => 13, 'statusId' => 14, 'langId' => 15, 'createdAt' => 16, 'updatedAt' => 17, ), - self::TYPE_COLNAME => array(OrderTableMap::ID => 0, OrderTableMap::REF => 1, OrderTableMap::CUSTOMER_ID => 2, OrderTableMap::INVOICE_ORDER_ADDRESS_ID => 3, OrderTableMap::DELIVERY_ORDER_ADDRESS_ID => 4, OrderTableMap::INVOICE_DATE => 5, OrderTableMap::CURRENCY_ID => 6, OrderTableMap::CURRENCY_RATE => 7, OrderTableMap::TRANSACTION_REF => 8, OrderTableMap::DELIVERY_REF => 9, OrderTableMap::INVOICE_REF => 10, OrderTableMap::POSTAGE => 11, OrderTableMap::PAYMENT_MODULE_ID => 12, OrderTableMap::DELIVERY_MODULE_ID => 13, OrderTableMap::STATUS_ID => 14, OrderTableMap::LANG_ID => 15, OrderTableMap::CREATED_AT => 16, OrderTableMap::UPDATED_AT => 17, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'CUSTOMER_ID' => 2, 'INVOICE_ORDER_ADDRESS_ID' => 3, 'DELIVERY_ORDER_ADDRESS_ID' => 4, 'INVOICE_DATE' => 5, 'CURRENCY_ID' => 6, 'CURRENCY_RATE' => 7, 'TRANSACTION_REF' => 8, 'DELIVERY_REF' => 9, 'INVOICE_REF' => 10, 'POSTAGE' => 11, 'PAYMENT_MODULE_ID' => 12, 'DELIVERY_MODULE_ID' => 13, 'STATUS_ID' => 14, 'LANG_ID' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ), - self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'customer_id' => 2, 'invoice_order_address_id' => 3, 'delivery_order_address_id' => 4, 'invoice_date' => 5, 'currency_id' => 6, 'currency_rate' => 7, 'transaction_ref' => 8, 'delivery_ref' => 9, 'invoice_ref' => 10, 'postage' => 11, 'payment_module_id' => 12, 'delivery_module_id' => 13, 'status_id' => 14, 'lang_id' => 15, 'created_at' => 16, 'updated_at' => 17, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'CustomerId' => 2, 'InvoiceOrderAddressId' => 3, 'DeliveryOrderAddressId' => 4, 'InvoiceDate' => 5, 'CurrencyId' => 6, 'CurrencyRate' => 7, 'TransactionRef' => 8, 'DeliveryRef' => 9, 'InvoiceRef' => 10, 'Discount' => 11, 'Postage' => 12, 'PaymentModuleId' => 13, 'DeliveryModuleId' => 14, 'StatusId' => 15, 'LangId' => 16, 'CreatedAt' => 17, 'UpdatedAt' => 18, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'customerId' => 2, 'invoiceOrderAddressId' => 3, 'deliveryOrderAddressId' => 4, 'invoiceDate' => 5, 'currencyId' => 6, 'currencyRate' => 7, 'transactionRef' => 8, 'deliveryRef' => 9, 'invoiceRef' => 10, 'discount' => 11, 'postage' => 12, 'paymentModuleId' => 13, 'deliveryModuleId' => 14, 'statusId' => 15, 'langId' => 16, 'createdAt' => 17, 'updatedAt' => 18, ), + self::TYPE_COLNAME => array(OrderTableMap::ID => 0, OrderTableMap::REF => 1, OrderTableMap::CUSTOMER_ID => 2, OrderTableMap::INVOICE_ORDER_ADDRESS_ID => 3, OrderTableMap::DELIVERY_ORDER_ADDRESS_ID => 4, OrderTableMap::INVOICE_DATE => 5, OrderTableMap::CURRENCY_ID => 6, OrderTableMap::CURRENCY_RATE => 7, OrderTableMap::TRANSACTION_REF => 8, OrderTableMap::DELIVERY_REF => 9, OrderTableMap::INVOICE_REF => 10, OrderTableMap::DISCOUNT => 11, OrderTableMap::POSTAGE => 12, OrderTableMap::PAYMENT_MODULE_ID => 13, OrderTableMap::DELIVERY_MODULE_ID => 14, OrderTableMap::STATUS_ID => 15, OrderTableMap::LANG_ID => 16, OrderTableMap::CREATED_AT => 17, OrderTableMap::UPDATED_AT => 18, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'CUSTOMER_ID' => 2, 'INVOICE_ORDER_ADDRESS_ID' => 3, 'DELIVERY_ORDER_ADDRESS_ID' => 4, 'INVOICE_DATE' => 5, 'CURRENCY_ID' => 6, 'CURRENCY_RATE' => 7, 'TRANSACTION_REF' => 8, 'DELIVERY_REF' => 9, 'INVOICE_REF' => 10, 'DISCOUNT' => 11, 'POSTAGE' => 12, 'PAYMENT_MODULE_ID' => 13, 'DELIVERY_MODULE_ID' => 14, 'STATUS_ID' => 15, 'LANG_ID' => 16, 'CREATED_AT' => 17, 'UPDATED_AT' => 18, ), + self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'customer_id' => 2, 'invoice_order_address_id' => 3, 'delivery_order_address_id' => 4, 'invoice_date' => 5, 'currency_id' => 6, 'currency_rate' => 7, 'transaction_ref' => 8, 'delivery_ref' => 9, 'invoice_ref' => 10, 'discount' => 11, 'postage' => 12, 'payment_module_id' => 13, 'delivery_module_id' => 14, 'status_id' => 15, 'lang_id' => 16, 'created_at' => 17, 'updated_at' => 18, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -221,6 +226,7 @@ class OrderTableMap extends TableMap $this->addColumn('TRANSACTION_REF', 'TransactionRef', 'VARCHAR', false, 100, null); $this->addColumn('DELIVERY_REF', 'DeliveryRef', 'VARCHAR', false, 100, null); $this->addColumn('INVOICE_REF', 'InvoiceRef', 'VARCHAR', false, 100, null); + $this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, null); $this->addColumn('POSTAGE', 'Postage', 'FLOAT', true, null, null); $this->addForeignKey('PAYMENT_MODULE_ID', 'PaymentModuleId', 'INTEGER', 'module', 'ID', true, null, null); $this->addForeignKey('DELIVERY_MODULE_ID', 'DeliveryModuleId', 'INTEGER', 'module', 'ID', true, null, null); @@ -244,7 +250,7 @@ class OrderTableMap extends TableMap $this->addRelation('ModuleRelatedByDeliveryModuleId', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('delivery_module_id' => 'id', ), 'RESTRICT', 'RESTRICT'); $this->addRelation('Lang', '\\Thelia\\Model\\Lang', RelationMap::MANY_TO_ONE, array('lang_id' => 'id', ), 'RESTRICT', 'RESTRICT'); $this->addRelation('OrderProduct', '\\Thelia\\Model\\OrderProduct', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT', 'OrderProducts'); - $this->addRelation('CouponOrder', '\\Thelia\\Model\\CouponOrder', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT', 'CouponOrders'); + $this->addRelation('OrderCoupon', '\\Thelia\\Model\\OrderCoupon', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT', 'OrderCoupons'); } // buildRelations() /** @@ -267,7 +273,7 @@ class OrderTableMap extends TableMap // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. OrderProductTableMap::clearInstancePool(); - CouponOrderTableMap::clearInstancePool(); + OrderCouponTableMap::clearInstancePool(); } /** @@ -419,6 +425,7 @@ class OrderTableMap extends TableMap $criteria->addSelectColumn(OrderTableMap::TRANSACTION_REF); $criteria->addSelectColumn(OrderTableMap::DELIVERY_REF); $criteria->addSelectColumn(OrderTableMap::INVOICE_REF); + $criteria->addSelectColumn(OrderTableMap::DISCOUNT); $criteria->addSelectColumn(OrderTableMap::POSTAGE); $criteria->addSelectColumn(OrderTableMap::PAYMENT_MODULE_ID); $criteria->addSelectColumn(OrderTableMap::DELIVERY_MODULE_ID); @@ -438,6 +445,7 @@ class OrderTableMap extends TableMap $criteria->addSelectColumn($alias . '.TRANSACTION_REF'); $criteria->addSelectColumn($alias . '.DELIVERY_REF'); $criteria->addSelectColumn($alias . '.INVOICE_REF'); + $criteria->addSelectColumn($alias . '.DISCOUNT'); $criteria->addSelectColumn($alias . '.POSTAGE'); $criteria->addSelectColumn($alias . '.PAYMENT_MODULE_ID'); $criteria->addSelectColumn($alias . '.DELIVERY_MODULE_ID'); diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php index d761c3959..56abca4cc 100755 --- a/core/lib/Thelia/Model/Order.php +++ b/core/lib/Thelia/Model/Order.php @@ -55,7 +55,7 @@ class Order extends BaseOrder * * @return float|int|string */ - public function getTotalAmount(&$tax = 0, $includePostage = true) + public function getTotalAmount(&$tax = 0, $includePostage = true, $includeDiscount = true) { $amount = 0; $tax = 0; @@ -79,177 +79,21 @@ class Order extends BaseOrder $total = $amount + $tax; + // @todo : manage discount : free postage ? + if(true === $includeDiscount) { + $total -= $this->getDiscount(); + + if($total<0) { + $total = 0; + } else { + $total = round($total, 2); + } + } + if(false !== $includePostage) { $total += $this->getPostage(); } - return $total; // @todo : manage discount - } - - /** - * PROPEL SHOULD FIX IT - * - * Insert the row in the database. - * - * @param ConnectionInterface $con - * - * @throws PropelException - * @see doSave() - */ - protected function doInsert(ConnectionInterface $con) - { - $modifiedColumns = array(); - $index = 0; - - $this->modifiedColumns[] = OrderTableMap::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderTableMap::ID . ')'); - } - - // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(OrderTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; - } - if ($this->isColumnModified(OrderTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; - } - if ($this->isColumnModified(OrderTableMap::CUSTOMER_ID)) { - $modifiedColumns[':p' . $index++] = 'CUSTOMER_ID'; - } - if ($this->isColumnModified(OrderTableMap::INVOICE_ORDER_ADDRESS_ID)) { - $modifiedColumns[':p' . $index++] = 'INVOICE_ORDER_ADDRESS_ID'; - } - if ($this->isColumnModified(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID)) { - $modifiedColumns[':p' . $index++] = 'DELIVERY_ORDER_ADDRESS_ID'; - } - if ($this->isColumnModified(OrderTableMap::INVOICE_DATE)) { - $modifiedColumns[':p' . $index++] = 'INVOICE_DATE'; - } - if ($this->isColumnModified(OrderTableMap::CURRENCY_ID)) { - $modifiedColumns[':p' . $index++] = 'CURRENCY_ID'; - } - if ($this->isColumnModified(OrderTableMap::CURRENCY_RATE)) { - $modifiedColumns[':p' . $index++] = 'CURRENCY_RATE'; - } - if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) { - $modifiedColumns[':p' . $index++] = 'TRANSACTION_REF'; - } - if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) { - $modifiedColumns[':p' . $index++] = 'DELIVERY_REF'; - } - if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) { - $modifiedColumns[':p' . $index++] = 'INVOICE_REF'; - } - if ($this->isColumnModified(OrderTableMap::POSTAGE)) { - $modifiedColumns[':p' . $index++] = 'POSTAGE'; - } - if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) { - $modifiedColumns[':p' . $index++] = 'PAYMENT_MODULE_ID'; - } - if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) { - $modifiedColumns[':p' . $index++] = 'DELIVERY_MODULE_ID'; - } - if ($this->isColumnModified(OrderTableMap::STATUS_ID)) { - $modifiedColumns[':p' . $index++] = 'STATUS_ID'; - } - if ($this->isColumnModified(OrderTableMap::LANG_ID)) { - $modifiedColumns[':p' . $index++] = 'LANG_ID'; - } - if ($this->isColumnModified(OrderTableMap::CREATED_AT)) { - $modifiedColumns[':p' . $index++] = 'CREATED_AT'; - } - if ($this->isColumnModified(OrderTableMap::UPDATED_AT)) { - $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; - } - - $db = Propel::getServiceContainer()->getAdapter(OrderTableMap::DATABASE_NAME); - - if ($db->useQuoteIdentifier()) { - $tableName = $db->quoteIdentifierTable(OrderTableMap::TABLE_NAME); - } else { - $tableName = OrderTableMap::TABLE_NAME; - } - - $sql = sprintf( - 'INSERT INTO %s (%s) VALUES (%s)', - $tableName, - implode(', ', $modifiedColumns), - implode(', ', array_keys($modifiedColumns)) - ); - - try { - $stmt = $con->prepare($sql); - foreach ($modifiedColumns as $identifier => $columnName) { - switch ($columnName) { - case 'ID': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; - case 'REF': - $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); - break; - case 'CUSTOMER_ID': - $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT); - break; - case 'INVOICE_ORDER_ADDRESS_ID': - $stmt->bindValue($identifier, $this->invoice_order_address_id, PDO::PARAM_INT); - break; - case 'DELIVERY_ORDER_ADDRESS_ID': - $stmt->bindValue($identifier, $this->delivery_order_address_id, PDO::PARAM_INT); - break; - case 'INVOICE_DATE': - $stmt->bindValue($identifier, $this->invoice_date ? $this->invoice_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); - break; - case 'CURRENCY_ID': - $stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT); - break; - case 'CURRENCY_RATE': - $stmt->bindValue($identifier, $this->currency_rate, PDO::PARAM_STR); - break; - case 'TRANSACTION_REF': - $stmt->bindValue($identifier, $this->transaction_ref, PDO::PARAM_STR); - break; - case 'DELIVERY_REF': - $stmt->bindValue($identifier, $this->delivery_ref, PDO::PARAM_STR); - break; - case 'INVOICE_REF': - $stmt->bindValue($identifier, $this->invoice_ref, PDO::PARAM_STR); - break; - case 'POSTAGE': - $stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR); - break; - case 'PAYMENT_MODULE_ID': - $stmt->bindValue($identifier, $this->payment_module_id, PDO::PARAM_INT); - break; - case 'DELIVERY_MODULE_ID': - $stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT); - break; - case 'STATUS_ID': - $stmt->bindValue($identifier, $this->status_id, PDO::PARAM_INT); - break; - case 'LANG_ID': - $stmt->bindValue($identifier, $this->lang_id, PDO::PARAM_INT); - break; - case 'CREATED_AT': - $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); - break; - case 'UPDATED_AT': - $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); - break; - } - } - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); - } - - try { - $pk = $con->lastInsertId(); - } catch (Exception $e) { - throw new PropelException('Unable to get autoincrement id.', 0, $e); - } - $this->setId($pk); - - $this->setNew(false); + return $total; } } diff --git a/core/lib/Thelia/Model/OrderCoupon.php b/core/lib/Thelia/Model/OrderCoupon.php new file mode 100644 index 000000000..558496813 --- /dev/null +++ b/core/lib/Thelia/Model/OrderCoupon.php @@ -0,0 +1,10 @@ +prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (\Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); - } - $obj = null; - if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new Order(); - $obj->hydrate($row); - OrderTableMap::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - public static function getMonthlySaleStats($month, $year) { $numberOfDay = cal_days_in_month(CAL_GREGORIAN, $month, $year); diff --git a/install/thelia.sql b/install/thelia.sql index 1d0ecfb63..f87f5b7d7 100755 --- a/install/thelia.sql +++ b/install/thelia.sql @@ -652,6 +652,7 @@ CREATE TABLE `order` `transaction_ref` VARCHAR(100) COMMENT 'transaction reference - usually use to identify a transaction with banking modules', `delivery_ref` VARCHAR(100) COMMENT 'delivery reference - usually use to identify a delivery progress on a distant delivery tracker website', `invoice_ref` VARCHAR(100) COMMENT 'the invoice reference', + `discount` FLOAT, `postage` FLOAT NOT NULL, `payment_module_id` INTEGER NOT NULL, `delivery_module_id` INTEGER NOT NULL, @@ -1109,28 +1110,6 @@ CREATE TABLE `coupon` INDEX `idx_is_available_on_special_offers` (`is_available_on_special_offers`) ) ENGINE=InnoDB; --- --------------------------------------------------------------------- --- coupon_order --- --------------------------------------------------------------------- - -DROP TABLE IF EXISTS `coupon_order`; - -CREATE TABLE `coupon_order` -( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `order_id` INTEGER NOT NULL, - `value` FLOAT NOT NULL, - `created_at` DATETIME, - `updated_at` DATETIME, - PRIMARY KEY (`id`), - INDEX `idx_coupon_order_order_id` (`order_id`), - CONSTRAINT `fk_coupon_order_order_id` - FOREIGN KEY (`order_id`) - REFERENCES `order` (`id`) - ON UPDATE RESTRICT - ON DELETE CASCADE -) ENGINE=InnoDB; - -- --------------------------------------------------------------------- -- admin_log -- --------------------------------------------------------------------- @@ -1242,7 +1221,6 @@ CREATE TABLE `cart_item` `price` FLOAT, `promo_price` FLOAT, `price_end_of_life` DATETIME, - `discount` FLOAT DEFAULT 0, `promo` INTEGER, `created_at` DATETIME, `updated_at` DATETIME, @@ -1621,6 +1599,39 @@ CREATE TABLE `newsletter` UNIQUE INDEX `email_UNIQUE` (`email`) ) ENGINE=InnoDB; +-- --------------------------------------------------------------------- +-- order_coupon +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `order_coupon`; + +CREATE TABLE `order_coupon` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `order_id` INTEGER NOT NULL, + `code` VARCHAR(45) NOT NULL, + `type` VARCHAR(255) NOT NULL, + `amount` FLOAT NOT NULL, + `title` VARCHAR(255) NOT NULL, + `short_description` TEXT NOT NULL, + `description` LONGTEXT NOT NULL, + `expiration_date` DATETIME NOT NULL, + `max_usage` INTEGER NOT NULL, + `is_cumulative` TINYINT(1) NOT NULL, + `is_removing_postage` TINYINT(1) NOT NULL, + `is_available_on_special_offers` TINYINT(1) NOT NULL, + `serialized_conditions` TEXT NOT NULL, + `created_at` DATETIME, + `updated_at` DATETIME, + PRIMARY KEY (`id`), + INDEX `idx_order_coupon_order_id` (`order_id`), + CONSTRAINT `fk_order_coupon_order_id` + FOREIGN KEY (`order_id`) + REFERENCES `order` (`id`) + ON UPDATE RESTRICT + ON DELETE CASCADE +) ENGINE=InnoDB; + -- --------------------------------------------------------------------- -- category_i18n -- --------------------------------------------------------------------- diff --git a/local/config/schema.xml b/local/config/schema.xml index 1613abafc..3e679e739 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -523,6 +523,7 @@ + @@ -900,18 +901,6 @@ - - - - - - - - - - - -
@@ -990,7 +979,6 @@ - @@ -1277,4 +1265,27 @@
+ + + + + + + + + + + + + + + + + + + + + + +
diff --git a/reset_install.sh b/reset_install.sh index 4409dc783..684b12abb 100755 --- a/reset_install.sh +++ b/reset_install.sh @@ -18,7 +18,7 @@ composer install --prefer-dist --optimize-autoloader cd local/config/ echo -e "\n\033[01;34m[INFO] Building Models file\033[00m\n" -../../bin/propel build -v --output-dir=../../core/lib/ +../../bin/propel build -v --output-dir=../../core/lib/ --enable-identifier-quoting echo -e "\n\033[01;34m[INFO] Building SQL CREATE file\033[00m\n" ../../bin/propel sql:build -v --output-dir=../../install/ diff --git a/templates/backOffice/default/order-edit.html b/templates/backOffice/default/order-edit.html index 1d5abf358..878600862 100755 --- a/templates/backOffice/default/order-edit.html +++ b/templates/backOffice/default/order-edit.html @@ -112,12 +112,23 @@ {intl l="Discount"} - {$orderCurrency} 0 + {$orderCurrency} {$DISCOUNT} {intl l="Coupon code"} - {$orderCurrency} 0 + + {ifloop rel="couponcode"} +
    + {loop type="order_coupon" name="couponcode" order=$ID} +
  • {$CODE}
  • + {/loop} +
+ {/ifloop} + {elseloop rel="couponcode"} + Ø + {/elseloop} +