diff --git a/Readme.md b/Readme.md index 89e87684f..abb8ccd30 100755 --- a/Readme.md +++ b/Readme.md @@ -63,6 +63,7 @@ Thelia documentation is available at http://doc.thelia.net The documentation is also in beta version and some part can be obsolete cause to some refactor. + Contribute ---------- diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php index 1f04e12f6..c376a78b7 100755 --- a/core/lib/Thelia/Action/BaseAction.php +++ b/core/lib/Thelia/Action/BaseAction.php @@ -30,7 +30,6 @@ use Thelia\Core\Event\UpdateSeoEvent; use Thelia\Exception\UrlRewritingException; use Thelia\Form\Exception\FormValidationException; -use \Thelia\Model\Tools\UrlRewritingTrait; class BaseAction { @@ -82,8 +81,8 @@ class BaseAction /** * Changes SEO Fields for an object. * - * @param ModelCriteria $query - * @param UpdateSeoEvent $event + * @param ModelCriteria $query + * @param UpdateSeoEvent $event * * @return mixed */ @@ -105,7 +104,7 @@ class BaseAction // Update the rewritten URL, if required try { $object->setRewrittenUrl($event->getLocale(), $event->getUrl()); - } catch(UrlRewritingException $e) { + } catch (UrlRewritingException $e) { throw new FormValidationException($e->getMessage(), $e->getCode()); } diff --git a/core/lib/Thelia/Action/Coupon.php b/core/lib/Thelia/Action/Coupon.php index 198285cef..84c1d444b 100755 --- a/core/lib/Thelia/Action/Coupon.php +++ b/core/lib/Thelia/Action/Coupon.php @@ -28,6 +28,7 @@ use Thelia\Condition\ConditionFactory; use Thelia\Condition\Implementation\ConditionInterface; use Thelia\Core\Event\Coupon\CouponConsumeEvent; use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent; +use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\HttpFoundation\Request; use Thelia\Coupon\CouponFactory; @@ -36,6 +37,7 @@ use Thelia\Condition\ConditionCollection; use Thelia\Coupon\Type\CouponInterface; use Thelia\Model\Coupon as CouponModel; use Thelia\Model\CouponQuery; +use Thelia\Model\OrderCoupon; /** * Process Coupon Events @@ -118,23 +120,20 @@ class Coupon extends BaseAction implements EventSubscriberInterface $request->getSession()->setConsumedCoupons($consumedCoupons); $totalDiscount = $couponManager->getDiscount(); - // @todo insert false product in cart with the name of the coupon and the discount as negative price - - // Decrement coupon quantity - // @todo move this part in after order event - $couponQuery = CouponQuery::create(); - $couponModel = $couponQuery->findOneByCode($coupon->getCode()); - $couponManager->decrementQuantity($couponModel); $request ->getSession() ->getCart() ->setDiscount($totalDiscount) ->save(); + $request + ->getSession() + ->getOrder() + ->setDiscount($totalDiscount) + ->save(); } } - $event->setIsValid($isValid); $event->setDiscount($totalDiscount); } @@ -203,6 +202,68 @@ class Coupon extends BaseAction implements EventSubscriberInterface $event->setCouponModel($coupon); } + /** + * @param \Thelia\Core\Event\Order\OrderEvent $event + */ + public function testFreePostage(OrderEvent $event) + { + /** @var CouponManager $couponManager */ + $couponManager = $this->container->get('thelia.coupon.manager'); + + if($couponManager->isCouponRemovingPostage()) { + $order = $event->getOrder(); + + $order->setPostage(0); + + $event->setOrder($order); + + $event->stopPropagation(); + } + } + + /** + * @param \Thelia\Core\Event\Order\OrderEvent $event + */ + public function afterOrder(OrderEvent $event) + { + $request = $this->container->get('request'); + + /** @var CouponManager $couponManager */ + $couponManager = $this->container->get('thelia.coupon.manager'); + + $consumedCoupons = $request->getSession()->getConsumedCoupons(); + + if (is_array($consumedCoupons)) { + foreach($consumedCoupons as $couponCode) { + $couponQuery = CouponQuery::create(); + $couponModel = $couponQuery->findOneByCode($couponCode); + $couponModel->setLocale($request->getSession()->getLang()->getLocale()); + + /* decrease coupon quantity */ + $couponManager->decrementQuantity($couponModel); + + /* memorize coupon */ + $orderCoupon = new OrderCoupon(); + $orderCoupon->setOrder($event->getOrder()) + ->setCode($couponModel->getCode()) + ->setType($couponModel->getType()) + ->setAmount($couponModel->getAmount()) + + ->setTitle($couponModel->getTitle()) + ->setShortDescription($couponModel->getShortDescription()) + ->setDescription($couponModel->getDescription()) + + ->setExpirationDate($couponModel->getExpirationDate()) + ->setIsCumulative($couponModel->getIsCumulative()) + ->setIsRemovingPostage($couponModel->getIsRemovingPostage()) + ->setIsAvailableOnSpecialOffers($couponModel->getIsAvailableOnSpecialOffers()) + ->setSerializedConditions($couponModel->getSerializedConditions()) + ; + $orderCoupon->save(); + } + } + } + /** * Returns an array of event names this subscriber listens to. * @@ -229,7 +290,9 @@ class Coupon extends BaseAction implements EventSubscriberInterface TheliaEvents::COUPON_CREATE => array("create", 128), TheliaEvents::COUPON_UPDATE => array("update", 128), TheliaEvents::COUPON_CONSUME => array("consume", 128), - TheliaEvents::COUPON_CONDITION_UPDATE => array("updateCondition", 128) + TheliaEvents::COUPON_CONDITION_UPDATE => array("updateCondition", 128), + TheliaEvents::ORDER_SET_POSTAGE => array("testFreePostage", 256), + TheliaEvents::ORDER_BEFORE_PAYMENT => array("afterOrder", 128), ); } } diff --git a/core/lib/Thelia/Action/MailingSystem.php b/core/lib/Thelia/Action/MailingSystem.php index f46352d53..2f62d749b 100644 --- a/core/lib/Thelia/Action/MailingSystem.php +++ b/core/lib/Thelia/Action/MailingSystem.php @@ -35,7 +35,7 @@ class MailingSystem extends BaseAction implements EventSubscriberInterface */ public function update(MailingSystemEvent $event) { - if($event->getEnabled()) { + if ($event->getEnabled()) { ConfigQuery::enableSmtp(); } else { ConfigQuery::disableSmtp(); diff --git a/core/lib/Thelia/Action/Order.php b/core/lib/Thelia/Action/Order.php index 0699c14d1..9d7daaba7 100755 --- a/core/lib/Thelia/Action/Order.php +++ b/core/lib/Thelia/Action/Order.php @@ -30,6 +30,7 @@ use Thelia\Core\Event\Cart\CartEvent; use Thelia\Core\Event\Order\OrderAddressEvent; use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; +use Thelia\Coupon\CouponManager; use Thelia\Exception\TheliaProcessException; use Thelia\Model\AddressQuery; use Thelia\Model\ConfigQuery; @@ -73,6 +74,17 @@ class Order extends BaseAction implements EventSubscriberInterface $order = $event->getOrder(); $order->setDeliveryModuleId($event->getDeliveryModule()); + + $event->setOrder($order); + } + + /** + * @param \Thelia\Core\Event\Order\OrderEvent $event + */ + public function setPostage(OrderEvent $event) + { + $order = $event->getOrder(); + $order->setPostage($event->getPostage()); $event->setOrder($order); @@ -178,6 +190,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 */ @@ -262,8 +279,6 @@ class Order extends BaseAction implements EventSubscriberInterface } } - /* discount @todo */ - $con->commit(); $this->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder)); @@ -273,7 +288,7 @@ class Order extends BaseAction implements EventSubscriberInterface $sessionOrder = new \Thelia\Model\Order(); $event->setOrder($sessionOrder); $event->setPlacedOrder($placedOrder); - $this->getSession()->setOrder($sessionOrder); + $this->getSession()->setOrder($placedOrder); /* empty cart */ $this->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest()))); @@ -290,7 +305,7 @@ class Order extends BaseAction implements EventSubscriberInterface { $contact_email = ConfigQuery::read('contact_email'); - if($contact_email) { + if ($contact_email) { $message = MessageQuery::create() ->filterByName('order_confirmation') @@ -412,6 +427,7 @@ class Order extends BaseAction implements EventSubscriberInterface return array( TheliaEvents::ORDER_SET_DELIVERY_ADDRESS => array("setDeliveryAddress", 128), TheliaEvents::ORDER_SET_DELIVERY_MODULE => array("setDeliveryModule", 128), + TheliaEvents::ORDER_SET_POSTAGE => array("setPostage", 128), TheliaEvents::ORDER_SET_INVOICE_ADDRESS => array("setInvoiceAddress", 128), TheliaEvents::ORDER_SET_PAYMENT_MODULE => array("setPaymentModule", 128), TheliaEvents::ORDER_PAY => array("create", 128), diff --git a/core/lib/Thelia/Action/Product.php b/core/lib/Thelia/Action/Product.php index 6d477855b..a5defe5cb 100644 --- a/core/lib/Thelia/Action/Product.php +++ b/core/lib/Thelia/Action/Product.php @@ -131,7 +131,6 @@ class Product extends BaseAction implements EventSubscriberInterface return $this->genericUpdateSeo(ProductQuery::create(), $event); } - /** * Delete a product entry * diff --git a/core/lib/Thelia/Action/ProductSaleElement.php b/core/lib/Thelia/Action/ProductSaleElement.php index cad3be374..875dbcc1d 100644 --- a/core/lib/Thelia/Action/ProductSaleElement.php +++ b/core/lib/Thelia/Action/ProductSaleElement.php @@ -209,8 +209,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface if ($product->countSaleElements() <= 0) { // If we just deleted the last PSE, create a default one $product->createProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true); - } - elseif ($pse->getIsDefault()) { + } elseif ($pse->getIsDefault()) { // If we deleted the default PSE, make the last created one the default $pse = ProductSaleElementsQuery::create() @@ -238,8 +237,8 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface * * @param ProductCombinationGenerationEvent $event */ - public function generateCombinations(ProductCombinationGenerationEvent $event) { - + public function generateCombinations(ProductCombinationGenerationEvent $event) + { $con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME); $con->beginTransaction(); @@ -252,7 +251,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface $isDefault = true; // Create all combinations - foreach($event->getCombinations() as $combinationAttributesAvIds) { + foreach ($event->getCombinations() as $combinationAttributesAvIds) { // Create the PSE $saleElement = $event->getProduct()->createProductSaleElement( @@ -276,8 +275,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface // Store all the stuff ! $con->commit(); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { $con->rollback(); @@ -288,9 +286,9 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface /** * Create a combination for a given product sale element * - * @param ConnectionInterface $con the Propel connection - * @param ProductSaleElement $salesElement the product sale element - * @param unknown $combinationAttributes an array oif attributes av IDs + * @param ConnectionInterface $con the Propel connection + * @param ProductSaleElement $salesElement the product sale element + * @param unknown $combinationAttributes an array oif attributes av IDs */ protected function createCombination(ConnectionInterface $con, ProductSaleElements $salesElement, $combinationAttributes) { diff --git a/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php b/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php index cab25d13f..690f4362b 100644 --- a/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php +++ b/core/lib/Thelia/Command/AdminUpdatePasswordCommand.php @@ -32,7 +32,6 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Model\AdminQuery; use Thelia\Tools\Password; - /** * command line for updating admin password * @@ -72,18 +71,15 @@ class AdminUpdatePasswordCommand extends ContainerAwareCommand { $login = $input->getArgument('login'); - if (null === $admin = AdminQuery::create()->filterByLogin($login)->findOne()) { throw new \RuntimeException(sprintf('Admin with login %s does not exists', $login)); } - $password = $input->getOption('password') ?: Password::generateRandom(); $event = new AdministratorUpdatePasswordEvent($admin); $event->setPassword($password); - $this-> getContainer() ->get('event_dispatcher') @@ -99,4 +95,3 @@ class AdminUpdatePasswordCommand extends ContainerAwareCommand } } - diff --git a/core/lib/Thelia/Config/I18n/en_US.php b/core/lib/Thelia/Config/I18n/en_US.php index ce333ddb4..2b8b661c2 100644 --- a/core/lib/Thelia/Config/I18n/en_US.php +++ b/core/lib/Thelia/Config/I18n/en_US.php @@ -1,14 +1,14 @@ 'Delivery module', - 'Quantity' => 'Quantity', - 'Product' => 'Product', - 'Unit. price' => 'Unit. price', - 'Tax' => 'Tax', - 'Unit taxed price' => 'Unit taxed price', - 'Taxed total' => 'Taxed total', - 'Payment module' => 'Payment module', - 'Postage' => 'Postage', - 'Total' => 'Total', + 'Delivery module' => 'Delivery module', + 'Quantity' => 'Quantity', + 'Product' => 'Product', + 'Unit. price' => 'Unit. price', + 'Tax' => 'Tax', + 'Unit taxed price' => 'Unit taxed price', + 'Taxed total' => 'Taxed total', + 'Payment module' => 'Payment module', + 'Postage' => 'Postage', + 'Total' => 'Total', ); diff --git a/core/lib/Thelia/Config/I18n/es_ES.php b/core/lib/Thelia/Config/I18n/es_ES.php index f1a85bd6a..0a749d4c1 100644 --- a/core/lib/Thelia/Config/I18n/es_ES.php +++ b/core/lib/Thelia/Config/I18n/es_ES.php @@ -1,36 +1,36 @@ 'Combination builder', - 'Title' => 'Title', - 'City' => 'City', - 'Zip code' => 'Zip code', - 'Country' => 'Country', - 'Phone' => 'Phone', - 'Login' => 'Login', - 'Password' => 'Password', - 'Profile' => 'Profile', - 'Postage' => 'Postage', - 'Add to all product templates' => 'Add to all product templates', - 'Quantity' => 'Quantity', - 'Name' => 'Name', - 'Value' => 'Value', - 'Subject' => 'Subject', - 'Company' => 'Company', - 'Description' => 'Description', - 'Language name' => 'Language name', - 'ISO 639 Code' => 'ISO 639 Code', - 'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :', - 'Host' => 'Host', - 'Port' => 'Port', - 'Encryption' => 'Encryption', - 'Username' => 'Username', - 'Timeout' => 'Timeout', - 'Source IP' => 'Source IP', - 'Email address' => 'Email address', - 'Firstname' => 'Firstname', - 'Lastname' => 'Lastname', - 'Additional address' => 'Additional address', - 'Reference' => 'Reference', - 'EAN Code' => 'EAN Code', + 'Combination builder' => 'Combination builder', + 'Title' => 'Title', + 'City' => 'City', + 'Zip code' => 'Zip code', + 'Country' => 'Country', + 'Phone' => 'Phone', + 'Login' => 'Login', + 'Password' => 'Password', + 'Profile' => 'Profile', + 'Postage' => 'Postage', + 'Add to all product templates' => 'Add to all product templates', + 'Quantity' => 'Quantity', + 'Name' => 'Name', + 'Value' => 'Value', + 'Subject' => 'Subject', + 'Company' => 'Company', + 'Description' => 'Description', + 'Language name' => 'Language name', + 'ISO 639 Code' => 'ISO 639 Code', + 'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :', + 'Host' => 'Host', + 'Port' => 'Port', + 'Encryption' => 'Encryption', + 'Username' => 'Username', + 'Timeout' => 'Timeout', + 'Source IP' => 'Source IP', + 'Email address' => 'Email address', + 'Firstname' => 'Firstname', + 'Lastname' => 'Lastname', + 'Additional address' => 'Additional address', + 'Reference' => 'Reference', + 'EAN Code' => 'EAN Code', ); diff --git a/core/lib/Thelia/Config/I18n/fr_FR.php b/core/lib/Thelia/Config/I18n/fr_FR.php index 7eb24949a..188d6f90a 100644 --- a/core/lib/Thelia/Config/I18n/fr_FR.php +++ b/core/lib/Thelia/Config/I18n/fr_FR.php @@ -23,4 +23,4 @@ return array( -); \ No newline at end of file +); diff --git a/core/lib/Thelia/Config/I18n/it_IT.php b/core/lib/Thelia/Config/I18n/it_IT.php index 7eb24949a..188d6f90a 100644 --- a/core/lib/Thelia/Config/I18n/it_IT.php +++ b/core/lib/Thelia/Config/I18n/it_IT.php @@ -23,4 +23,4 @@ return array( -); \ No newline at end of file +); 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/Controller/Admin/AbstractCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php index d8574a91b..722547b17 100644 --- a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php +++ b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php @@ -443,7 +443,6 @@ abstract class AbstractCrudController extends BaseAdminController $ex ); - return $this->renderEditionTemplate(); } diff --git a/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php index 9918f8a2f..52c4bbda4 100755 --- a/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php +++ b/core/lib/Thelia/Controller/Admin/AbstractSeoCrudController.php @@ -53,7 +53,7 @@ abstract class AbstractSeoCrudController extends AbstractCrudController * * @param string $visibilityToggleEventIdentifier the dispatched visibility toggle TheliaEvent identifier, or null if the object has no visible options. Example: TheliaEvents::MESSAGE_TOGGLE_VISIBILITY * @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION - * @param string $updateSeoEventIdentifier the dispatched update SEO change TheliaEvent identifier, or null if the object has no SEO. Example: TheliaEvents::MESSAGE_UPDATE_SEO + * @param string $updateSeoEventIdentifier the dispatched update SEO change TheliaEvent identifier, or null if the object has no SEO. Example: TheliaEvents::MESSAGE_UPDATE_SEO */ public function __construct( $objectName, @@ -134,7 +134,8 @@ abstract class AbstractSeoCrudController extends AbstractCrudController * * @param unknown $object */ - protected function hydrateSeoForm($object){ + protected function hydrateSeoForm($object) + { // The "SEO" tab form $locale = $object->getLocale(); $data = array( @@ -227,8 +228,6 @@ abstract class AbstractSeoCrudController extends AbstractCrudController $ex ); - - // At this point, the form has errors, and should be redisplayed. return $this->renderEditionTemplate(); } diff --git a/core/lib/Thelia/Controller/Admin/AddressController.php b/core/lib/Thelia/Controller/Admin/AddressController.php index 3e2812bd0..c818ba492 100644 --- a/core/lib/Thelia/Controller/Admin/AddressController.php +++ b/core/lib/Thelia/Controller/Admin/AddressController.php @@ -98,7 +98,7 @@ class AddressController extends AbstractCrudController /** * Fills in the form data array * - * @param unknown $object + * @param unknown $object * @return multitype:NULL */ protected function createFormDataArray($object) @@ -309,7 +309,8 @@ class AddressController extends AbstractCrudController $this->redirectToEditionTemplate(); } - protected function getCustomerId() { + protected function getCustomerId() + { if (null !== $address = $this->getExistingObject()) return $address->getCustomerId(); else diff --git a/core/lib/Thelia/Controller/Admin/AttributeController.php b/core/lib/Thelia/Controller/Admin/AttributeController.php index ce1ca3072..b058f060d 100644 --- a/core/lib/Thelia/Controller/Admin/AttributeController.php +++ b/core/lib/Thelia/Controller/Admin/AttributeController.php @@ -34,7 +34,6 @@ use Thelia\Form\AttributeModificationForm; use Thelia\Form\AttributeCreationForm; use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Model\AttributeAv; -use Thelia\Model\AttributeAvQuery; use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent; use Thelia\Core\Event\Attribute\AttributeEvent; diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php index abb9665f9..1ef329dd1 100755 --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -309,6 +309,7 @@ class BaseAdminController extends BaseController { // Check if the functionality is activated if(!ConfigQuery::read("one_domain_foreach_lang", false)) + return; // If we don't have a locale value, use the locale value in the session @@ -390,8 +391,8 @@ class BaseAdminController extends BaseController * Render the given template, and returns the result as an Http Response. * * @param $templateName the complete template name, with extension - * @param array $args the template arguments - * @param int $status http code status + * @param array $args the template arguments + * @param int $status http code status * @return \Thelia\Core\HttpFoundation\Response */ protected function render($templateName, $args = array(), $status = 200) diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php index 4f789244b..d2e0a0e9c 100755 --- a/core/lib/Thelia/Controller/Admin/CategoryController.php +++ b/core/lib/Thelia/Controller/Admin/CategoryController.php @@ -201,15 +201,12 @@ class CategoryController extends AbstractSeoCrudController protected function redirectToListTemplateWithId($category_id) { - if($category_id > 0) - { + if ($category_id > 0) { $this->redirectToRoute( 'admin.categories.default', array('category_id' => $category_id) ); - } - else - { + } else { $this->redirectToRoute( 'admin.catalog' ); diff --git a/core/lib/Thelia/Controller/Admin/ConfigStoreController.php b/core/lib/Thelia/Controller/Admin/ConfigStoreController.php index 1a9172ec1..95d425edb 100644 --- a/core/lib/Thelia/Controller/Admin/ConfigStoreController.php +++ b/core/lib/Thelia/Controller/Admin/ConfigStoreController.php @@ -23,11 +23,9 @@ namespace Thelia\Controller\Admin; - use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\AccessManager; use Thelia\Form\ConfigStoreForm; -use Thelia\Log\Tlog; use Thelia\Model\ConfigQuery; /** * Class ConfigStoreController @@ -80,7 +78,7 @@ class ConfigStoreController extends BaseAdminController $data = $form->getData(); // Update store - foreach($data as $name => $value) { + foreach ($data as $name => $value) { if(! in_array($name , array('success_url', 'error_message'))) ConfigQuery::write($name, $value, false); } diff --git a/core/lib/Thelia/Controller/Admin/CustomerController.php b/core/lib/Thelia/Controller/Admin/CustomerController.php index a3239542c..95f6451c9 100644 --- a/core/lib/Thelia/Controller/Admin/CustomerController.php +++ b/core/lib/Thelia/Controller/Admin/CustomerController.php @@ -23,19 +23,14 @@ namespace Thelia\Controller\Admin; -use Propel\Runtime\Exception\PropelException; use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; use Thelia\Core\Event\Customer\CustomerEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Security\AccessManager; use Thelia\Form\CustomerCreateForm; use Thelia\Form\CustomerUpdateForm; -use Thelia\Form\Exception\FormValidationException; use Thelia\Model\CustomerQuery; -use Thelia\Core\Translation\Translator; use Thelia\Tools\Password; -use Thelia\Model\AddressQuery; use Thelia\Model\Address; /** @@ -208,4 +203,4 @@ class CustomerController extends AbstractCrudController { $this->redirectToRoute("admin.customer.update.view", $this->getEditionArguments()); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/FeatureController.php b/core/lib/Thelia/Controller/Admin/FeatureController.php index 8ff3a972e..5ae0aae7d 100644 --- a/core/lib/Thelia/Controller/Admin/FeatureController.php +++ b/core/lib/Thelia/Controller/Admin/FeatureController.php @@ -34,7 +34,6 @@ use Thelia\Form\FeatureModificationForm; use Thelia\Form\FeatureCreationForm; use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Model\FeatureAv; -use Thelia\Model\FeatureAvQuery; use Thelia\Core\Event\Feature\FeatureAvUpdateEvent; use Thelia\Core\Event\Feature\FeatureEvent; diff --git a/core/lib/Thelia/Controller/Admin/FileController.php b/core/lib/Thelia/Controller/Admin/FileController.php index aff1c2d63..f123bfb94 100755 --- a/core/lib/Thelia/Controller/Admin/FileController.php +++ b/core/lib/Thelia/Controller/Admin/FileController.php @@ -584,7 +584,7 @@ class FileController extends BaseAdminController ); } - if(null === $message) { + if (null === $message) { $message = $this->getTranslator() ->trans( 'Images deleted successfully', @@ -638,7 +638,7 @@ class FileController extends BaseAdminController ) . $e->getMessage(); } - if(null === $message) { + if (null === $message) { $message = $this->getTranslator() ->trans( 'Image position updated', @@ -692,7 +692,7 @@ class FileController extends BaseAdminController ) . $e->getMessage(); } - if(null === $message) { + if (null === $message) { $message = $this->getTranslator() ->trans( 'Document position updated', diff --git a/core/lib/Thelia/Controller/Admin/HomeController.php b/core/lib/Thelia/Controller/Admin/HomeController.php index 0fcee29ca..d4458843d 100644 --- a/core/lib/Thelia/Controller/Admin/HomeController.php +++ b/core/lib/Thelia/Controller/Admin/HomeController.php @@ -42,7 +42,7 @@ class HomeController extends BaseAdminController public function loadStatsAjaxAction() { if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response; - + $data = new \stdClass(); $data->title = "Stats on " . $this->getRequest()->query->get('month', date('m')) . "/" . $this->getRequest()->query->get('year', date('Y')); @@ -88,7 +88,6 @@ class HomeController extends BaseAdminController array(5) ); - $data->series = array( $saleSeries, $newCustomerSeries, diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php index fe8b655c7..aebf29d04 100644 --- a/core/lib/Thelia/Controller/Admin/MessageController.php +++ b/core/lib/Thelia/Controller/Admin/MessageController.php @@ -31,7 +31,6 @@ use Thelia\Model\MessageQuery; use Thelia\Form\MessageModificationForm; use Thelia\Form\MessageCreationForm; use Symfony\Component\Finder\Finder; -use Thelia\Model\ConfigQuery; use Thelia\Core\Template\TemplateHelper; /** @@ -164,8 +163,8 @@ class MessageController extends AbstractCrudController return $this->render('messages'); } - protected function listDirectoryContent($requiredExtension) { - + protected function listDirectoryContent($requiredExtension) + { $list = array(); $dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath(); diff --git a/core/lib/Thelia/Controller/Admin/ModuleController.php b/core/lib/Thelia/Controller/Admin/ModuleController.php index 031ae1f26..edd591ba4 100644 --- a/core/lib/Thelia/Controller/Admin/ModuleController.php +++ b/core/lib/Thelia/Controller/Admin/ModuleController.php @@ -149,7 +149,6 @@ class ModuleController extends AbstractCrudController ->findOneById($this->getRequest()->get('module_id')); } - protected function getObjectLabel($object) { return $object->getTitle(); @@ -218,12 +217,11 @@ class ModuleController extends AbstractCrudController { $module = ModuleQuery::create()->findOneByCode($module_code); - if(null === $module) { + if (null === $module) { throw new \InvalidArgumentException(sprintf("Module `%s` does not exists", $module_code)); } if (null !== $response = $this->checkAuth(array(), $module_code, AccessManager::VIEW)) return $response; - return $this->render( "module-configure", array( diff --git a/core/lib/Thelia/Controller/Admin/OrderController.php b/core/lib/Thelia/Controller/Admin/OrderController.php index 56d130f5d..c04e2c93e 100644 --- a/core/lib/Thelia/Controller/Admin/OrderController.php +++ b/core/lib/Thelia/Controller/Admin/OrderController.php @@ -27,7 +27,6 @@ use Thelia\Core\HttpFoundation\Response; use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Event\Order\OrderAddressEvent; use Thelia\Core\Event\Order\OrderEvent; -use Thelia\Core\Event\PdfEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Security\AccessManager; use Thelia\Form\OrderUpdateAddress; @@ -36,7 +35,6 @@ use Thelia\Model\Base\OrderAddressQuery; use Thelia\Model\OrderQuery; use Thelia\Model\OrderStatusQuery; use Thelia\Tools\URL; -use Thelia\Core\Template\TemplateHelper; /** * Class OrderController @@ -203,20 +201,18 @@ class OrderController extends BaseAdminController public function generateInvoicePdf($order_id) { if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response; - return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice')); } public function generateDeliveryPdf($order_id) { if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response; - return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery')); } private function generateBackOfficeOrderPdf($order_id, $fileName) { - if(null === $response = $this->generateOrderPdf($order_id, $fileName)){ + if (null === $response = $this->generateOrderPdf($order_id, $fileName)) { $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", array( 'order_id' => $order_id )))); @@ -225,5 +221,4 @@ class OrderController extends BaseAdminController return $response; } - } diff --git a/core/lib/Thelia/Controller/Admin/ProductController.php b/core/lib/Thelia/Controller/Admin/ProductController.php index 57ceb8fb4..7b727f206 100644 --- a/core/lib/Thelia/Controller/Admin/ProductController.php +++ b/core/lib/Thelia/Controller/Admin/ProductController.php @@ -72,7 +72,6 @@ use Thelia\Form\ProductCombinationGenerationForm; use Thelia\TaxEngine\Calculator; use Thelia\Tools\NumberFormat; - /** * Manages products * @@ -1037,17 +1036,18 @@ class ProductController extends AbstractSeoCrudController } // Create combinations - protected function combine($input, &$output, &$tmp) { + protected function combine($input, &$output, &$tmp) + { $current = array_shift($input); if (count($input) > 0) { - foreach($current as $element) { + foreach ($current as $element) { $tmp[] = $element; $this->combine($input, $output, $tmp); array_pop($tmp); } } else { - foreach($current as $element) { + foreach ($current as $element) { $tmp[] = $element; $output[] = $tmp; array_pop($tmp); @@ -1058,8 +1058,8 @@ class ProductController extends AbstractSeoCrudController /** * Build combinations from the combination output builder */ - public function buildCombinationsAction() { - + public function buildCombinationsAction() + { // Check current user authorization if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response; @@ -1082,7 +1082,7 @@ class ProductController extends AbstractSeoCrudController // from the list of attribute_id:attributes_av ID from the form. $combinations = $attributes_av_list = array(); - foreach($data['attribute_av'] as $item) { + foreach ($data['attribute_av'] as $item) { list($attribute_id, $attribute_av_id) = explode(':', $item); if (! isset($attributes_av_list[$attribute_id])) diff --git a/core/lib/Thelia/Controller/Admin/SystemLogController.php b/core/lib/Thelia/Controller/Admin/SystemLogController.php index e61d619f0..9dafd78f6 100644 --- a/core/lib/Thelia/Controller/Admin/SystemLogController.php +++ b/core/lib/Thelia/Controller/Admin/SystemLogController.php @@ -23,7 +23,6 @@ namespace Thelia\Controller\Admin; - use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\AccessManager; use Thelia\Form\SystemLogConfigurationForm; @@ -43,7 +42,7 @@ class SystemLogController extends BaseAdminController $destination_directories = Tlog::getInstance()->getDestinationsDirectories(); - foreach($destination_directories as $dir) { + foreach ($destination_directories as $dir) { $this->loadDefinedDestinations($dir, $destinations); } @@ -58,8 +57,8 @@ class SystemLogController extends BaseAdminController ); } - protected function loadDefinedDestinations($directory, &$destinations) { - + protected function loadDefinedDestinations($directory, &$destinations) + { try { foreach (new \DirectoryIterator($directory) as $fileInfo) { @@ -144,7 +143,7 @@ class SystemLogController extends BaseAdminController $active_destinations = array(); - foreach($destinations as $classname => $destination) { + foreach ($destinations as $classname => $destination) { if (isset($destination['active'])) { $active_destinations[] = $destination['classname']; @@ -153,7 +152,7 @@ class SystemLogController extends BaseAdminController if (isset($configs[$classname])) { // Update destinations configuration - foreach($configs[$classname] as $var => $value) { + foreach ($configs[$classname] as $var => $value) { ConfigQuery::write($var, $value, true, true); } } diff --git a/core/lib/Thelia/Controller/Admin/TranslationsController.php b/core/lib/Thelia/Controller/Admin/TranslationsController.php index cb7c3f072..e4fcfed23 100644 --- a/core/lib/Thelia/Controller/Admin/TranslationsController.php +++ b/core/lib/Thelia/Controller/Admin/TranslationsController.php @@ -23,12 +23,8 @@ namespace Thelia\Controller\Admin; - use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\AccessManager; -use Thelia\Form\SystemLogConfigurationForm; -use Thelia\Log\Tlog; -use Thelia\Model\ConfigQuery; use Thelia\Model\ModuleQuery; use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateDefinition; @@ -67,7 +63,7 @@ class TranslationsController extends BaseAdminController if (! empty($item_id) || $item_to_translate == 'co') { - switch($item_to_translate) { + switch ($item_to_translate) { case 'mo' : if (null !== $module = ModuleQuery::create()->findPk($item_id)) { @@ -149,8 +145,7 @@ class TranslationsController extends BaseAdminController $templateArguments['max_input_vars_warning'] = true; $templateArguments['required_max_input_vars'] = $stringsCount; $templateArguments['current_max_input_vars'] = ini_get('max_input_vars'); - } - else { + } else { $templateArguments['all_strings'] = $all_strings; } } @@ -162,14 +157,12 @@ class TranslationsController extends BaseAdminController public function defaultAction() { if (null !== $response = $this->checkAuth(AdminResources::TRANSLATIONS, array(), AccessManager::VIEW)) return $response; - return $this->renderTemplate(); } public function updateAction() { if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE)) return $response; - return $this->renderTemplate(); } } diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index 775861c32..b90d98462 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -61,7 +61,7 @@ abstract class BaseController extends ContainerAware /** * Return an empty response (after an ajax request, for example) - * @param int $status + * @param int $status * @return \Thelia\Core\HttpFoundation\Response */ protected function nullResponse($status = 200) @@ -252,7 +252,6 @@ abstract class BaseController extends ContainerAware } - } /** @@ -367,8 +366,8 @@ abstract class BaseController extends ContainerAware * Render the given template, and returns the result as an Http Response. * * @param $templateName the complete template name, with extension - * @param array $args the template arguments - * @param int $status http code status + * @param array $args the template arguments + * @param int $status http code status * @return \Thelia\Core\HttpFoundation\Response */ abstract protected function render($templateName, $args = array(), $status = 200); diff --git a/core/lib/Thelia/Controller/Front/BaseFrontController.php b/core/lib/Thelia/Controller/Front/BaseFrontController.php index 07f434099..3e70364d4 100755 --- a/core/lib/Thelia/Controller/Front/BaseFrontController.php +++ b/core/lib/Thelia/Controller/Front/BaseFrontController.php @@ -25,10 +25,8 @@ namespace Thelia\Controller\Front; use Symfony\Component\Routing\Router; use Thelia\Controller\BaseController; use Thelia\Core\HttpFoundation\Response; -use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Template\TemplateHelper; use Thelia\Model\AddressQuery; -use Thelia\Model\ConfigQuery; use Thelia\Model\ModuleQuery; use Thelia\Tools\Redirect; use Thelia\Tools\URL; @@ -106,8 +104,8 @@ class BaseFrontController extends BaseController * Render the given template, and returns the result as an Http Response. * * @param $templateName the complete template name, with extension - * @param array $args the template arguments - * @param int $status http code status + * @param array $args the template arguments + * @param int $status http code status * @return \Thelia\Core\HttpFoundation\Response */ protected function render($templateName, $args = array(), $status = 200) diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php index e007f9961..43f84ebd5 100644 --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/TranslatorPass.php @@ -26,7 +26,6 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; - /** * Class TranslatorPass * @package Thelia\Core\DependencyInjection\Compiler @@ -50,11 +49,11 @@ class TranslatorPass implements CompilerPassInterface $translator = $container->getDefinition('thelia.translator'); - foreach($container->findTaggedServiceIds('translation.loader') as $id => $attributes) { + foreach ($container->findTaggedServiceIds('translation.loader') as $id => $attributes) { $translator->addMethodCall('addLoader', array($attributes[0]['alias'], new Reference($id))); if (isset($attributes[0]['legacy-alias'])) { $translator->addMethodCall('addLoader', array($attributes[0]['legacy-alias'], new Reference($id))); } } } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Administrator/AdministratorUpdatePasswordEvent.php b/core/lib/Thelia/Core/Event/Administrator/AdministratorUpdatePasswordEvent.php index f155a9dce..8cfe1ee02 100644 --- a/core/lib/Thelia/Core/Event/Administrator/AdministratorUpdatePasswordEvent.php +++ b/core/lib/Thelia/Core/Event/Administrator/AdministratorUpdatePasswordEvent.php @@ -25,7 +25,6 @@ namespace Thelia\Core\Event\Administrator; use Thelia\Core\Event\ActionEvent; use Thelia\Model\Admin; - /** * Class AdministratorUpdatePasswordEvent * @package Thelia\Core\Event\Administrator @@ -82,4 +81,3 @@ class AdministratorUpdatePasswordEvent extends ActionEvent } } - diff --git a/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php index 2c45942f3..f35430c36 100755 --- a/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Customer; use Symfony\Component\EventDispatcher\Event; -use Thelia\Core\Event\ActionEvent; use Thelia\Model\Customer; /** diff --git a/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php b/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php index 0a046177e..943eb5b64 100755 --- a/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php +++ b/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Customer; -use Thelia\Core\Event\ActionEvent; use Thelia\Model\Customer; class CustomerLoginEvent extends CustomerEvent diff --git a/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php b/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php index 6630b7c13..b1446bfce 100644 --- a/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php @@ -138,4 +138,4 @@ class MessageUpdateEvent extends MessageCreateEvent return $this; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Product/ProductCombinationGenerationEvent.php b/core/lib/Thelia/Core/Event/Product/ProductCombinationGenerationEvent.php index 05b55d733..ba0fccb68 100644 --- a/core/lib/Thelia/Core/Event/Product/ProductCombinationGenerationEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductCombinationGenerationEvent.php @@ -65,6 +65,7 @@ class ProductCombinationGenerationEvent extends ProductEvent public function setReference($reference) { $this->reference = $reference; + return $this; } @@ -76,6 +77,7 @@ class ProductCombinationGenerationEvent extends ProductEvent public function setPrice($price) { $this->price = $price; + return $this; } @@ -87,6 +89,7 @@ class ProductCombinationGenerationEvent extends ProductEvent public function setWeight($weight) { $this->weight = $weight; + return $this; } @@ -98,6 +101,7 @@ class ProductCombinationGenerationEvent extends ProductEvent public function setQuantity($quantity) { $this->quantity = $quantity; + return $this; } @@ -109,6 +113,7 @@ class ProductCombinationGenerationEvent extends ProductEvent public function setSalePrice($sale_price) { $this->sale_price = $sale_price; + return $this; } @@ -120,6 +125,7 @@ class ProductCombinationGenerationEvent extends ProductEvent public function setOnsale($onsale) { $this->onsale = $onsale; + return $this; } @@ -131,6 +137,7 @@ class ProductCombinationGenerationEvent extends ProductEvent public function setIsnew($isnew) { $this->isnew = $isnew; + return $this; } @@ -142,6 +149,7 @@ class ProductCombinationGenerationEvent extends ProductEvent public function setEanCode($ean_code) { $this->ean_code = $ean_code; + return $this; return $this; } @@ -154,6 +162,7 @@ class ProductCombinationGenerationEvent extends ProductEvent public function setCombinations($combinations) { $this->combinations = $combinations; + return $this; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php b/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php index af28ca73f..0e95abfba 100644 --- a/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php @@ -60,4 +60,4 @@ class ProductSetTemplateEvent extends ProductEvent return $this; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php index 811b02fca..8f94b254b 100644 --- a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php @@ -22,7 +22,6 @@ /*************************************************************************************/ namespace Thelia\Core\Event\ProductSaleElement; -use Thelia\Model\Product; class ProductSaleElementDeleteEvent extends ProductSaleElementEvent { diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index b761cf775..69c05cf6d 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -370,6 +370,7 @@ final class TheliaEvents */ const ORDER_SET_DELIVERY_ADDRESS = "action.order.setDeliveryAddress"; const ORDER_SET_DELIVERY_MODULE = "action.order.setDeliveryModule"; + const ORDER_SET_POSTAGE = "action.order.setPostage"; const ORDER_SET_INVOICE_ADDRESS = "action.order.setInvoiceAddress"; const ORDER_SET_PAYMENT_MODULE = "action.order.setPaymentModule"; const ORDER_PAY = "action.order.pay"; diff --git a/core/lib/Thelia/Core/Event/UpdateSeoEvent.php b/core/lib/Thelia/Core/Event/UpdateSeoEvent.php index caf46c1aa..cb287b869 100755 --- a/core/lib/Thelia/Core/Event/UpdateSeoEvent.php +++ b/core/lib/Thelia/Core/Event/UpdateSeoEvent.php @@ -184,5 +184,4 @@ class UpdateSeoEvent extends ActionEvent return $this->object; } - } diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php index e3eaa9577..1975eba45 100755 --- a/core/lib/Thelia/Core/EventListener/ViewListener.php +++ b/core/lib/Thelia/Core/EventListener/ViewListener.php @@ -30,12 +30,10 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Response; use Symfony\Component\Routing\Router; -use Thelia\Core\HttpKernel\Exception\NotFountHttpException; use Thelia\Core\Template\Exception\ResourceNotFoundException; use Thelia\Core\Template\ParserInterface; use Thelia\Core\Template\TemplateHelper; use Thelia\Exception\OrderException; -use Thelia\Model\ConfigQuery; use Thelia\Tools\Redirect; use Thelia\Tools\URL; use Thelia\Core\Security\Exception\AuthenticationException; diff --git a/core/lib/Thelia/Core/HttpFoundation/Response.php b/core/lib/Thelia/Core/HttpFoundation/Response.php index 277c16cc2..e279215b8 100644 --- a/core/lib/Thelia/Core/HttpFoundation/Response.php +++ b/core/lib/Thelia/Core/HttpFoundation/Response.php @@ -39,8 +39,8 @@ class Response extends BaseResponse * * @see \Thelia\Core\HttpFoundation\Response::sendContent() */ - public function sendContent() { - + public function sendContent() + { Tlog::getInstance()->write($this->content); parent::sendContent(); diff --git a/core/lib/Thelia/Core/HttpKernel/HttpCache/HttpCache.php b/core/lib/Thelia/Core/HttpKernel/HttpCache/HttpCache.php index b45f0f812..aceb6235f 100644 --- a/core/lib/Thelia/Core/HttpKernel/HttpCache/HttpCache.php +++ b/core/lib/Thelia/Core/HttpKernel/HttpCache/HttpCache.php @@ -65,7 +65,8 @@ class HttpCache extends BaseHttpCache implements HttpKernelInterface $request->getContent() ); } + return parent::handle($request, $type, $catch); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/SecurityContext.php b/core/lib/Thelia/Core/Security/SecurityContext.php index e97a19877..8512fac0e 100755 --- a/core/lib/Thelia/Core/Security/SecurityContext.php +++ b/core/lib/Thelia/Core/Security/SecurityContext.php @@ -177,7 +177,7 @@ class SecurityContext continue; } - if(!array_key_exists('module', $userPermissions)) { + if (!array_key_exists('module', $userPermissions)) { return false; } diff --git a/core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php b/core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php index 86a61d0f6..20acff2c3 100644 --- a/core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php +++ b/core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php @@ -1,7 +1,7 @@ . */ +/* along with this program. If not, see . */ /* */ /*************************************************************************************/ namespace Thelia\Core\Template\Assets; -interface AssetManagerInterface { +interface AssetManagerInterface +{ /** - * Prepare an asset directory by checking that no changes occured in - * the source directory. If any change is detected, the whole asset directory - * is copied in the web space. - * - * @param string $sourceAssetsDirectory the full path to the source asstes directory - * @param string $webAssetsDirectoryBase the base directory of the web based asset directory - * @param $webAssetsTemplate - * @param string $webAssetsKey the assets key : module name or 0 for base template + * Prepare an asset directory. * + * @param string $source_assets_directory the full path to the source asstes directory + * @param string $web_assets_directory_base the base directory of the web based asset directory * @throws \RuntimeException if something goes wrong. - * - * @internal param string $source_assets_directory the full path to the source asstes directory - * @internal param string $web_assets_directory_base the base directory of the web based asset directory - * @internal param string $key the assets key : module name or 0 for base template */ - public function prepareAssets($sourceAssetsDirectory, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey); + public function prepareAssets($source_assets_directory, $web_assets_directory_base); /** * Generates assets from $asset_path in $output_path, using $filters. * - * @param $assetSource - * @param $assetDirectoryBase - * @param string $webAssetsDirectoryBase the full path to the asset file (or file collection, e.g. *.less) + * @param string $asset_path the full path to the asset file (or file collection, e.g. *.less) * - * @param string $webAssetsTemplate the full disk path to the base assets output directory in the web space - * @param $webAssetsKey - * @param string $outputUrl the URL to the base assets output directory in the web space + * @param string $web_assets_directory_base the full disk path to the base assets output directory in the web space + * @param string $output_url the URL to the base assets output directory in the web space * - * @param string $assetType the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension. - * @param array $filters a list of filters, as defined below (see switch($filter_name) ...) + * @param string $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension. + * @param array $filters a list of filters, as defined below (see switch($filter_name) ...) * - * @param boolean $debug true / false + * @param boolean $debug the debug mode, true or false * - * @internal param string $web_assets_directory_base the full disk path to the base assets output directory in the web space - * @internal param string $output_url the URL to the base assets output directory in the web space - * - * @return string The URL to the generated asset file. + * @throws \InvalidArgumentException if an invalid filter name is found + * @return string The URL to the generated asset file. */ - public function processAsset($assetSource, $assetDirectoryBase, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey, $outputUrl, $assetType, $filters, $debug); + public function processAsset($asset_path, $web_assets_directory_base, $output_url, $asset_type, $filters, $debug); } \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php b/core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php index ac338c514..5854d967f 100755 --- a/core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php +++ b/core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php @@ -1,7 +1,7 @@ . */ +/* along with this program. If not, see . */ /* */ /*************************************************************************************/ @@ -31,6 +31,7 @@ use Assetic\AssetWriter; use Thelia\Model\ConfigQuery; use Thelia\Log\Tlog; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Filesystem\Exception\IOException; /** * This class is a simple helper for generating assets using Assetic. @@ -51,7 +52,7 @@ class AsseticAssetManager implements AssetManagerInterface /** * Create a stamp form the modification time of the content of the given directory and all of its subdirectories * - * @param string $directory ther directory name + * @param string $directory ther directory name * @return string the stamp of this directory */ protected function getStamp($directory) @@ -59,8 +60,8 @@ class AsseticAssetManager implements AssetManagerInterface $stamp = ''; $iterator = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS), - \RecursiveIteratorIterator::LEAVES_ONLY); + new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS), + \RecursiveIteratorIterator::LEAVES_ONLY); foreach ($iterator as $file) { $stamp .= $file->getMTime(); @@ -72,21 +73,19 @@ class AsseticAssetManager implements AssetManagerInterface /** * Check if a file is a source asset file * - * @param \SplFileInfo $fileInfo - * - * @return bool + * @param \DirectoryIterator $fileInfo */ - protected function isSourceFile(\SplFileInfo $fileInfo) { + protected function isSourceFile(\SplFileInfo $fileInfo) + { return in_array($fileInfo->getExtension(), $this->source_file_extensions); } /** * Recursively copy assets from the source directory to the destination - * directory in the web space, omitting source files. + * directory in the web space, ommiting source files. * - * @param Filesystem $fs - * @param string $from_directory the source - * @param string $to_directory the destination + * @param string $from_directory the source + * @param string $to_directory the destination * @throws \RuntimeException if a problem occurs. */ protected function copyAssets(Filesystem $fs, $from_directory, $to_directory) @@ -94,8 +93,8 @@ class AsseticAssetManager implements AssetManagerInterface Tlog::getInstance()->addDebug("Copying assets from $from_directory to $to_directory"); $iterator = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($from_directory, \RecursiveDirectoryIterator::SKIP_DOTS), - \RecursiveIteratorIterator::SELF_FIRST); + new \RecursiveDirectoryIterator($from_directory, \RecursiveDirectoryIterator::SKIP_DOTS), + \RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $item) { if ($item->isDir()) { @@ -123,21 +122,38 @@ class AsseticAssetManager implements AssetManagerInterface } } + /** + * Compite the assets path relative to the base template directory + * + * @param string $source_assets_directory the source directory + * @param string $web_assets_directory_base base directory of the web assets + * @return the full path of the destination directory + */ + protected function getRelativeDirectoryPath($source_assets_directory, $web_assets_directory_base) + { + $source_assets_directory = realpath($source_assets_directory); + + // Remove base path from asset source path to get a path relative to the template base + // and use it to create the destination path. + return str_replace( + realpath(THELIA_ROOT), + '', + $source_assets_directory + ); + } + /** * Compute the destination directory path, from the source directory and the * base directory of the web assets * - * @param string $webAssetsDirectoryBase base directory of the web assets - * @param $webAssetsTemplate - * @param string $webAssetsKey the assests key : module name or 0 for base template - * - * @internal param string $source_assets_directory the source directory - * @return the full path of the destination directory + * @param string $source_assets_directory the source directory + * @param string $web_assets_directory_base base directory of the web assets + * @return the full path of the destination directory */ - protected function getDestinationDirectory($webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey) + protected function getDestinationDirectory($source_assets_directory, $web_assets_directory_base) { // Compute the absolute path of the output directory - return $webAssetsDirectoryBase . DS . $webAssetsTemplate . DS . $webAssetsKey; + return $web_assets_directory_base . $this->getRelativeDirectoryPath($source_assets_directory, $web_assets_directory_base); } /** @@ -145,17 +161,14 @@ class AsseticAssetManager implements AssetManagerInterface * the source directory. If any change is detected, the whole asset directory * is copied in the web space. * - * @param string $sourceAssetsDirectory the full path to the source asstes directory - * @param string $webAssetsDirectoryBase the base directory of the web based asset directory - * @param $webAssetsTemplate - * @param string $webAssetsKey the assets key : module name or 0 for base template - * + * @param string $source_assets_directory the full path to the source asstes directory + * @param string $web_assets_directory_base the base directory of the web based asset directory * @throws \RuntimeException if something goes wrong. */ - public function prepareAssets($sourceAssetsDirectory, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey) + public function prepareAssets($source_assets_directory, $web_assets_directory_base) { // Compute the absolute path of the output directory - $to_directory = $this->getDestinationDirectory($webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey); + $to_directory = $this->getDestinationDirectory($source_assets_directory, $web_assets_directory_base); // Get a path to the stamp file $stamp_file_path = $to_directory . DS . '.source-stamp'; @@ -164,65 +177,64 @@ class AsseticAssetManager implements AssetManagerInterface $prev_stamp = @file_get_contents($stamp_file_path); // Get the current stamp of the source directory - $curr_stamp = $this->getStamp($sourceAssetsDirectory); + $curr_stamp = $this->getStamp($source_assets_directory); if ($prev_stamp !== $curr_stamp) { $fs = new Filesystem(); // FIXME: locking or not locking ? -/* - $lock_file = "$web_assets_directory_base/assets-".md5($source_assets_directory)."-generation-lock.txt"; + /* + $lock_file = "$web_assets_directory_base/assets-".md5($source_assets_directory)."-generation-lock.txt"; + + if (! $fp = fopen($lock_file, "w")) { + throw new IOException(sprintf('Failed to open lock file %s', $lock_file)); + } + + if (flock($fp, LOCK_EX|LOCK_NB)) { // do an exclusive lock + */ + $tmp_dir = "$to_directory.tmp"; - if (! $fp = fopen($lock_file, "w")) { - throw new IOException(sprintf('Failed to open lock file %s', $lock_file)); + $fs->remove($tmp_dir); + + // Copy the whole source dir in a temp directory + $this->copyAssets($fs, $source_assets_directory, $tmp_dir); + + // Remove existing directory + if ($fs->exists($to_directory)) $fs->remove($to_directory); + + // Put in place the new directory + $fs->rename($tmp_dir, $to_directory); + /* + // Release the lock + flock($fp, LOCK_UN); + + // Remove the lock file + @fclose($fp); + + $fs->remove($lock_file); + */ + if (false === @file_put_contents($stamp_file_path, $curr_stamp)) { + throw new \RuntimeException( + "Failed to create asset stamp file $stamp_file_path. Please check that your web server has the proper access rights to do that."); } - - if (flock($fp, LOCK_EX|LOCK_NB)) { // do an exclusive lock -*/ - $tmp_dir = "$to_directory.tmp"; - - $fs->remove($tmp_dir); - - // Copy the whole source dir in a temp directory - $this->copyAssets($fs, $sourceAssetsDirectory, $tmp_dir); - - // Remove existing directory - if ($fs->exists($to_directory)) $fs->remove($to_directory); - - // Put in place the new directory - $fs->rename($tmp_dir, $to_directory); -/* - // Release the lock - flock($fp, LOCK_UN); - - // Remove the lock file - @fclose($fp); - - $fs->remove($lock_file); -*/ - if (false === @file_put_contents($stamp_file_path, $curr_stamp)) { - throw new \RuntimeException( - "Failed to create asset stamp file $stamp_file_path. Please check that your web server has the proper access rights to do that."); - } -/* } - else { - @fclose($fp); - } -*/ + /* } else { + @fclose($fp); + } + */ } } /** * Decode the filters names, and initialize the Assetic FilterManager * - * @param FilterManager $filterManager the Assetic filter manager - * @param string $filters a comma separated list of filter names + * @param FilterManager $filterManager the Assetic filter manager + * @param string $filters a comma separated list of filter names * @throws \InvalidArgumentException if a wrong filter is passed - * @return an array of filter names + * @return an array of filter names */ - protected function decodeAsseticFilters(FilterManager $filterManager, $filters) { - + protected function decodeAsseticFilters(FilterManager $filterManager, $filters) + { if (!empty($filters)) { $filter_list = explode(',', $filters); @@ -261,8 +273,7 @@ class AsseticAssetManager implements AssetManagerInterface break; } } - } - else { + } else { $filter_list = array(); } @@ -272,73 +283,67 @@ class AsseticAssetManager implements AssetManagerInterface /** * Generates assets from $asset_path in $output_path, using $filters. * - * @param $assetSource - * @param $assetDirectoryBase - * @param string $webAssetsDirectoryBase the full path to the asset file (or file collection, e.g. *.less) + * @param string $asset_path the full path to the asset file (or file collection, e.g. *.less) * - * @param string $webAssetsTemplate the full disk path to the base assets output directory in the web space - * @param $webAssetsKey - * @param string $outputUrl the URL to the base assets output directory in the web space + * @param string $web_assets_directory_base the full disk path to the base assets output directory in the web space + * @param string $output_url the URL to the base assets output directory in the web space * - * @param string $assetType the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension. - * @param array $filters a list of filters, as defined below (see switch($filter_name) ...) + * @param string $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension. + * @param array $filters a list of filters, as defined below (see switch($filter_name) ...) * - * @param boolean $debug true / false - * - * @return string The URL to the generated asset file. + * @param boolean $debug true / false + * @throws \InvalidArgumentException if an invalid filter name is found + * @return string The URL to the generated asset file. */ - public function processAsset($assetSource, $assetDirectoryBase, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey, $outputUrl, $assetType, $filters, $debug) + public function processAsset($asset_path, $web_assets_directory_base, $output_url, $asset_type, $filters, $debug) { - $assetName = basename($assetSource); - $inputDirectory = realpath(dirname($assetSource)); - - $assetFileDirectoryInAssetDirectory = trim(str_replace(array($assetDirectoryBase, $assetName), '', $assetSource), DS); + $asset_name = basename($asset_path); + $input_directory = realpath(dirname($asset_path)); $am = new AssetManager(); $fm = new FilterManager(); // Get the filter list - $filterList = $this->decodeAsseticFilters($fm, $filters); + $filter_list = $this->decodeAsseticFilters($fm, $filters); // Factory setup - $factory = new AssetFactory($inputDirectory); + $factory = new AssetFactory($input_directory); $factory->setAssetManager($am); $factory->setFilterManager($fm); - $factory->setDefaultOutput('*' . (!empty($assetType) ? '.' : '') . $assetType); + $factory->setDefaultOutput('*' . (!empty($asset_type) ? '.' : '') . $asset_type); $factory->setDebug($debug); - $asset = $factory->createAsset($assetName, $filterList); + $asset = $factory->createAsset($asset_name, $filter_list); - $outputDirectory = $this->getDestinationDirectory($webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey); + $input_directory = realpath(dirname($asset_path)); + + $output_directory = $this->getDestinationDirectory($input_directory, $web_assets_directory_base); // Get the URL part from the relative path - $outputRelativePath = $webAssetsTemplate . DS . $webAssetsKey; + $output_relative_path = $this->getRelativeDirectoryPath($input_directory, $web_assets_directory_base); - $outputRelativeWebPath = rtrim(str_replace('\\', '/', $outputRelativePath), '/') . '/'; + $output_relative_web_path = rtrim(str_replace('\\', '/', $output_relative_path), '/') . '/'; - $assetTargetFilename = $asset->getTargetPath(); + $asset_target_filename = $asset->getTargetPath(); - /* - * This is the final name of the generated asset - * We preserve file structure intending to keep - for example - relative css links working - */ - $assetDestinationPath = $outputDirectory . DS . $assetFileDirectoryInAssetDirectory . DS . $assetTargetFilename; + // This is the final name of the generated asset + $asset_destination_path = $output_directory . DS . $asset_target_filename; - Tlog::getInstance()->addDebug("Asset destination full path: $assetDestinationPath"); + Tlog::getInstance()->addDebug("Asset destination full path: $asset_destination_path"); // We generate an asset only if it does not exists, or if the asset processing is forced in development mode - if (! file_exists($assetDestinationPath) || ($this->debugMode && ConfigQuery::read('process_assets', true)) ) { + if (! file_exists($asset_destination_path) || ($this->debugMode && ConfigQuery::read('process_assets', true)) ) { - $writer = new AssetWriter($outputDirectory . DS . $assetFileDirectoryInAssetDirectory); + $writer = new AssetWriter($output_directory); - Tlog::getInstance()->addDebug("Writing asset to $outputDirectory . DS . $assetFileDirectoryInAssetDirectory"); + Tlog::getInstance()->addDebug("Writing asset to $output_directory"); $writer->writeAsset($asset); } - return rtrim($outputUrl, '/') . '/' . trim($outputRelativeWebPath, '/') . '/' . trim($assetFileDirectoryInAssetDirectory, '/') . '/' . ltrim($assetTargetFilename, '/'); + return rtrim($output_url, '/') . '/' . ltrim($output_relative_web_path, '/') . $asset_target_filename; } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php index 6d4e6ed92..db61c20c1 100755 --- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php @@ -277,7 +277,6 @@ abstract class BaseLoop } } - protected function searchArray(array $search, &$pagination = null) { if (false === $this->countable) { @@ -286,7 +285,7 @@ abstract class BaseLoop if ($this->getArgValue('page') !== null) { $nbPage = ceil(count($search)/$this->getArgValue('limit')); - if($this->getArgValue('page') > $nbPage || $this->getArgValue('page') <= 0) { + if ($this->getArgValue('page') > $nbPage || $this->getArgValue('page') <= 0) { return array(); } @@ -338,9 +337,9 @@ abstract class BaseLoop */ public function exec(&$pagination) { - if($this instanceof PropelSearchLoopInterface) { + if ($this instanceof PropelSearchLoopInterface) { $searchModelCriteria = $this->buildModelCriteria(); - if(null === $searchModelCriteria) { + if (null === $searchModelCriteria) { $results = array(); } else { $results = $this->search( @@ -350,7 +349,7 @@ abstract class BaseLoop } } elseif ($this instanceof ArraySearchLoopInterface) { $searchArray = $this->buildArray(); - if(null === $searchArray) { + if (null === $searchArray) { $results = array(); } else { $results = $this->searchArray( @@ -362,13 +361,13 @@ abstract class BaseLoop $loopResult = new LoopResult($results); - if(true === $this->countable) { + if (true === $this->countable) { $loopResult->setCountable(); } - if(true === $this->timestampable) { + if (true === $this->timestampable) { $loopResult->setTimestamped(); } - if(true === $this->versionable) { + if (true === $this->versionable) { $loopResult->setVersioned(); } @@ -382,29 +381,29 @@ abstract class BaseLoop * - ArraySearchLoopInterface */ $searchInterface = false; - if($this instanceof PropelSearchLoopInterface) { - if(true === $searchInterface) { + if ($this instanceof PropelSearchLoopInterface) { + if (true === $searchInterface) { throw new LoopException('Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::MULTIPLE_SEARCH_INTERFACE); } $searchInterface = true; } - if($this instanceof ArraySearchLoopInterface) { - if(true === $searchInterface) { + if ($this instanceof ArraySearchLoopInterface) { + if (true === $searchInterface) { throw new LoopException('Loop cannot implements multiple Search Interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::MULTIPLE_SEARCH_INTERFACE); } $searchInterface = true; } - if(false === $searchInterface) { + if (false === $searchInterface) { throw new LoopException('Loop must implements one of the following interfaces : `PropelSearchLoopInterface`, `ArraySearchLoopInterface`', LoopException::SEARCH_INTERFACE_NOT_FOUND); } /* Only PropelSearch allows timestamp and version */ - if(!$this instanceof PropelSearchLoopInterface) { - if(true === $this->timestampable) { + if (!$this instanceof PropelSearchLoopInterface) { + if (true === $this->timestampable) { throw new LoopException("Loop must implements 'PropelSearchLoopInterface' to be timestampable", LoopException::NOT_TIMESTAMPED); } - if(true === $this->versionable) { + if (true === $this->versionable) { throw new LoopException("Loop must implements 'PropelSearchLoopInterface' to be versionable", LoopException::NOT_VERSIONED); } } diff --git a/core/lib/Thelia/Core/Template/Loop/Admin.php b/core/lib/Thelia/Core/Template/Loop/Admin.php index ef5ce7e1f..d9c49ef80 100755 --- a/core/lib/Thelia/Core/Template/Loop/Admin.php +++ b/core/lib/Thelia/Core/Template/Loop/Admin.php @@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\AdminQuery; -use Thelia\Type; /** * diff --git a/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php index 9411b1dbd..4ae41c3b6 100755 --- a/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php +++ b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php @@ -48,7 +48,7 @@ class AssociatedContent extends Content { protected $contentId; protected $contentPosition; - + /** * @return ArgumentCollection */ diff --git a/core/lib/Thelia/Core/Template/Loop/Auth.php b/core/lib/Thelia/Core/Template/Loop/Auth.php index 072193f34..0cb7a5e88 100755 --- a/core/lib/Thelia/Core/Template/Loop/Auth.php +++ b/core/lib/Thelia/Core/Template/Loop/Auth.php @@ -88,7 +88,7 @@ class Auth extends BaseLoop implements ArraySearchLoopInterface $module = $this->getModule(); $access = $this->getAccess(); - if(null !== $module) { + if (null !== $module) { $in = true; } diff --git a/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php b/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php index c1bc483f9..ae7226152 100644 --- a/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php +++ b/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Core\Template\Element\BaseI18nLoop; -use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\PropelSearchLoopInterface; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; diff --git a/core/lib/Thelia/Core/Template/Loop/Cart.php b/core/lib/Thelia/Core/Template/Loop/Cart.php index 88b5a53d4..32c6d9ff2 100755 --- a/core/lib/Thelia/Core/Template/Loop/Cart.php +++ b/core/lib/Thelia/Core/Template/Loop/Cart.php @@ -58,7 +58,7 @@ class Cart extends BaseLoop implements ArraySearchLoopInterface { $cart = $this->getCart($this->request); - if(null === $cart) { + if (null === $cart) { return array(); } @@ -81,7 +81,7 @@ class Cart extends BaseLoop implements ArraySearchLoopInterface { $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry(); - foreach($loopResult->getResultDataCollection() as $cartItem) { + foreach ($loopResult->getResultDataCollection() as $cartItem) { $product = $cartItem->getProduct(); $productSaleElement = $cartItem->getProductSaleElements(); diff --git a/core/lib/Thelia/Core/Template/Loop/CategoryPath.php b/core/lib/Thelia/Core/Template/Loop/CategoryPath.php index 1b7f68f22..d70654d0b 100755 --- a/core/lib/Thelia/Core/Template/Loop/CategoryPath.php +++ b/core/lib/Thelia/Core/Template/Loop/CategoryPath.php @@ -125,9 +125,9 @@ class CategoryPath extends BaseI18nLoop implements ArraySearchLoopInterface public function parseResults(LoopResult $loopResult) { - foreach($loopResult->getResultDataCollection() as $result) { + foreach ($loopResult->getResultDataCollection() as $result) { $loopResultRow = new LoopResultRow($result); - foreach($result as $output => $outputValue) { + foreach ($result as $output => $outputValue) { $loopResultRow->set($output, $outputValue); } $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Loop/CategoryTree.php b/core/lib/Thelia/Core/Template/Loop/CategoryTree.php index 3c3c3ffe0..35a9569f9 100755 --- a/core/lib/Thelia/Core/Template/Loop/CategoryTree.php +++ b/core/lib/Thelia/Core/Template/Loop/CategoryTree.php @@ -99,9 +99,9 @@ class CategoryTree extends BaseI18nLoop implements ArraySearchLoopInterface public function parseResults(LoopResult $loopResult) { - foreach($loopResult->getResultDataCollection() as $result) { + foreach ($loopResult->getResultDataCollection() as $result) { $loopResultRow = new LoopResultRow($result); - foreach($result as $output => $outputValue) { + foreach ($result as $output => $outputValue) { $loopResultRow->set($output, $outputValue); } $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Loop/Coupon.php b/core/lib/Thelia/Core/Template/Loop/Coupon.php index 3efa480e0..37ee4712e 100755 --- a/core/lib/Thelia/Core/Template/Loop/Coupon.php +++ b/core/lib/Thelia/Core/Template/Loop/Coupon.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Propel\Runtime\Util\PropelModelPager; use Thelia\Condition\ConditionFactory; use Thelia\Condition\Implementation\ConditionInterface; use Thelia\Core\HttpFoundation\Request; diff --git a/core/lib/Thelia/Core/Template/Loop/Currency.php b/core/lib/Thelia/Core/Template/Loop/Currency.php index 82aebeb32..3d7a5631e 100755 --- a/core/lib/Thelia/Core/Template/Loop/Currency.php +++ b/core/lib/Thelia/Core/Template/Loop/Currency.php @@ -158,6 +158,7 @@ class Currency extends BaseI18nLoop implements PropelSearchLoopInterface } /* perform search */ + return $search; } diff --git a/core/lib/Thelia/Core/Template/Loop/Customer.php b/core/lib/Thelia/Core/Template/Loop/Customer.php index f955cd217..d4b8effb0 100755 --- a/core/lib/Thelia/Core/Template/Loop/Customer.php +++ b/core/lib/Thelia/Core/Template/Loop/Customer.php @@ -36,9 +36,6 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\CustomerQuery; use Thelia\Type\TypeCollection; use Thelia\Type; -use Thelia\Model\OrderQuery; -use Thelia\Model\Map\OrderAddressTableMap; -use Thelia\Model\Map\OrderTableMap; /** * @@ -208,7 +205,6 @@ class Customer extends BaseLoop implements SearchLoopInterface, PropelSearchLoop $search->orderByCreatedAt(Criteria::DESC); break; - } } diff --git a/core/lib/Thelia/Core/Template/Loop/Delivery.php b/core/lib/Thelia/Core/Template/Loop/Delivery.php index f671f1ca9..93c73bb17 100644 --- a/core/lib/Thelia/Core/Template/Loop/Delivery.php +++ b/core/lib/Thelia/Core/Template/Loop/Delivery.php @@ -74,8 +74,8 @@ class Delivery extends BaseSpecificModule try { $postage = $moduleInstance->getPostage($country); - } catch(OrderException $e) { - switch($e->getCode()) { + } catch (OrderException $e) { + switch ($e->getCode()) { case OrderException::DELIVERY_MODULE_UNAVAILABLE: /* do not show this delivery module */ continue(2); diff --git a/core/lib/Thelia/Core/Template/Loop/Folder.php b/core/lib/Thelia/Core/Template/Loop/Folder.php index 84dee9f82..fa561b3fb 100755 --- a/core/lib/Thelia/Core/Template/Loop/Folder.php +++ b/core/lib/Thelia/Core/Template/Loop/Folder.php @@ -126,7 +126,6 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0); - $orders = $this->getOrder(); foreach ($orders as $order) { diff --git a/core/lib/Thelia/Core/Template/Loop/FolderPath.php b/core/lib/Thelia/Core/Template/Loop/FolderPath.php index 92c42f890..b50d7c55d 100644 --- a/core/lib/Thelia/Core/Template/Loop/FolderPath.php +++ b/core/lib/Thelia/Core/Template/Loop/FolderPath.php @@ -135,9 +135,9 @@ class FolderPath extends BaseI18nLoop implements ArraySearchLoopInterface public function parseResults(LoopResult $loopResult) { - foreach($loopResult->getResultDataCollection() as $result) { + foreach ($loopResult->getResultDataCollection() as $result) { $loopResultRow = new LoopResultRow($result); - foreach($result as $output => $outputValue) { + foreach ($result as $output => $outputValue) { $loopResultRow->set($output, $outputValue); } $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Loop/FolderTree.php b/core/lib/Thelia/Core/Template/Loop/FolderTree.php index 9598f7a5c..851b6d8ff 100644 --- a/core/lib/Thelia/Core/Template/Loop/FolderTree.php +++ b/core/lib/Thelia/Core/Template/Loop/FolderTree.php @@ -100,9 +100,9 @@ class FolderTree extends BaseI18nLoop implements ArraySearchLoopInterface public function parseResults(LoopResult $loopResult) { - foreach($loopResult->getResultDataCollection() as $result) { + foreach ($loopResult->getResultDataCollection() as $result) { $loopResultRow = new LoopResultRow($result); - foreach($result as $output => $outputValue) { + foreach ($result as $output => $outputValue) { $loopResultRow->set($output, $outputValue); } $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Loop/Image.php b/core/lib/Thelia/Core/Template/Loop/Image.php index b207deb29..def24ae2a 100755 --- a/core/lib/Thelia/Core/Template/Loop/Image.php +++ b/core/lib/Thelia/Core/Template/Loop/Image.php @@ -236,7 +236,6 @@ class Image extends BaseI18nLoop implements PropelSearchLoopInterface $search->filterById($exclude, Criteria::NOT_IN); // echo "sql=".$search->toString(); - return $search; } diff --git a/core/lib/Thelia/Core/Template/Loop/Module.php b/core/lib/Thelia/Core/Template/Loop/Module.php index db947f730..c3f544382 100755 --- a/core/lib/Thelia/Core/Template/Loop/Module.php +++ b/core/lib/Thelia/Core/Template/Loop/Module.php @@ -196,19 +196,19 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface /* first test if module defines it's own config route */ $routerId = "router." . $module->getBaseDir(); - if($this->container->has($routerId)) { + if ($this->container->has($routerId)) { try { - if($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) { + if ($this->container->get($routerId)->match('/admin/module/' . $module->getCode())) { $hasConfigurationInterface = true; } - } catch(ResourceNotFoundException $e) { + } catch (ResourceNotFoundException $e) { /* $hasConfigurationInterface stays false */ } } /* if not ; test if it uses admin inclusion : module_configuration.html */ - if(false === $hasConfigurationInterface) { - if(file_exists( sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), "module_configuration"))) { + if (false === $hasConfigurationInterface) { + if (file_exists( sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), "module_configuration"))) { $hasConfigurationInterface = true; } } diff --git a/core/lib/Thelia/Core/Template/Loop/Order.php b/core/lib/Thelia/Core/Template/Loop/Order.php index 5f12fa1eb..3fb04d60c 100755 --- a/core/lib/Thelia/Core/Template/Loop/Order.php +++ b/core/lib/Thelia/Core/Template/Loop/Order.php @@ -46,7 +46,7 @@ use Thelia\Type; */ class Order extends BaseLoop implements SearchLoopInterface, PropelSearchLoopInterface { - protected $countable = true; + protected $countable = true; protected $timestampable = true; protected $versionable = false; @@ -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/Core/Template/Loop/OrderProduct.php b/core/lib/Thelia/Core/Template/Loop/OrderProduct.php index f36162099..8e201f31c 100755 --- a/core/lib/Thelia/Core/Template/Loop/OrderProduct.php +++ b/core/lib/Thelia/Core/Template/Loop/OrderProduct.php @@ -72,7 +72,7 @@ class OrderProduct extends BaseLoop implements PropelSearchLoopInterface $search->orderById(Criteria::ASC); return $search; - + } public function parseResults(LoopResult $loopResult) diff --git a/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php b/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php index f248159c5..bb018ec98 100755 --- a/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php +++ b/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php @@ -87,7 +87,7 @@ class OrderProductAttributeCombination extends BaseI18nLoop implements PropelSea } return $search; - + } public function parseResults(LoopResult $loopResult) diff --git a/core/lib/Thelia/Core/Template/Loop/ProductTemplate.php b/core/lib/Thelia/Core/Template/Loop/ProductTemplate.php index ea1d94262..4d6491509 100644 --- a/core/lib/Thelia/Core/Template/Loop/ProductTemplate.php +++ b/core/lib/Thelia/Core/Template/Loop/ProductTemplate.php @@ -103,4 +103,4 @@ class ProductTemplate extends BaseI18nLoop implements PropelSearchLoopInterface return $loopResult; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Template/Loop/Profile.php b/core/lib/Thelia/Core/Template/Loop/Profile.php index bddcf856c..8b21d2fe0 100755 --- a/core/lib/Thelia/Core/Template/Loop/Profile.php +++ b/core/lib/Thelia/Core/Template/Loop/Profile.php @@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\ProfileQuery; -use Thelia\Type; /** * diff --git a/core/lib/Thelia/Core/Template/Loop/Template.php b/core/lib/Thelia/Core/Template/Loop/Template.php index c7f7ea191..f3b4a05f9 100644 --- a/core/lib/Thelia/Core/Template/Loop/Template.php +++ b/core/lib/Thelia/Core/Template/Loop/Template.php @@ -23,19 +23,12 @@ namespace Thelia\Core\Template\Loop; -use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Security\AccessManager; -use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; -use Thelia\Core\Template\Element\PropelSearchLoopInterface; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Model\ModuleQuery; - -use Thelia\Module\BaseModule; use Thelia\Type; use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateDefinition; @@ -72,8 +65,14 @@ class Template extends BaseLoop implements ArraySearchLoopInterface ); } +<<<<<<< HEAD public function buildArray() { $type = $this->getArg('template-type')->getValue(); +======= + public function buildArray() + { + $type = $this->getArg(template_type); +>>>>>>> cleanmaster if ($type == 'front-office') $templateType = TemplateDefinition::FRONT_OFFICE; diff --git a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php index b34232009..5deb6e9d0 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php +++ b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php @@ -23,8 +23,11 @@ namespace Thelia\Core\Template\Smarty\Assets; +<<<<<<< HEAD use Thelia\Core\Template\Assets\AsseticHelper; use Thelia\Core\Template\TemplateDefinition; +======= +>>>>>>> cleanmaster use Thelia\Tools\URL; use Thelia\Core\Template\Assets\AssetManagerInterface; @@ -42,9 +45,9 @@ class SmartyAssetsManager /** * Creates a new SmartyAssetsManager instance * - * @param AssetManagerInterface $assetsManager an asset manager instance - * @param string $web_root the disk path to the web root (with final /) - * @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated + * @param AssetManagerInterface $assetsManager an asset manager instance + * @param string $web_root the disk path to the web root (with final /) + * @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated */ public function __construct(AssetManagerInterface $assetsManager, $web_root, $path_relative_to_web_root) { @@ -56,6 +59,7 @@ class SmartyAssetsManager public function prepareAssets($assets_directory, \Smarty_Internal_Template $template) { +<<<<<<< HEAD self::$assetsDirectory = $assets_directory; $smartyParser = $template->smarty; @@ -70,6 +74,9 @@ class SmartyAssetsManager foreach($templateDirectories[$templateDefinition->getName()] as $key => $directory) { $tpl_path = $directory . DS . self::$assetsDirectory; +======= + $tpl_dir = dirname($template->source->filepath); +>>>>>>> cleanmaster $asset_dir_absolute_path = realpath($tpl_path); diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php index 78e1c8f5b..8b8ee8ef1 100644 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php @@ -27,8 +27,6 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Tools\URL; use Thelia\Core\Security\SecurityContext; -use Thelia\Model\Config; -use Thelia\Model\ConfigQuery; use Thelia\Core\Template\TemplateHelper; /** @@ -45,8 +43,8 @@ class AdminUtilities extends AbstractSmartyPlugin $this->securityContext = $securityContext; } - protected function fetch_snippet($smarty, $templateName, $variablesArray) { - + protected function fetch_snippet($smarty, $templateName, $variablesArray) + { $data = ''; $snippet_path = sprintf('%s/%s/%s.html', @@ -99,7 +97,6 @@ class AdminUtilities extends AbstractSmartyPlugin $module === null ? array() : array($module), array($access)) ) { - return $this->fetch_snippet($smarty, 'includes/admin-utilities-position-block', array( 'admin_utilities_go_up_url' => URL::getInstance()->absoluteUrl($path, array('mode' => 'up', $url_parameter => $id)), 'admin_utilities_in_place_edit_class' => $in_place_edit_class, diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Assets.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Assets.php index e4c220ed5..e4a5c866f 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Assets.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Assets.php @@ -56,10 +56,11 @@ class Assets extends AbstractSmartyPlugin { try { return $this->assetManager->processSmartyPluginCall('js', $params, $content, $template, $repeat); - } catch(\Exception $e) { + } catch (\Exception $e) { $catchException = $this->getNormalizedParam($params, array('catchException')); - if($catchException == "true") { + if ($catchException == "true") { $repeat = false; + return null; } else { throw $e; diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php index eab83e140..236f6b8be 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php @@ -212,6 +212,8 @@ class DataAccessFunctions extends AbstractSmartyPlugin switch ($attribute) { case 'postage': return $order->getPostage(); + case 'discount': + return $order->getDiscount(); case 'delivery_address': return $order->chosenDeliveryAddress; case 'invoice_address': @@ -267,69 +269,69 @@ class DataAccessFunctions extends AbstractSmartyPlugin $includeShipping = true; } - if($params['startDate'] == 'today') { + if ($params['startDate'] == 'today') { $startDate = new \DateTime(); $startDate->setTime(0, 0, 0); - } elseif($params['startDate'] == 'yesterday') { + } elseif ($params['startDate'] == 'yesterday') { $startDate = new \DateTime(); $startDate->setTime(0, 0, 0); $startDate->modify('-1 day'); - } elseif($params['startDate'] == 'this_month') { + } elseif ($params['startDate'] == 'this_month') { $startDate = new \DateTime(); $startDate->modify('first day of this month'); $startDate->setTime(0, 0, 0); - } elseif($params['startDate'] == 'last_month') { + } elseif ($params['startDate'] == 'last_month') { $startDate = new \DateTime(); $startDate->modify('first day of last month'); $startDate->setTime(0, 0, 0); - } elseif($params['startDate'] == 'this_year') { + } elseif ($params['startDate'] == 'this_year') { $startDate = new \DateTime(); $startDate->modify('first day of January this year'); $startDate->setTime(0, 0, 0); - } elseif($params['startDate'] == 'last_year') { + } elseif ($params['startDate'] == 'last_year') { $startDate = new \DateTime(); $startDate->modify('first day of December last year'); $startDate->setTime(0, 0, 0); } else { try { $startDate = new \DateTime($params['startDate']); - } catch(\Exception $e) { + } catch (\Exception $e) { throw new \InvalidArgumentException(sprintf("invalid startDate attribute '%s' in stats access function", $params['startDate'])); } } - if($params['endDate'] == 'today') { + if ($params['endDate'] == 'today') { $endDate = new \DateTime(); $endDate->setTime(0, 0, 0); - } elseif($params['endDate'] == 'yesterday') { + } elseif ($params['endDate'] == 'yesterday') { $endDate = new \DateTime(); $endDate->setTime(0, 0, 0); $endDate->modify('-1 day'); - } elseif($params['endDate'] == 'this_month') { + } elseif ($params['endDate'] == 'this_month') { $endDate = new \DateTime(); $endDate->modify('last day of this month'); $endDate->setTime(0, 0, 0); - } elseif($params['endDate'] == 'last_month') { + } elseif ($params['endDate'] == 'last_month') { $endDate = new \DateTime(); $endDate->modify('last day of last month'); $endDate->setTime(0, 0, 0); - } elseif($params['endDate'] == 'this_year') { + } elseif ($params['endDate'] == 'this_year') { $endDate = new \DateTime(); $endDate->modify('last day of December this year'); $endDate->setTime(0, 0, 0); - } elseif($params['endDate'] == 'last_year') { + } elseif ($params['endDate'] == 'last_year') { $endDate = new \DateTime(); $endDate->modify('last day of January last year'); $endDate->setTime(0, 0, 0); } else { try { $endDate = new \DateTime($params['endDate']); - } catch(\Exception $e) { + } catch (\Exception $e) { throw new \InvalidArgumentException(sprintf("invalid endDate attribute '%s' in stats access function", $params['endDate'])); } } - switch( $params['key'] ) { + switch ($params['key']) { case 'sales' : return OrderQuery::getSaleStats($startDate, $endDate, $includeShipping); case 'orders' : diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Esi.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Esi.php index 453335740..cfa3788bd 100644 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Esi.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Esi.php @@ -28,7 +28,6 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Template\Smarty\an; use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; - /** * Class Esi * @package Thelia\Core\Template\Smarty\Plugins @@ -53,7 +52,7 @@ class Esi extends AbstractSmartyPlugin $ignore_errors = $this->getParam($params, 'ignore_errors'); $comment = $this->getParam($params, 'comment'); - if(null === $path) { + if (null === $path) { return; } @@ -79,4 +78,4 @@ class Esi extends AbstractSmartyPlugin new SmartyPluginDescriptor('function', 'render_esi', $this, 'renderEsi') ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php index 9b86410de..4c92ee85c 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php @@ -48,7 +48,7 @@ class Module extends AbstractSmartyPlugin /** * Process theliaModule template inclusion function * - * @param unknown $params + * @param unknown $params * @param \Smarty_Internal_Template $template * @internal param \Thelia\Core\Template\Smarty\Plugins\unknown $smarty * @@ -60,7 +60,7 @@ class Module extends AbstractSmartyPlugin if (false !== $location = $this->getParam($params, 'location', false)) { - if($this->debug === true && $this->request->get('SHOW_INCLUDE')) { + if ($this->debug === true && $this->request->get('SHOW_INCLUDE')) { echo sprintf('
%s
', $location); } @@ -70,7 +70,7 @@ class Module extends AbstractSmartyPlugin foreach ($modules as $module) { - if(null !== $moduleLimit && $moduleLimit != $module->getCode()) { + if (null !== $moduleLimit && $moduleLimit != $module->getCode()) { continue; } diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php index 5900b3295..cc0cb1ee0 100755 --- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php +++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php @@ -14,9 +14,6 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Template\Exception\ResourceNotFoundException; use Thelia\Core\Template\ParserContext; use Thelia\Core\Template\TemplateDefinition; -use Thelia\Model\ConfigQuery; -use Thelia\Core\Template\TemplateHelper; -use Imagine\Exception\InvalidArgumentException; use Thelia\Core\Translation\Translator; /** @@ -35,12 +32,7 @@ class SmartyParser extends Smarty implements ParserInterface protected $backOfficeTemplateDirectories = array(); protected $frontOfficeTemplateDirectories = array(); - protected $templateDirectories = array(); - - /** - * @var TemplateDefinition - */ - protected $templateDefinition = ""; + protected $template = ""; protected $status = 200; @@ -52,8 +44,8 @@ class SmartyParser extends Smarty implements ParserInterface * @param bool $debug */ public function __construct( - Request $request, EventDispatcherInterface $dispatcher, ParserContext $parserContext, - $env = "prod", $debug = false) + Request $request, EventDispatcherInterface $dispatcher, ParserContext $parserContext, + $env = "prod", $debug = false) { parent::__construct(); @@ -72,7 +64,6 @@ class SmartyParser extends Smarty implements ParserInterface $this->setCompileDir($compile_dir); $this->setCacheDir($cache_dir); - $this->debugging = $debug; // Prevent smarty ErrorException: Notice: Undefined index bla bla bla... @@ -80,7 +71,7 @@ class SmartyParser extends Smarty implements ParserInterface // Si on n'est pas en mode debug, activer le cache, avec une lifetime de 15mn, et en vérifiant que les templates sources n'ont pas été modifiés. - if($debug) { + if ($debug) { $this->setCaching(Smarty::CACHING_OFF); $this->setForceCompile(true); } else { @@ -89,7 +80,6 @@ class SmartyParser extends Smarty implements ParserInterface //$this->enableSecurity(); - // The default HTTP status $this->status = 200; @@ -97,46 +87,6 @@ class SmartyParser extends Smarty implements ParserInterface $this->registerFilter('variable', array(__CLASS__, "theliaEscape")); } - /** - * Add a template directory to the current template list - * - * @param unknown $templateType the template type (a TemplateDefinition type constant) - * @param string $templateName the template name - * @param string $templateDirectory path to the template dirtectory - * @param unknown $key ??? - * @param string $unshift ??? Etienne ? - */ - public function addTemplateDirectory($templateType, $templateName, $templateDirectory, $key, $unshift = false) { - - if(true === $unshift && isset($this->templateDirectories[$templateType][$templateName])) { - - $this->templateDirectories[$templateType][$templateName] = array_merge( - array( - $key => $templateDirectory, - ), - $this->templateDirectories[$templateType][$templateName] - ); - } else { - $this->templateDirectories[$templateType][$templateName][$key] = $templateDirectory; - } - } - - /** - * Return the registeted template directories for a givent template type - * - * @param unknown $templateType - * @throws InvalidArgumentException - * @return multitype: - */ - public function getTemplateDirectories($templateType) - { - if (! isset($this->templateDirectories[$templateType])) { - throw new InvalidArgumentException("Failed to get template type %", $templateType); - } - - return $this->templateDirectories[$templateType]; - } - public function removeBlankLines($tpl_source, \Smarty_Internal_Template $template) { return preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $tpl_source); @@ -151,52 +101,72 @@ class SmartyParser extends Smarty implements ParserInterface } } + public function addBackOfficeTemplateDirectory($templateName, $templateDirectory, $key) + { + $this->backOfficeTemplateDirectories[$templateName][$key] = $templateDirectory; + } + + public function addFrontOfficeTemplateDirectory($templateName, $templateDirectory, $key) + { + $this->frontOfficeTemplateDirectories[$templateName][$key] = $templateDirectory; + } + /** * @param TemplateDefinition $templateDefinition */ - public function setTemplateDefinition(TemplateDefinition $templateDefinition) + public function setTemplate(TemplateDefinition $templateDefinition) { - $this->templateDefinition = $templateDefinition; + $this->template = $templateDefinition->getPath(); /* init template directories */ $this->setTemplateDir(array()); + /* add main template directory */ + $this->addTemplateDir($templateDefinition->getAbsolutePath(), 0); + /* define config directory */ - $configDirectory = THELIA_TEMPLATE_DIR . $this->getTemplate() . '/configs'; + $configDirectory = $templateDefinition->getAbsoluteConfigPath(); $this->setConfigDir($configDirectory); /* add modules template directories */ - $this->addTemplateDirectory( - $templateDefinition->getType(), - $templateDefinition->getName(), - THELIA_TEMPLATE_DIR . $this->getTemplate(), - '0', - true - ); + switch ($templateDefinition->getType()) { + case TemplateDefinition::FRONT_OFFICE: + /* do not pass array directly to addTemplateDir since we cant control on keys */ + if (isset($this->frontOfficeTemplateDirectories[$templateDefinition->getName()])) { + foreach ($this->frontOfficeTemplateDirectories[$templateDefinition->getName()] as $key => $directory) { + $this->addTemplateDir($directory, $key); + } + } + break; - /* do not pass array directly to addTemplateDir since we cant control on keys */ - if (isset($this->templateDirectories[$templateDefinition->getType()][$templateDefinition->getName()])) { - foreach($this->templateDirectories[$templateDefinition->getType()][$templateDefinition->getName()] as $key => $directory) { - $this->addTemplateDir($directory, $key); - } + case TemplateDefinition::BACK_OFFICE: + /* do not pass array directly to addTemplateDir since we cant control on keys */ + if (isset($this->backOfficeTemplateDirectories[$templateDefinition->getName()])) { + foreach ($this->backOfficeTemplateDirectories[$templateDefinition->getName()] as $key => $directory) { + $this->addTemplateDir($directory, $key); + } + } + break; + + case TemplateDefinition::PDF: + break; + + default: + break; } } - public function getTemplateDefinition() - { - return $this->templateDefinition; - } - public function getTemplate() { - return $this->templateDefinition->getPath(); + return $this->template; } + /** * Return a rendered template, either from file or ftom a string * - * @param string $resourceType either 'string' (rendering from a string) or 'file' (rendering a file) + * @param string $resourceType either 'string' (rendering from a string) or 'file' (rendering a file) * @param string $resourceContent the resource content (a text, or a template file name) - * @param array $parameters an associative array of names / value pairs + * @param array $parameters an associative array of names / value pairs * * @return string the rendered template text */ @@ -215,8 +185,8 @@ class SmartyParser extends Smarty implements ParserInterface /** * Return a rendered template file * - * @param string $realTemplateName the template name (from the template directory) - * @param array $parameters an associative array of names / value pairs + * @param string $realTemplateName the template name (from the template directory) + * @param array $parameters an associative array of names / value pairs * @return string the rendered template text */ public function render($realTemplateName, array $parameters = array()) @@ -231,8 +201,8 @@ class SmartyParser extends Smarty implements ParserInterface /** * Return a rendered template text * - * @param string $templateText the template text - * @param array $parameters an associative array of names / value pairs + * @param string $templateText the template text + * @param array $parameters an associative array of names / value pairs * @return string the rendered template text */ public function renderString($templateText, array $parameters = array()) @@ -287,15 +257,15 @@ class SmartyParser extends Smarty implements ParserInterface foreach ($plugins as $plugin) { $this->registerPlugin( - $plugin->getType(), - $plugin->getName(), - array( - $plugin->getClass(), - $plugin->getMethod() - ) + $plugin->getType(), + $plugin->getName(), + array( + $plugin->getClass(), + $plugin->getMethod() + ) ); } } } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/TemplateDefinition.php b/core/lib/Thelia/Core/Template/TemplateDefinition.php index 7a4d1685c..5ff04b720 100644 --- a/core/lib/Thelia/Core/Template/TemplateDefinition.php +++ b/core/lib/Thelia/Core/Template/TemplateDefinition.php @@ -1,7 +1,7 @@ . */ +/* along with this program. If not, see . */ /* */ /*************************************************************************************/ @@ -35,13 +35,6 @@ class TemplateDefinition const PDF_SUBDIR = 'pdf/'; const EMAIL_SUBDIR = 'email/'; - protected static $standardTemplatesSubdirs = array( - self::FRONT_OFFICE => self::FRONT_OFFICE_SUBDIR, - self::BACK_OFFICE => self::BACK_OFFICE_SUBDIR, - self::PDF => self::PDF_SUBDIR, - self::EMAIL => self::EMAIL_SUBDIR, - ); - /** * @var the template directory name (e.g. 'default') */ @@ -57,13 +50,12 @@ class TemplateDefinition */ protected $type; - public function __construct($name, $type) { $this->name = $name; $this->type = $type; - switch($type) { + switch ($type) { case TemplateDefinition::FRONT_OFFICE: $this->path = self::FRONT_OFFICE_SUBDIR . $name; break; @@ -90,14 +82,17 @@ class TemplateDefinition public function setName($name) { $this->name = $name; + return $this; } - public function getI18nPath() { + public function getI18nPath() + { return $this->getPath() . DS . 'I18n'; } - public function getAbsoluteI18nPath() { + public function getAbsoluteI18nPath() + { return THELIA_TEMPLATE_DIR . $this->getI18nPath(); } @@ -106,7 +101,8 @@ class TemplateDefinition return $this->path; } - public function getAbsolutePath() { + public function getAbsolutePath() + { return THELIA_TEMPLATE_DIR . $this->getPath(); } @@ -115,13 +111,15 @@ class TemplateDefinition return $this->getPath() . DS . 'configs'; } - public function getAbsoluteConfigPath() { + public function getAbsoluteConfigPath() + { return THELIA_TEMPLATE_DIR . $this->getConfigPath(); } public function setPath($path) { $this->path = $path; + return $this; } @@ -133,13 +131,7 @@ class TemplateDefinition public function setType($type) { $this->type = $type; + return $this; } - - /** - * Returns an iterator on the standard templates subdir names - */ - public static function getStandardTemplatesSubdirsIterator() { - return new \ArrayIterator(self::$standardTemplatesSubdirs); - } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/TemplateHelper.php b/core/lib/Thelia/Core/Template/TemplateHelper.php index 175f83b42..b7c8fcddd 100644 --- a/core/lib/Thelia/Core/Template/TemplateHelper.php +++ b/core/lib/Thelia/Core/Template/TemplateHelper.php @@ -40,16 +40,17 @@ class TemplateHelper private function __construct() {} - public static function getInstance() { + public static function getInstance() + { if (self::$instance == null) self::$instance = new TemplateHelper(); - return self::$instance; } /** * @return TemplateDefinition */ - public function getActiveMailTemplate() { + public function getActiveMailTemplate() + { return new TemplateDefinition( ConfigQuery::read('active-mail-template', 'default'), TemplateDefinition::EMAIL @@ -59,7 +60,8 @@ class TemplateHelper /** * @return TemplateDefinition */ - public function getActivePdfTemplate() { + public function getActivePdfTemplate() + { return new TemplateDefinition( ConfigQuery::read('active-pdf-template', 'default'), TemplateDefinition::PDF @@ -69,7 +71,8 @@ class TemplateHelper /** * @return TemplateDefinition */ - public function getActiveAdminTemplate() { + public function getActiveAdminTemplate() + { return new TemplateDefinition( ConfigQuery::read('active-admin-template', 'default'), TemplateDefinition::BACK_OFFICE @@ -79,13 +82,15 @@ class TemplateHelper /** * @return TemplateDefinition */ - public function getActiveFrontTemplate() { + public function getActiveFrontTemplate() + { return new TemplateDefinition( ConfigQuery::read('active-front-template', 'default'), TemplateDefinition::FRONT_OFFICE ); } +<<<<<<< HEAD /** * Returns an array which contains all standard template definitions */ @@ -109,6 +114,18 @@ class TemplateHelper $list = $exclude = array(); $tplIterator = TemplateDefinition::getStandardTemplatesSubdirsIterator(); +======= + public function getList($templateType) + { + $list = $exclude = array(); + + if ($templateType == TemplateDefinition::BACK_OFFICE) { + $baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::BACK_OFFICE_SUBDIR; + } elseif ($templateType == TemplateDefinition::PDF) { + $baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::PDF_SUBDIR; + } else { + $baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::FRONT_OFFICE_SUBDIR; +>>>>>>> cleanmaster foreach($tplIterator as $type => $subdir) { @@ -134,7 +151,6 @@ class TemplateHelper } } - protected function normalize_path($path) { $path = str_replace( @@ -155,28 +171,27 @@ class TemplateHelper * 'translation' => the text translation, or an empty string if none available. * 'dollar' => true if the translatable text contains a $ * - * @param string $directory the path to the directory to examine - * @param string $walkMode type of file scanning: WALK_MODE_PHP or WALK_MODE_TEMPLATE - * @param \Thelia\Core\Translation\Translator $translator the current translator - * @param string $currentLocale the current locale - * @param array $strings the list of strings - * @throws \InvalidArgumentException if $walkMode contains an invalid value - * @return number the total number of translatable texts + * @param string $directory the path to the directory to examine + * @param string $walkMode type of file scanning: WALK_MODE_PHP or WALK_MODE_TEMPLATE + * @param \Thelia\Core\Translation\Translator $translator the current translator + * @param string $currentLocale the current locale + * @param array $strings the list of strings + * @throws \InvalidArgumentException if $walkMode contains an invalid value + * @return number the total number of translatable texts */ - public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings) { - + public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings) + { $num_texts = 0; if ($walkMode == self::WALK_MODE_PHP) { $prefix = '\-\>[\s]*trans[\s]*\('; $allowed_exts = array('php'); - } else if ($walkMode == self::WALK_MODE_TEMPLATE) { + } elseif ($walkMode == self::WALK_MODE_TEMPLATE) { $prefix = '\{intl[\s]l='; $allowed_exts = array('html', 'tpl', 'xml'); - } - else { + } else { throw new \InvalidArgumentException( Translator::getInstance()->trans('Invalid value for walkMode parameter: %value', array('%value' => $walkMode)) ); @@ -210,18 +225,15 @@ class TemplateHelper Tlog::getInstance()->debug("Strings found: ", $matches[2]); - foreach($matches[2] as $match) { + foreach ($matches[2] as $match) { $hash = md5($match); - if (isset($strings[$hash])) - { - if (! in_array($short_path, $strings[$hash]['files'])) - { + if (isset($strings[$hash])) { + if (! in_array($short_path, $strings[$hash]['files'])) { $strings[$hash]['files'][] = $short_path; } - } - else { + } else { $num_texts++; // remove \' @@ -273,9 +285,7 @@ class TemplateHelper fwrite($fp, ");\n"); @fclose($fp); - } - else - { + } else { throw new \RuntimeException( Translator::getInstance()->trans( 'Failed to open translation file %file. Please be sure that this file is writable by your Web server', diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index 289f22d02..6b3ba4266 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -49,7 +49,6 @@ use Thelia\Config\DefinePropel; use Thelia\Core\Template\TemplateDefinition; use Thelia\Core\TheliaContainerBuilder; use Thelia\Core\DependencyInjection\Loader\XmlFileLoader; -use Thelia\Model\ConfigQuery; use Symfony\Component\Config\FileLocator; use Propel\Runtime\Propel; @@ -176,7 +175,7 @@ class Thelia extends Kernel ->depth(0) ->in(THELIA_ROOT . "/core/lib/Thelia/Config/Resources"); - foreach($finder as $file) { + foreach ($finder as $file) { $loader->load($file->getBaseName()); } @@ -198,6 +197,11 @@ class Thelia extends Kernel $definition ); +<<<<<<< HEAD +======= + $code = ucfirst($module->getCode()); + +>>>>>>> cleanmaster $loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath())); $loader->load("config.xml"); diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php index ed4dd672b..6449d0648 100755 --- a/core/lib/Thelia/Core/TheliaHttpKernel.php +++ b/core/lib/Thelia/Core/TheliaHttpKernel.php @@ -215,7 +215,7 @@ class TheliaHttpKernel extends HttpKernel protected function initSession(Request $request) { - if(null === self::$session) { + if (null === self::$session) { $storage = new Session\Storage\NativeSessionStorage(); if (Model\ConfigQuery::read("session_config.default")) { diff --git a/core/lib/Thelia/Core/Translation/Translator.php b/core/lib/Thelia/Core/Translation/Translator.php index 775ef7ad8..fc1c75de2 100755 --- a/core/lib/Thelia/Core/Translation/Translator.php +++ b/core/lib/Thelia/Core/Translation/Translator.php @@ -40,7 +40,7 @@ class Translator extends BaseTranslator public function getLocale() { - if($this->container->isScopeActive('request') && $this->container->has('request')) { + if ($this->container->isScopeActive('request') && $this->container->has('request')) { return $this->container->get('request')->getSession()->getLang()->getLocale(); } diff --git a/core/lib/Thelia/Coupon/CouponManager.php b/core/lib/Thelia/Coupon/CouponManager.php index c11a7e896..22488559e 100644 --- a/core/lib/Thelia/Coupon/CouponManager.php +++ b/core/lib/Thelia/Coupon/CouponManager.php @@ -78,15 +78,8 @@ class CouponManager if (count($this->coupons) > 0) { $couponsKept = $this->sortCoupons($this->coupons); - $isRemovingPostage = $this->isCouponRemovingPostage($couponsKept); - $discount = $this->getEffect($couponsKept); - if ($isRemovingPostage) { - $postage = $this->facade->getCheckoutPostagePrice(); - $discount += $postage; - } - // Just In Case test $checkoutTotalPrice = $this->facade->getCartTotalPrice(); if ($discount >= $checkoutTotalPrice) { @@ -99,23 +92,24 @@ class CouponManager /** * Check if there is a Coupon removing Postage - * - * @param array $couponsKept Array of CouponInterface sorted - * * @return bool */ - protected function isCouponRemovingPostage(array $couponsKept) + public function isCouponRemovingPostage() { - $isRemovingPostage = false; + if (count($this->coupons) == 0) { + return false; + } + + $couponsKept = $this->sortCoupons($this->coupons); /** @var CouponInterface $coupon */ foreach ($couponsKept as $coupon) { if ($coupon->isRemovingPostage()) { - $isRemovingPostage = true; + return true; } } - return $isRemovingPostage; + return false; } /** diff --git a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php index 3bf0c372a..6f44ecc92 100755 --- a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php @@ -23,7 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\ExecutionContextInterface; -use Thelia\Core\Translation\Translator; use Thelia\Model\CustomerQuery; /** diff --git a/core/lib/Thelia/Form/MailingSystemModificationForm.php b/core/lib/Thelia/Form/MailingSystemModificationForm.php index 8334777ab..709c19144 100644 --- a/core/lib/Thelia/Form/MailingSystemModificationForm.php +++ b/core/lib/Thelia/Form/MailingSystemModificationForm.php @@ -23,7 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Core\Translation\Translator; use Thelia\Model\ProfileQuery; diff --git a/core/lib/Thelia/Form/ProductCombinationGenerationForm.php b/core/lib/Thelia/Form/ProductCombinationGenerationForm.php index 8e4b155b9..1ca633ccd 100644 --- a/core/lib/Thelia/Form/ProductCombinationGenerationForm.php +++ b/core/lib/Thelia/Form/ProductCombinationGenerationForm.php @@ -23,7 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\GreaterThan; -use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Model\Currency; use Thelia\Core\Translation\Translator; @@ -88,4 +87,4 @@ class ProductCombinationGenerationForm extends BaseForm { return 'thelia_product_combination_generation_form'; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/ProductModificationForm.php b/core/lib/Thelia/Form/ProductModificationForm.php index 9dce2e4e5..d2819737c 100644 --- a/core/lib/Thelia/Form/ProductModificationForm.php +++ b/core/lib/Thelia/Form/ProductModificationForm.php @@ -25,7 +25,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\GreaterThan; use Thelia\Core\Translation\Translator; - class ProductModificationForm extends ProductCreationForm { use StandardDescriptionFieldsTrait; diff --git a/core/lib/Thelia/Form/SeoFieldsTrait.php b/core/lib/Thelia/Form/SeoFieldsTrait.php index 5b3270793..95ce487fc 100755 --- a/core/lib/Thelia/Form/SeoFieldsTrait.php +++ b/core/lib/Thelia/Form/SeoFieldsTrait.php @@ -35,7 +35,7 @@ trait SeoFieldsTrait /** * Add seo meta title, meta description and meta keywords fields * - * @param array $exclude name of the fields that should not be added to the form + * @param array $exclude name of the fields that should not be added to the form */ protected function addSeoFields($exclude = array()) { diff --git a/core/lib/Thelia/Form/SystemLogConfigurationForm.php b/core/lib/Thelia/Form/SystemLogConfigurationForm.php index 9ba9e6cf2..f4eb62285 100644 --- a/core/lib/Thelia/Form/SystemLogConfigurationForm.php +++ b/core/lib/Thelia/Form/SystemLogConfigurationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\ConfigQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Log\Tlog; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Install/CheckPermission.php b/core/lib/Thelia/Install/CheckPermission.php index 6a9a5245e..efdaf6f04 100644 --- a/core/lib/Thelia/Install/CheckPermission.php +++ b/core/lib/Thelia/Install/CheckPermission.php @@ -58,7 +58,7 @@ class CheckPermission extends BaseInstall /** @var array Minimum server configuration necessary */ protected $minServerConfigurationNecessary = array( - 'memory_limit' => 157286400, + 'memory_limit' => 134217728, 'post_max_size' => 20971520, 'upload_max_filesize' => 2097152 ); diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationFile.php b/core/lib/Thelia/Log/Destination/TlogDestinationFile.php index 80aa3ec25..08b7aab66 100755 --- a/core/lib/Thelia/Log/Destination/TlogDestinationFile.php +++ b/core/lib/Thelia/Log/Destination/TlogDestinationFile.php @@ -138,4 +138,4 @@ class TlogDestinationFile extends AbstractTlogDestination $this->fh = false; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php b/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php index 546ab488c..e1f3444a5 100644 --- a/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php +++ b/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php @@ -25,27 +25,29 @@ namespace Thelia\Log\Destination; use Thelia\Log\AbstractTlogDestination; -class TlogDestinationJavascriptConsole extends AbstractTlogDestination { +class TlogDestinationJavascriptConsole extends AbstractTlogDestination +{ + public function getTitle() + { + return "Browser's Javascript console"; + } - public function getTitle() { - return "Browser's Javascript console"; - } + public function getDescription() + { + return "The Thelia logs are displayed in your browser's Javascript console."; + } - public function getDescription() { - return "The Thelia logs are displayed in your browser's Javascript console."; - } + public function write(&$res) + { + $content = ''."\n"; - foreach($this->_logs as $line) { - $content .= "console.log('".str_replace("'", "\\'", str_replace(array("\r\n", "\r", "\n"), '\\n', $line))."');\n"; - } - - $content .= '} catch(ex) { alert("Les logs Thelia ne peuvent être affichés dans la console javascript:" + ex); }'."\n"; - - if (preg_match("||i", $res)) - $res = preg_replace("||i", "$content", $res); + if (preg_match("||i", $res)) + $res = preg_replace("||i", "$content", $res); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php b/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php index 1734e2f43..547a24c85 100644 --- a/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php +++ b/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php @@ -26,86 +26,88 @@ namespace Thelia\Log\Destination; use Thelia\Log\AbstractTlogDestination; use Thelia\Log\TlogDestinationConfig; -class TlogDestinationPopup extends AbstractTlogDestination { +class TlogDestinationPopup extends AbstractTlogDestination +{ + // Nom des variables de configuration + // ---------------------------------- + const VAR_POPUP_WIDTH = "tlog_destinationpopup_width"; + const VALEUR_POPUP_WIDTH_DEFAUT = "600"; - // Nom des variables de configuration - // ---------------------------------- - const VAR_POPUP_WIDTH = "tlog_destinationpopup_width"; - const VALEUR_POPUP_WIDTH_DEFAUT = "600"; + const VAR_POPUP_HEIGHT = "tlog_destinationpopup_height"; + const VALEUR_POPUP_HEIGHT_DEFAUT = "600"; - const VAR_POPUP_HEIGHT = "tlog_destinationpopup_height"; - const VALEUR_POPUP_HEIGHT_DEFAUT = "600"; + const VAR_POPUP_TPL = "tlog_destinationpopup_template"; + // Ce fichier doit se trouver dans le même répertoire que TlogDestinationPopup.class.php + const VALEUR_POPUP_TPL_DEFAUT = "TlogDestinationPopup.tpl"; - const VAR_POPUP_TPL = "tlog_destinationpopup_template"; - // Ce fichier doit se trouver dans le même répertoire que TlogDestinationPopup.class.php - const VALEUR_POPUP_TPL_DEFAUT = "TlogDestinationPopup.tpl"; + public function getTitle() + { + return "Javascript popup window"; + } - public function getTitle() { - return "Javascript popup window"; - } + public function getDescription() + { + return "Display logs in a popup window, separate from the main window ."; + } - public function getDescription() { - return "Display logs in a popup window, separate from the main window ."; - } + public function getConfigs() + { + return array( + new TlogDestinationConfig( + self::VAR_POPUP_TPL, + "Popup windows template", + "Put #LOGTEXT in the template text where you want to display logs..", + file_get_contents(__DIR__.DS. self::VALEUR_POPUP_TPL_DEFAUT), + TlogDestinationConfig::TYPE_TEXTAREA + ), + new TlogDestinationConfig( + self::VAR_POPUP_HEIGHT, + "Height of the popup window", + "In pixels", + self::VALEUR_POPUP_HEIGHT_DEFAUT, + TlogDestinationConfig::TYPE_TEXTFIELD + ), + new TlogDestinationConfig( + self::VAR_POPUP_WIDTH, + "Width of the popup window", + "In pixels", + self::VALEUR_POPUP_WIDTH_DEFAUT, + TlogDestinationConfig::TYPE_TEXTFIELD + ) + ); + } - public function getConfigs() { - return array( - new TlogDestinationConfig( - self::VAR_POPUP_TPL, - "Popup windows template", - "Put #LOGTEXT in the template text where you want to display logs..", - file_get_contents(__DIR__.DS. self::VALEUR_POPUP_TPL_DEFAUT), - TlogDestinationConfig::TYPE_TEXTAREA - ), - new TlogDestinationConfig( - self::VAR_POPUP_HEIGHT, - "Height of the popup window", - "In pixels", - self::VALEUR_POPUP_HEIGHT_DEFAUT, - TlogDestinationConfig::TYPE_TEXTFIELD - ), - new TlogDestinationConfig( - self::VAR_POPUP_WIDTH, - "Width of the popup window", - "In pixels", - self::VALEUR_POPUP_WIDTH_DEFAUT, - TlogDestinationConfig::TYPE_TEXTFIELD - ) - ); - } + public function write(&$res) + { + $content = ""; $count = 1; - public function write(&$res) { + foreach ($this->_logs as $line) { + $content .= "
".htmlspecialchars($line)."
"; + } - $content = ""; $count = 1; + $tpl = $this->getConfig(self::VAR_POPUP_TPL); - foreach($this->_logs as $line) { - $content .= "
".htmlspecialchars($line)."
"; - } + $tpl = str_replace('#LOGTEXT', $content, $tpl); + $tpl = str_replace(array("\r\n", "\r", "\n"), '\\n', $tpl); - $tpl = $this->getConfig(self::VAR_POPUP_TPL); + $wop = sprintf(' + ', + $this->getConfig(self::VAR_POPUP_WIDTH), + $this->getConfig(self::VAR_POPUP_HEIGHT), + str_replace('"', '\\"', $tpl) + ); - $tpl = str_replace('#LOGTEXT', $content, $tpl); - $tpl = str_replace(array("\r\n", "\r", "\n"), '\\n', $tpl); - - $wop = sprintf(' - ', - $this->getConfig(self::VAR_POPUP_WIDTH), - $this->getConfig(self::VAR_POPUP_HEIGHT), - str_replace('"', '\\"', $tpl) - ); - - if (preg_match("||i", $res)) - $res = preg_replace("||i", "$wop\n", $res); - else - $res .= $wop; + if (preg_match("||i", $res)) + $res = preg_replace("||i", "$wop\n", $res); + else + $res .= $wop; } } diff --git a/core/lib/Thelia/Log/Tlog.php b/core/lib/Thelia/Log/Tlog.php index 86bd8bb29..139de9f26 100755 --- a/core/lib/Thelia/Log/Tlog.php +++ b/core/lib/Thelia/Log/Tlog.php @@ -171,7 +171,8 @@ class Tlog Implements LoggerInterface * * @return array of directories */ - public function getDestinationsDirectories() { + public function getDestinationsDirectories() + { return $this->dir_destinations; } diff --git a/core/lib/Thelia/Log/TlogDestinationConfig.php b/core/lib/Thelia/Log/TlogDestinationConfig.php index 01c8fbe4f..cbc56fd33 100755 --- a/core/lib/Thelia/Log/TlogDestinationConfig.php +++ b/core/lib/Thelia/Log/TlogDestinationConfig.php @@ -22,7 +22,6 @@ /*************************************************************************************/ namespace Thelia\Log; -use Thelia\Model\Config; use Thelia\Model\ConfigQuery; class TlogDestinationConfig 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/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/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 58% rename from core/lib/Thelia/Model/Base/CouponOrder.php rename to core/lib/Thelia/Model/Base/OrderCoupon.php index 4488e8ec6..296b1af0a 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,70 @@ 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 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 +160,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 +255,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 +340,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 +372,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 +440,133 @@ 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 [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 +613,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 +623,7 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[] = CouponOrderTableMap::ID; + $this->modifiedColumns[] = OrderCouponTableMap::ID; } @@ -455,7 +634,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 +644,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 +656,266 @@ 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() + + /** + * 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 +923,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 +936,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 +944,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 +989,55 @@ 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('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_cumulative = (null !== $col) ? (boolean) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : OrderCouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_removing_postage = (null !== $col) ? (boolean) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $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 ? 12 + $startcol : OrderCouponTableMap::translateFieldName('SerializedConditions', TableMap::TYPE_PHPNAME, $indexType)]; + $this->serialized_conditions = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $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 ? 14 + $startcol : OrderCouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -604,10 +1050,10 @@ abstract class CouponOrder implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 5; // 5 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 15; // 15 = 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 +1098,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 +1124,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 +1134,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 +1176,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 +1186,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 +1207,7 @@ abstract class CouponOrder implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - CouponOrderTableMap::addInstanceToPool($this); + OrderCouponTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -834,30 +1280,60 @@ 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::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 +1342,49 @@ 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 '`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 +1433,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 +1456,42 @@ 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->getIsCumulative(); + break; + case 10: + return $this->getIsRemovingPostage(); + break; + case 11: + return $this->getIsAvailableOnSpecialOffers(); + break; + case 12: + return $this->getSerializedConditions(); + break; + case 13: + return $this->getCreatedAt(); + break; + case 14: return $this->getUpdatedAt(); break; default: @@ -981,17 +1517,27 @@ 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->getIsCumulative(), + $keys[10] => $this->getIsRemovingPostage(), + $keys[11] => $this->getIsAvailableOnSpecialOffers(), + $keys[12] => $this->getSerializedConditions(), + $keys[13] => $this->getCreatedAt(), + $keys[14] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1020,7 +1566,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 +1589,42 @@ 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->setIsCumulative($value); + break; + case 10: + $this->setIsRemovingPostage($value); + break; + case 11: + $this->setIsAvailableOnSpecialOffers($value); + break; + case 12: + $this->setSerializedConditions($value); + break; + case 13: + $this->setCreatedAt($value); + break; + case 14: $this->setUpdatedAt($value); break; } // switch() @@ -1073,13 +1649,23 @@ 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->setIsCumulative($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setIsRemovingPostage($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setSerializedConditions($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]); } /** @@ -1089,13 +1675,23 @@ 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::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 +1706,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 +1748,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 +1756,17 @@ 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->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 +1784,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 +1801,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 +1817,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 +1841,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 +1855,17 @@ 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->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 +1899,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 +1907,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/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 54% rename from core/lib/Thelia/Model/Map/CouponOrderTableMap.php rename to core/lib/Thelia/Model/Map/OrderCouponTableMap.php index d96183505..c77a046f0 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 = 15; /** * The number of lazy-loaded columns @@ -67,32 +67,82 @@ 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 = 15; /** * 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 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 +156,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', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'SerializedConditions', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'code', 'type', 'amount', 'title', 'shortDescription', 'description', 'expirationDate', '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::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', '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', '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, ) ); /** @@ -121,12 +171,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, 'IsCumulative' => 9, 'IsRemovingPostage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'SerializedConditions' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'code' => 2, 'type' => 3, 'amount' => 4, 'title' => 5, 'shortDescription' => 6, 'description' => 7, 'expirationDate' => 8, 'isCumulative' => 9, 'isRemovingPostage' => 10, 'isAvailableOnSpecialOffers' => 11, 'serializedConditions' => 12, 'createdAt' => 13, 'updatedAt' => 14, ), + 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::IS_CUMULATIVE => 9, OrderCouponTableMap::IS_REMOVING_POSTAGE => 10, OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, OrderCouponTableMap::SERIALIZED_CONDITIONS => 12, OrderCouponTableMap::CREATED_AT => 13, OrderCouponTableMap::UPDATED_AT => 14, ), + 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, 'IS_CUMULATIVE' => 9, 'IS_REMOVING_POSTAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'SERIALIZED_CONDITIONS' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, ), + 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, 'is_cumulative' => 9, 'is_removing_postage' => 10, 'is_available_on_special_offers' => 11, 'serialized_conditions' => 12, 'created_at' => 13, 'updated_at' => 14, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -139,15 +189,25 @@ 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('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 +289,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 +303,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 +340,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 +350,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 +371,35 @@ 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::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 . '.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 +414,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 +422,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 +442,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 +468,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 +490,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 +521,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/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php index 4575f5aac..7a29c7e6a 100755 --- a/core/lib/Thelia/Module/BaseModule.php +++ b/core/lib/Thelia/Module/BaseModule.php @@ -39,7 +39,6 @@ use Thelia\Model\Module; use Thelia\Model\ModuleImage; use Thelia\Model\ModuleQuery; - class BaseModule extends ContainerAware implements BaseModuleInterface { const CLASSIC_MODULE_TYPE = 1; @@ -115,16 +114,18 @@ class BaseModule extends ContainerAware implements BaseModuleInterface return $this->container; } - - public function hasRequest() { + public function hasRequest() + { return null !== $this->request; } - public function setRequest(Request $request) { + public function setRequest(Request $request) + { $this->request = $request; } - public function getRequest() { + public function getRequest() + { if ($this->hasRequest() === false) { throw new \RuntimeException("Sorry, the request is not available in this context"); } @@ -132,16 +133,18 @@ class BaseModule extends ContainerAware implements BaseModuleInterface return $this->request; } - - public function hasDispatcher() { + public function hasDispatcher() + { return null !== $this->dispatcher; } - public function setDispatcher(EventDispatcherInterface $dispatcher) { + public function setDispatcher(EventDispatcherInterface $dispatcher) + { $this->dispatcher = $dispatcher; } - public function getDispatcher() { + public function getDispatcher() + { if ($this->hasDispatcher() === false) { throw new \RuntimeException("Sorry, the dispatcher is not available in this context"); } @@ -149,7 +152,6 @@ class BaseModule extends ContainerAware implements BaseModuleInterface return $this->dispatcher; } - public function setTitle(Module $module, $titles) { if (is_array($titles)) { @@ -289,4 +291,4 @@ class BaseModule extends ContainerAware implements BaseModuleInterface { // Implement this method to do something useful. } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Module/BaseModuleInterface.php b/core/lib/Thelia/Module/BaseModuleInterface.php index 694a4082c..be7b30a12 100644 --- a/core/lib/Thelia/Module/BaseModuleInterface.php +++ b/core/lib/Thelia/Module/BaseModuleInterface.php @@ -24,8 +24,6 @@ namespace Thelia\Module; use Propel\Runtime\Connection\ConnectionInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpFoundation\Request; interface BaseModuleInterface { diff --git a/core/lib/Thelia/Tests/Action/ContentTest.php b/core/lib/Thelia/Tests/Action/ContentTest.php index 8db9c08dc..1eca7d2ea 100644 --- a/core/lib/Thelia/Tests/Action/ContentTest.php +++ b/core/lib/Thelia/Tests/Action/ContentTest.php @@ -47,7 +47,7 @@ class ContentTest extends TestCaseWithURLToolSetup public function getUpdateEvent(&$content) { - if(!$content instanceof \Thelia\Model\Content) { + if (!$content instanceof \Thelia\Model\Content) { $content = $this->getRandomContent(); } diff --git a/core/lib/Thelia/Tests/Action/FolderTest.php b/core/lib/Thelia/Tests/Action/FolderTest.php index 83eebc93c..cbf9a7c1e 100644 --- a/core/lib/Thelia/Tests/Action/FolderTest.php +++ b/core/lib/Thelia/Tests/Action/FolderTest.php @@ -45,7 +45,7 @@ class FolderTest extends TestCaseWithURLToolSetup public function getUpdateEvent(&$folder) { - if(!$folder instanceof \Thelia\Model\Folder) { + if (!$folder instanceof \Thelia\Model\Folder) { $folder = $this->getRandomFolder(); } @@ -65,7 +65,7 @@ class FolderTest extends TestCaseWithURLToolSetup public function getUpdateSeoEvent(&$folder) { - if(!$folder instanceof \Thelia\Model\Folder) { + if (!$folder instanceof \Thelia\Model\Folder) { $folder = $this->getRandomFolder(); } @@ -83,6 +83,7 @@ class FolderTest extends TestCaseWithURLToolSetup public function processUpdateSeoAction($event) { $contentAction = new Folder($this->getContainer()); + return $contentAction->updateSeo($event); } @@ -223,7 +224,7 @@ class FolderTest extends TestCaseWithURLToolSetup ->findOne(); if (null === $nextFolder) { - $this->fail('use fixtures before launching test, there is no folder in database'); + $this->fail('use fixtures before launching test, there is not enough folder in database'); } $folder = FolderQuery::create() diff --git a/core/lib/Thelia/Tests/Action/OrderTest.php b/core/lib/Thelia/Tests/Action/OrderTest.php index 64a92fd40..f2fd00a32 100644 --- a/core/lib/Thelia/Tests/Action/OrderTest.php +++ b/core/lib/Thelia/Tests/Action/OrderTest.php @@ -24,7 +24,6 @@ namespace Thelia\Tests\Action; use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Thelia\Core\Event\Order\OrderAddressEvent; use Thelia\Core\Event\Order\OrderEvent; diff --git a/core/lib/Thelia/Tests/Action/RewrittenUrlTestTrait.php b/core/lib/Thelia/Tests/Action/RewrittenUrlTestTrait.php index 8b5c30398..3d5e757d1 100644 --- a/core/lib/Thelia/Tests/Action/RewrittenUrlTestTrait.php +++ b/core/lib/Thelia/Tests/Action/RewrittenUrlTestTrait.php @@ -37,7 +37,7 @@ trait RewrittenUrlTestTrait ->filterByView(ConfigQuery::getObsoleteRewrittenUrlView(), Criteria::NOT_EQUAL) ->findOne(); - if(null === $existingUrl) { + if (null === $existingUrl) { $this->fail('use fixtures before launching test, there is not enough rewritten url'); } @@ -55,12 +55,12 @@ trait RewrittenUrlTestTrait /* get a brand new URL */ $exist = true; - while(true === $exist) { + while (true === $exist) { $newUrl = md5(rand(1, 999999)) . ".html"; try { new RewritingResolver($newUrl); - } catch(UrlRewritingException $e) { - if($e->getCode() === UrlRewritingException::URL_NOT_FOUND) { + } catch (UrlRewritingException $e) { + if ($e->getCode() === UrlRewritingException::URL_NOT_FOUND) { /* It's all good if URL is not found */ $exist = false; } else { @@ -91,9 +91,9 @@ trait RewrittenUrlTestTrait try { $aRandomProduct->setRewrittenUrl($aRandomProduct->getLocale(), $currentUrl); $failReassign = false; - } catch(\Exception $e) { + } catch (\Exception $e) { } $this->assertFalse($failReassign); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php b/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php index 664349915..84b5a832d 100644 --- a/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php +++ b/core/lib/Thelia/Tests/Condition/ConditionCollectionTest.php @@ -48,7 +48,6 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase { } - /** * Generate adapter stub * diff --git a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php index 3152700e6..a6181cddc 100644 --- a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php +++ b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php @@ -427,12 +427,10 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ->method('getContainer') ->will($this->returnValue($stubContainer)); - $conditions = new ConditionCollection(); $conditionFactory = new ConditionFactory($stubContainer); - $conditionNone = new MatchForEveryone($stubFacade); $expectedCollection = new ConditionCollection(); $expectedCollection[] = $conditionNone; diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneTest.php index fceb41f93..a370dbd9a 100644 --- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneTest.php +++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneTest.php @@ -193,6 +193,5 @@ class MatchForEveryoneTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected1, $actual1); $this->assertEquals($expected2, $actual2); - } } diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php index 9cb09fdd2..2d741eb92 100644 --- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php +++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php @@ -629,7 +629,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase ->method('getAvailableCurrencies') ->will($this->returnValue($currencies)); - $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( MatchForTotalAmount::INPUT1 => Operators::EQUAL, @@ -640,7 +639,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase MatchForTotalAmount::INPUT2 => 'UNK'); $condition1->setValidatorsFromForm($operators, $values); - $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') ->disableOriginalConstructor() ->getMock(); @@ -696,7 +694,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase ->method('getAvailableCurrencies') ->will($this->returnValue($currencies)); - $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( MatchForTotalAmount::INPUT1 => Operators::EQUAL, @@ -707,7 +704,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase MatchForTotalAmount::INPUT2 => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); - $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') ->disableOriginalConstructor() ->getMock(); @@ -763,7 +759,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase ->method('getAvailableCurrencies') ->will($this->returnValue($currencies)); - $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( MatchForTotalAmount::INPUT1 => Operators::EQUAL, @@ -774,7 +769,6 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase MatchForTotalAmount::INPUT2 => 'EUR'); $condition1->setValidatorsFromForm($operators, $values); - $stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container') ->disableOriginalConstructor() ->getMock(); diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php index c4bf8f3a6..ac371e71f 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/CategoryTest.php @@ -53,7 +53,7 @@ class CategoryTest extends BaseLoopTestor public function testSearchById() { $category = CategoryQuery::create()->findOne(); - if(null === $category) { + if (null === $category) { $category = new \Thelia\Model\Category(); $category->setParent(0); $category->setVisible(1); diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php index 3d5329a66..0009b90d8 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php @@ -53,7 +53,7 @@ class ContentTest extends BaseLoopTestor public function testSearchById() { $content = ContentQuery::create()->findOne(); - if(null === $content) { + if (null === $content) { $content = new \Thelia\Model\Content(); $content->setDefaultFolder(0); $content->setVisible(1); diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php index 87c078e16..0dd3b6b0d 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php @@ -53,7 +53,7 @@ class FolderTest extends BaseLoopTestor public function testSearchById() { $folder = FolderQuery::create()->findOne(); - if(null === $folder) { + if (null === $folder) { $folder = new \Thelia\Model\Folder(); $folder->setParent(0); $folder->setVisible(1); diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php index 66081caa5..b071bde9c 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ProductTest.php @@ -54,7 +54,7 @@ class ProductTest extends BaseLoopTestor public function testSearchById() { $product = ProductQuery::create()->orderById(Criteria::ASC)->findOne(); - if(null === $product) { + if (null === $product) { $product = new \Thelia\Model\Product(); $product->setDefaultCategory(0); $product->setVisible(1); diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php index 7e2da4b26..dd42a343e 100644 --- a/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/TaxRuleTest.php @@ -53,7 +53,7 @@ class TaxRuleTest extends BaseLoopTestor public function testSearchById() { $tr = TaxRuleQuery::create()->findOne(); - if(null === $tr) { + if (null === $tr) { $tr = new \Thelia\Model\TaxRule(); $tr->setTitle('foo'); $tr->save(); diff --git a/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php b/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php index c96fb8b0f..f4de7ee02 100644 --- a/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php +++ b/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php @@ -152,7 +152,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua $serializedConditions = $conditionFactory->serializeConditionCollection($conditions); $coupon1->setSerializedConditions($serializedConditions); - $coupon1->setMaxUsage(40); $coupon1->setIsCumulative(true); $coupon1->setIsRemovingPostage(false); @@ -186,7 +185,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua $couponManager = new RemoveXAmount($stubFacade); - $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, @@ -219,7 +217,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua ->method('unserializeConditionCollection') ->will($this->returnValue($conditions)); - $stubContainer->expects($this->any()) ->method('get') ->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory)); @@ -250,8 +247,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua $couponManager = new RemoveXAmount($stubFacade); - - $stubContainer->expects($this->any()) ->method('get') ->will($this->onConsecutiveCalls($stubFacade, $couponManager)); @@ -288,7 +283,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua $couponManager = new RemoveXAmount($stubFacade); - $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, @@ -321,7 +315,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua ->method('unserializeConditionCollection') ->will($this->returnValue($conditions)); - $stubContainer->expects($this->any()) ->method('get') ->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory)); @@ -353,7 +346,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua $couponManager = new RemoveXAmount($stubFacade); - $condition1 = new MatchForTotalAmount($stubFacade); $operators = array( MatchForTotalAmount::INPUT1 => Operators::SUPERIOR, @@ -384,7 +376,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua ->method('unserializeConditionCollection') ->will($this->returnValue($conditions)); - $stubContainer->expects($this->any()) ->method('get') ->will($this->onConsecutiveCalls($stubFacade, $couponManager, $stubConditionFactory)); diff --git a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php index 258fad35e..f19c4c04b 100644 --- a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php +++ b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php @@ -58,7 +58,6 @@ class CouponManagerTest extends \PHPUnit_Framework_TestCase { } - /** * Generate a valid Coupon model */ @@ -114,7 +113,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua $serializedConditions = $conditionFactory->serializeConditionCollection($conditions); $coupon1->setSerializedConditions($serializedConditions); - $coupon1->setMaxUsage(40); $coupon1->setIsCumulative(true); $coupon1->setIsRemovingPostage(true); @@ -154,7 +152,7 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua $couponFactory = new CouponFactory($stubContainer); $model1 = $this->generateCouponModel($stubFacade, $conditionFactory); - $model1->setAmount(21.00); + $model1->setCode('XMAS')->setIsRemovingPostage(false)->setAmount(21.00); $coupon1 = $couponFactory->buildCouponFromModel($model1); $model2 = $this->generateCouponModel($stubFacade, $conditionFactory); @@ -172,12 +170,16 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua ->will($this->returnValue(122.53)); $couponManager = new CouponManager($stubContainer); + $couponManager->addAvailableCoupon($coupon1); + $couponManager->addAvailableCoupon($coupon2); + $actual = $couponManager->getDiscount(); - $expected = 50.80; + $expected = 21 + 21.50; $this->assertEquals($expected, $actual); + $this->assertTrue($couponManager->isCouponRemovingPostage()); } /** @@ -303,8 +305,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua $conditionFactory = new ConditionFactory($stubContainer); - - $stubFacade->expects($this->any()) ->method('getCurrentCoupons') ->will($this->returnValue(array())); @@ -330,7 +330,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua $coupon1 = $couponFactory->buildCouponFromModel($model1); $coupon2 = clone $coupon1; - $couponManager = new CouponManager($stubContainer); $couponManager->addAvailableCoupon($coupon1); $couponManager->addAvailableCoupon($coupon2); @@ -383,7 +382,6 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua ->method('get') ->will($this->onConsecutiveCalls($stubFacade)); - $couponManager = new CouponManager($stubContainer); $couponManager->addAvailableCondition($condition1); $couponManager->addAvailableCondition($condition2); @@ -440,10 +438,8 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua ->method('get') ->will($this->onConsecutiveCalls($stubFacade)); - $couponManager = new CouponManager($stubContainer); - $stubModel = $this->getMockBuilder('\Thelia\Model\Coupon') ->disableOriginalConstructor() ->getMock(); @@ -507,10 +503,8 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua ->method('get') ->will($this->onConsecutiveCalls($stubFacade)); - $couponManager = new CouponManager($stubContainer); - $stubModel = $this->getMockBuilder('\Thelia\Model\Coupon') ->disableOriginalConstructor() ->getMock(); diff --git a/core/lib/Thelia/Tests/Model/Message.php b/core/lib/Thelia/Tests/Model/Message.php index 1b7cd5716..661ec68e0 100644 --- a/core/lib/Thelia/Tests/Model/Message.php +++ b/core/lib/Thelia/Tests/Model/Message.php @@ -23,7 +23,6 @@ namespace Thelia\Tests\Model; - use Thelia\Model\ConfigQuery; use Symfony\Component\Filesystem\Filesystem; use Thelia\Model\Message; @@ -324,8 +323,8 @@ class MessageTest extends \PHPUnit_Framework_TestCase $this->assertEquals("TEXT Layout 6: TEXT