Merge branch 'cart'
Conflicts: core/lib/Thelia/Config/Resources/config.xml core/lib/Thelia/Core/Event/TheliaEvents.php
This commit is contained in:
23
core/lib/Thelia/Core/Template/BaseParam/Secure.php → core/lib/Thelia/Action/BaseAction.php
Executable file → Normal file
23
core/lib/Thelia/Core/Template/BaseParam/Secure.php → core/lib/Thelia/Action/BaseAction.php
Executable file → Normal file
@@ -20,20 +20,19 @@
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Action;
|
||||
|
||||
namespace Thelia\Core\Template\BaseParam;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
use Thelia\Tpex\BaseParam\BaseParam;
|
||||
use Thelia\Tools\Redirect;
|
||||
|
||||
class Secure extends BaseParam
|
||||
abstract class BaseAction
|
||||
{
|
||||
public function exec()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
if (!$request->getSession()->get('connected') && $this->baseParamValue) {
|
||||
Redirect::unauthorize();
|
||||
}
|
||||
public function redirect($url, $status = 302)
|
||||
{
|
||||
$response = new RedirectResponse($url, $status);
|
||||
|
||||
$response->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,19 +23,47 @@
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Core\Event\CartEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpFoundation\Session\Session;
|
||||
use Thelia\Form\CartAdd;
|
||||
use Thelia\Model\ProductPrice;
|
||||
use Thelia\Model\ProductPriceQuery;
|
||||
use Thelia\Model\CartItem;
|
||||
use Thelia\Model\CartItemQuery;
|
||||
use Thelia\Model\CartQuery;
|
||||
use Thelia\Model\Cart as CartModel;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
|
||||
class Cart implements EventSubscriberInterface
|
||||
/**
|
||||
*
|
||||
* Class Cart where all actions are manage like adding, modifying or delete items.
|
||||
*
|
||||
* Class Cart
|
||||
* @package Thelia\Action
|
||||
*/
|
||||
class Cart extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
|
||||
*/
|
||||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
|
||||
*/
|
||||
public function __construct(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* add an article to cart
|
||||
@@ -46,6 +74,88 @@ class Cart implements EventSubscriberInterface
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
|
||||
$cartAdd = $this->getAddCartForm($request);
|
||||
$form = $cartAdd->getForm();
|
||||
|
||||
$form->bind($request);
|
||||
|
||||
if($form->isValid()) {
|
||||
try {
|
||||
$cart = $this->getCart($request);
|
||||
$newness = $form->get("newness")->getData();
|
||||
$append = $form->get("append")->getData();
|
||||
$quantity = $form->get("quantity")->getData();
|
||||
|
||||
$productSaleElementsId = $form->get("product_sale_elements_id")->getData();
|
||||
$productId = $form->get("product")->getData();
|
||||
|
||||
$cartItem = $this->findItem($cart->getId(), $productId, $productSaleElementsId);
|
||||
|
||||
if($cartItem === null || $newness)
|
||||
{
|
||||
$productPrice = ProductPriceQuery::create()
|
||||
->filterByProductSaleElementsId($productSaleElementsId)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
$this->addItem($cart, $productId, $productSaleElementsId, $quantity, $productPrice);
|
||||
}
|
||||
|
||||
if($append && $cartItem !== null) {
|
||||
$this->updateQuantity($cartItem, $quantity);
|
||||
}
|
||||
|
||||
|
||||
$this->redirect($cartAdd->getSuccessUrl($request->getUriAddingParameters(array("addCart" => 1))));
|
||||
} catch (PropelException $e) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sptinf("error on adding item to cart with message : %s", $e->getMessage()));
|
||||
$message = "Impossible to add this article to your cart, please try again";
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$message = "Missing or invalid data";
|
||||
}
|
||||
|
||||
$cartAdd->setError(true);
|
||||
$cartAdd->setErrorMessage($message);
|
||||
|
||||
$event->setErrorForm($cartAdd);
|
||||
}
|
||||
|
||||
protected function updateQuantity(CartItem $cartItem, $quantity)
|
||||
{
|
||||
$cartItem->setDisptacher($this->dispatcher);
|
||||
$cartItem->addQuantity($quantity)
|
||||
->save();
|
||||
}
|
||||
|
||||
protected function addItem(\Thelia\Model\Cart $cart, $productId, $productSaleElementsId, $quantity, ProductPrice $productPrice)
|
||||
{
|
||||
$cartItem = new CartItem();
|
||||
$cartItem->setDisptacher($this->dispatcher);
|
||||
$cartItem
|
||||
->setCart($cart)
|
||||
->setProductId($productId)
|
||||
->setProductSaleElementsId($productSaleElementsId)
|
||||
->setQuantity($quantity)
|
||||
->setPrice($productPrice->getPrice())
|
||||
->setPromoPrice($productPrice->getPromoPrice())
|
||||
->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30))
|
||||
->save();
|
||||
}
|
||||
|
||||
protected function findItem($cartId, $productId, $productSaleElementsId)
|
||||
{
|
||||
return CartItemQuery::create()
|
||||
->filterByCartId($cartId)
|
||||
->filterByProductId($productId)
|
||||
->filterByProductSaleElementsId($productSaleElementsId)
|
||||
->findOne();
|
||||
}
|
||||
|
||||
private function getAddCartForm(Request $request)
|
||||
{
|
||||
if ($request->isMethod("post")) {
|
||||
$cartAdd = new CartAdd($request);
|
||||
} else {
|
||||
@@ -59,15 +169,7 @@ class Cart implements EventSubscriberInterface
|
||||
);
|
||||
}
|
||||
|
||||
$form = $cartAdd->getForm();
|
||||
|
||||
$form->bind($request);
|
||||
|
||||
if($form->isValid()) {
|
||||
|
||||
} else {
|
||||
var_dump($form->createView());
|
||||
}
|
||||
return $cartAdd;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,18 +181,38 @@ class Cart implements EventSubscriberInterface
|
||||
*/
|
||||
public function deleteArticle(ActionEvent $event)
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
|
||||
if (null !== $cartItem = $request->get('cartItem')) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Modify article's quantity
|
||||
*
|
||||
* don't use Form here just test the Request.
|
||||
*
|
||||
* @param \Thelia\Core\Event\ActionEvent $event
|
||||
*/
|
||||
public function modifyArticle(ActionEvent $event)
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
|
||||
$message = "";
|
||||
|
||||
if(null !== $cartItemId = $request->get("cartItem") && null !== $quantity = $request->get("quantity")) {
|
||||
$cart = $this->getCart($request);
|
||||
$cartItem = CartItemQuery::create()
|
||||
->filterByCartId($cart->getId())
|
||||
->filterById($cartItemId)
|
||||
->findOne();
|
||||
|
||||
if($cartItem) {
|
||||
$this->updateQuantity($cartItem, $quantity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,6 +244,13 @@ class Cart implements EventSubscriberInterface
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* search if cart already exists in session. If not try to create a new one or duplicate an old one.
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @return \Thelia\Model\Cart
|
||||
*/
|
||||
public function getCart(Request $request)
|
||||
{
|
||||
|
||||
@@ -163,8 +292,8 @@ class Cart implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Session $session
|
||||
* @return CartModel
|
||||
* @param \Thelia\Core\HttpFoundation\Session\Session $session
|
||||
* @return \Thelia\Model\Cart
|
||||
*/
|
||||
protected function createCart(Session $session)
|
||||
{
|
||||
@@ -184,24 +313,34 @@ class Cart implements EventSubscriberInterface
|
||||
|
||||
|
||||
/**
|
||||
* @param CartModel $cart
|
||||
* @param Session $session
|
||||
* @param Customer $customer
|
||||
* @return CartModel
|
||||
* try to duplicate existing Cart. Customer is here to determine if this cart belong to him.
|
||||
*
|
||||
* @param \Thelia\Model\Cart $cart
|
||||
* @param \Thelia\Core\HttpFoundation\Session\Session $session
|
||||
* @param \Thelia\Model\Customer $customer
|
||||
* @return \Thelia\Model\Cart
|
||||
*/
|
||||
protected function duplicateCart(CartModel $cart, Session $session, Customer $customer = null)
|
||||
{
|
||||
$newCart = $cart->duplicate($this->generateCookie(), $customer);
|
||||
$session->setCart($newCart->getId());
|
||||
|
||||
return $newCart;
|
||||
$cartEvent = new CartEvent($newCart);
|
||||
$this->dispatcher->dispatch(TheliaEvents::CART_DUPLICATE, $cartEvent);
|
||||
|
||||
return $cartEvent->cart;
|
||||
}
|
||||
|
||||
protected function generateCookie()
|
||||
{
|
||||
$id = uniqid('', true);
|
||||
setcookie("thelia_cart", $id, time()+(60*60*24*365));
|
||||
$id = null;
|
||||
if (ConfigQuery::read("cart.session_only", 0) == 0) {
|
||||
$id = uniqid('', true);
|
||||
setcookie("thelia_cart", $id, time()+ConfigQuery::read("cart.cookie_lifetime", 60*60*24*365));
|
||||
|
||||
}
|
||||
|
||||
return $id;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,14 +37,13 @@ use Thelia\Form\CustomerLogin;
|
||||
use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\Redirect;
|
||||
use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||
use Thelia\Core\Security\Exception\UsernameNotFoundException;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
|
||||
|
||||
class Customer implements EventSubscriberInterface
|
||||
class Customer extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @var Thelia\Core\Security\SecurityContext
|
||||
@@ -291,7 +290,7 @@ class Customer implements EventSubscriberInterface
|
||||
if ($sendLoginEvent) $event->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_LOGIN, $event);
|
||||
|
||||
// Redirect to the success URL
|
||||
Redirect::exec($form->getSuccessUrl());
|
||||
$this->redirect($form->getSuccessUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
<service id="thelia.action.cart" class="Thelia\Action\Cart">
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
|
||||
<argument type="service" id="event_dispatcher"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.customer" class="Thelia\Action\Customer" scope="request">
|
||||
|
||||
@@ -33,10 +33,14 @@
|
||||
|
||||
<form name="thelia.customer.login" class="Thelia\Form\CustomerLogin"/>
|
||||
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
|
||||
<<<<<<< HEAD
|
||||
|
||||
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
|
||||
<form name="thelia.admin.category.deletion" class="Thelia\Form\CategoryDeletionForm"/>
|
||||
|
||||
=======
|
||||
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
|
||||
>>>>>>> cart
|
||||
</forms>
|
||||
|
||||
|
||||
|
||||
@@ -29,30 +29,13 @@ use Thelia\Model\Cart;
|
||||
|
||||
class CartEvent extends InternalEvent {
|
||||
|
||||
protected $cart;
|
||||
protected $modified;
|
||||
public $cart;
|
||||
|
||||
public function __construct(Cart $cart)
|
||||
{
|
||||
$this->cart = $cart;
|
||||
$this->modified = false;
|
||||
}
|
||||
|
||||
public function setCart(Cart $cart)
|
||||
{
|
||||
$this->cart = $cart;
|
||||
$this->modified = true;
|
||||
}
|
||||
|
||||
public function getCart()
|
||||
{
|
||||
return $this->cart;
|
||||
}
|
||||
|
||||
public function isModified()
|
||||
{
|
||||
return $this->modified;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
42
core/lib/Thelia/Core/Event/CartItemEvent.php
Normal file
42
core/lib/Thelia/Core/Event/CartItemEvent.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
|
||||
use Thelia\Model\CartItem;
|
||||
|
||||
class CartItemEvent extends InternalEvent {
|
||||
|
||||
protected $cartItem;
|
||||
|
||||
public function __construct(CartItem $cartItem)
|
||||
{
|
||||
$this->cartItem = $cartItem;
|
||||
}
|
||||
|
||||
public function getCartItem()
|
||||
{
|
||||
return $this->cartItem;
|
||||
}
|
||||
}
|
||||
@@ -109,4 +109,19 @@ final class TheliaEvents
|
||||
*/
|
||||
const AFTER_DELETECATEGORY = "action.after_deletecategory";
|
||||
|
||||
/**
|
||||
* sent when a new existing cat id duplicated. This append when current customer is different from current cart
|
||||
*/
|
||||
const CART_DUPLICATE = "cart.duplicate";
|
||||
|
||||
/**
|
||||
* sent when a new item is added to current cart
|
||||
*/
|
||||
const CART_ADDITEM = "cart.addItem";
|
||||
|
||||
/**
|
||||
* sent when a cart item is modify
|
||||
*/
|
||||
const CART_MODIFYITEM = "cart.modifyItem";
|
||||
|
||||
}
|
||||
@@ -1,12 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* User: manu
|
||||
* Date: 08/07/13
|
||||
* Time: 11:41
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Core\HttpFoundation;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request as BaseRequest;
|
||||
@@ -19,4 +32,20 @@ class Request extends BaseRequest{
|
||||
return $this->get("product_id");
|
||||
}
|
||||
|
||||
public function getUriAddingParameters(array $parameters = null)
|
||||
{
|
||||
$uri = $this->getUri();
|
||||
|
||||
$additionalQs = '';
|
||||
|
||||
foreach ($parameters as $key => $value) {
|
||||
$additionalQs .= sprintf("&%s=%s", $key, $value);
|
||||
}
|
||||
|
||||
if ('' == $this->getQueryString()) {
|
||||
$additionalQs = '?'. ltrim($additionalQs, '&');
|
||||
}
|
||||
return $uri . $additionalQs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -169,7 +169,8 @@ class Category extends BaseLoop
|
||||
|
||||
foreach ($categories as $category) {
|
||||
|
||||
if ($notEmpty && $category->countAllProducts() == 0) continue;
|
||||
if ($this->getNotEmpty() && $category->countAllProducts() == 0) continue;
|
||||
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
|
||||
|
||||
@@ -57,28 +57,28 @@ class CartAdd extends BaseForm
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("product", "hidden", array(
|
||||
->add("product", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array($this, "checkProduct")
|
||||
))
|
||||
new Constraints\Callback(array("methods" => array(
|
||||
array($this, "checkProduct")
|
||||
)))
|
||||
)
|
||||
))
|
||||
->add("product_sale_elements_id", "hidden", array(
|
||||
->add("product_sale_elements_id", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array($this, "checkStockAvailability")
|
||||
))
|
||||
new Constraints\Callback(array("methods" => array(
|
||||
array($this, "checkStockAvailability")
|
||||
)))
|
||||
)
|
||||
|
||||
))
|
||||
->add("quantity", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
"methods" => array($this, "checkStock")
|
||||
)),
|
||||
new Constraints\Callback(array("methods" => array(
|
||||
array($this, "checkStock")
|
||||
))),
|
||||
new Constraints\GreaterThanOrEqual(array(
|
||||
"value" => 0
|
||||
))
|
||||
@@ -89,7 +89,7 @@ class CartAdd extends BaseForm
|
||||
;
|
||||
}
|
||||
|
||||
protected function checkProduct($value, ExecutionContextInterface $context)
|
||||
public function checkProduct($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$product = ProductQuery::create()->findPk($value);
|
||||
|
||||
@@ -98,7 +98,7 @@ class CartAdd extends BaseForm
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkStockAvailability($value, ExecutionContextInterface $context)
|
||||
public function checkStockAvailability($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if ($value) {
|
||||
$data = $context->getRoot()->getData();
|
||||
@@ -114,7 +114,7 @@ class CartAdd extends BaseForm
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkStock($value, ExecutionContextInterface $context)
|
||||
public function checkStock($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$data = $context->getRoot()->getData();
|
||||
|
||||
|
||||
@@ -91,6 +91,24 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
*/
|
||||
protected $product_sale_elements_id;
|
||||
|
||||
/**
|
||||
* The value for the price field.
|
||||
* @var double
|
||||
*/
|
||||
protected $price;
|
||||
|
||||
/**
|
||||
* The value for the promo_price field.
|
||||
* @var double
|
||||
*/
|
||||
protected $promo_price;
|
||||
|
||||
/**
|
||||
* The value for the price_end_of_life field.
|
||||
* @var string
|
||||
*/
|
||||
protected $price_end_of_life;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -448,6 +466,48 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
return $this->product_sale_elements_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [price] column value.
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [promo_price] column value.
|
||||
*
|
||||
* @return double
|
||||
*/
|
||||
public function getPromoPrice()
|
||||
{
|
||||
|
||||
return $this->promo_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [price_end_of_life] 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 getPriceEndOfLife($format = NULL)
|
||||
{
|
||||
if ($format === null) {
|
||||
return $this->price_end_of_life;
|
||||
} else {
|
||||
return $this->price_end_of_life !== null ? $this->price_end_of_life->format($format) : null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -605,6 +665,69 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setProductSaleElementsId()
|
||||
|
||||
/**
|
||||
* Set the value of [price] column.
|
||||
*
|
||||
* @param double $v new value
|
||||
* @return \Thelia\Model\CartItem The current object (for fluent API support)
|
||||
*/
|
||||
public function setPrice($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (double) $v;
|
||||
}
|
||||
|
||||
if ($this->price !== $v) {
|
||||
$this->price = $v;
|
||||
$this->modifiedColumns[] = CartItemTableMap::PRICE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setPrice()
|
||||
|
||||
/**
|
||||
* Set the value of [promo_price] column.
|
||||
*
|
||||
* @param double $v new value
|
||||
* @return \Thelia\Model\CartItem The current object (for fluent API support)
|
||||
*/
|
||||
public function setPromoPrice($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (double) $v;
|
||||
}
|
||||
|
||||
if ($this->promo_price !== $v) {
|
||||
$this->promo_price = $v;
|
||||
$this->modifiedColumns[] = CartItemTableMap::PROMO_PRICE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setPromoPrice()
|
||||
|
||||
/**
|
||||
* Sets the value of [price_end_of_life] 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\CartItem The current object (for fluent API support)
|
||||
*/
|
||||
public function setPriceEndOfLife($v)
|
||||
{
|
||||
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
|
||||
if ($this->price_end_of_life !== null || $dt !== null) {
|
||||
if ($dt !== $this->price_end_of_life) {
|
||||
$this->price_end_of_life = $dt;
|
||||
$this->modifiedColumns[] = CartItemTableMap::PRICE_END_OF_LIFE;
|
||||
}
|
||||
} // if either are not null
|
||||
|
||||
|
||||
return $this;
|
||||
} // setPriceEndOfLife()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -703,13 +826,25 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CartItemTableMap::translateFieldName('ProductSaleElementsId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->product_sale_elements_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CartItemTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CartItemTableMap::translateFieldName('Price', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->price = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CartItemTableMap::translateFieldName('PromoPrice', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->promo_price = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CartItemTableMap::translateFieldName('PriceEndOfLife', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->price_end_of_life = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $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 ? 6 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -722,7 +857,7 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 7; // 7 = CartItemTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 10; // 10 = CartItemTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\CartItem object", 0, $e);
|
||||
@@ -995,6 +1130,15 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PRODUCT_SALE_ELEMENTS_ID';
|
||||
}
|
||||
if ($this->isColumnModified(CartItemTableMap::PRICE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PRICE';
|
||||
}
|
||||
if ($this->isColumnModified(CartItemTableMap::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::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -1027,6 +1171,15 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
case 'PRODUCT_SALE_ELEMENTS_ID':
|
||||
$stmt->bindValue($identifier, $this->product_sale_elements_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'PRICE':
|
||||
$stmt->bindValue($identifier, $this->price, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'PROMO_PRICE':
|
||||
$stmt->bindValue($identifier, $this->promo_price, PDO::PARAM_STR);
|
||||
break;
|
||||
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 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1111,9 +1264,18 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
return $this->getProductSaleElementsId();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getPrice();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getPromoPrice();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getPriceEndOfLife();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1150,8 +1312,11 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$keys[2] => $this->getProductId(),
|
||||
$keys[3] => $this->getQuantity(),
|
||||
$keys[4] => $this->getProductSaleElementsId(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
$keys[5] => $this->getPrice(),
|
||||
$keys[6] => $this->getPromoPrice(),
|
||||
$keys[7] => $this->getPriceEndOfLife(),
|
||||
$keys[8] => $this->getCreatedAt(),
|
||||
$keys[9] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1219,9 +1384,18 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$this->setProductSaleElementsId($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setPrice($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setPromoPrice($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setPriceEndOfLife($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1253,8 +1427,11 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[2], $arr)) $this->setProductId($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setQuantity($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setProductSaleElementsId($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
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->setCreatedAt($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setUpdatedAt($arr[$keys[9]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1271,6 +1448,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CartItemTableMap::PRODUCT_ID)) $criteria->add(CartItemTableMap::PRODUCT_ID, $this->product_id);
|
||||
if ($this->isColumnModified(CartItemTableMap::QUANTITY)) $criteria->add(CartItemTableMap::QUANTITY, $this->quantity);
|
||||
if ($this->isColumnModified(CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID)) $criteria->add(CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, $this->product_sale_elements_id);
|
||||
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::CREATED_AT)) $criteria->add(CartItemTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CartItemTableMap::UPDATED_AT)) $criteria->add(CartItemTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1340,6 +1520,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$copyObj->setProductId($this->getProductId());
|
||||
$copyObj->setQuantity($this->getQuantity());
|
||||
$copyObj->setProductSaleElementsId($this->getProductSaleElementsId());
|
||||
$copyObj->setPrice($this->getPrice());
|
||||
$copyObj->setPromoPrice($this->getPromoPrice());
|
||||
$copyObj->setPriceEndOfLife($this->getPriceEndOfLife());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
if ($makeNew) {
|
||||
@@ -1533,6 +1716,9 @@ abstract class CartItem implements ActiveRecordInterface
|
||||
$this->product_id = null;
|
||||
$this->quantity = null;
|
||||
$this->product_sale_elements_id = null;
|
||||
$this->price = null;
|
||||
$this->promo_price = null;
|
||||
$this->price_end_of_life = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
@@ -26,6 +26,9 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @method ChildCartItemQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
|
||||
* @method ChildCartItemQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column
|
||||
* @method ChildCartItemQuery orderByProductSaleElementsId($order = Criteria::ASC) Order by the product_sale_elements_id column
|
||||
* @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 orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCartItemQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -34,6 +37,9 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @method ChildCartItemQuery groupByProductId() Group by the product_id column
|
||||
* @method ChildCartItemQuery groupByQuantity() Group by the quantity column
|
||||
* @method ChildCartItemQuery groupByProductSaleElementsId() Group by the product_sale_elements_id column
|
||||
* @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 groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCartItemQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -61,6 +67,9 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @method ChildCartItem findOneByProductId(int $product_id) Return the first ChildCartItem filtered by the product_id column
|
||||
* @method ChildCartItem findOneByQuantity(double $quantity) Return the first ChildCartItem filtered by the quantity column
|
||||
* @method ChildCartItem findOneByProductSaleElementsId(int $product_sale_elements_id) Return the first ChildCartItem filtered by the product_sale_elements_id column
|
||||
* @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 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
|
||||
*
|
||||
@@ -69,6 +78,9 @@ use Thelia\Model\Map\CartItemTableMap;
|
||||
* @method array findByProductId(int $product_id) Return ChildCartItem objects filtered by the product_id column
|
||||
* @method array findByQuantity(double $quantity) Return ChildCartItem objects filtered by the quantity column
|
||||
* @method array findByProductSaleElementsId(int $product_sale_elements_id) Return ChildCartItem objects filtered by the product_sale_elements_id column
|
||||
* @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 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
|
||||
*
|
||||
@@ -159,7 +171,7 @@ abstract class CartItemQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CART_ID, PRODUCT_ID, QUANTITY, PRODUCT_SALE_ELEMENTS_ID, 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, CREATED_AT, UPDATED_AT FROM cart_item WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -459,6 +471,131 @@ abstract class CartItemQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, $productSaleElementsId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the price column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPrice(1234); // WHERE price = 1234
|
||||
* $query->filterByPrice(array(12, 34)); // WHERE price IN (12, 34)
|
||||
* $query->filterByPrice(array('min' => 12)); // WHERE price > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $price 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 filterByPrice($price = null, $comparison = null)
|
||||
{
|
||||
if (is_array($price)) {
|
||||
$useMinMax = false;
|
||||
if (isset($price['min'])) {
|
||||
$this->addUsingAlias(CartItemTableMap::PRICE, $price['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($price['max'])) {
|
||||
$this->addUsingAlias(CartItemTableMap::PRICE, $price['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CartItemTableMap::PRICE, $price, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the promo_price column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPromoPrice(1234); // WHERE promo_price = 1234
|
||||
* $query->filterByPromoPrice(array(12, 34)); // WHERE promo_price IN (12, 34)
|
||||
* $query->filterByPromoPrice(array('min' => 12)); // WHERE promo_price > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $promoPrice 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 filterByPromoPrice($promoPrice = null, $comparison = null)
|
||||
{
|
||||
if (is_array($promoPrice)) {
|
||||
$useMinMax = false;
|
||||
if (isset($promoPrice['min'])) {
|
||||
$this->addUsingAlias(CartItemTableMap::PROMO_PRICE, $promoPrice['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($promoPrice['max'])) {
|
||||
$this->addUsingAlias(CartItemTableMap::PROMO_PRICE, $promoPrice['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CartItemTableMap::PROMO_PRICE, $promoPrice, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the price_end_of_life column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPriceEndOfLife('2011-03-14'); // WHERE price_end_of_life = '2011-03-14'
|
||||
* $query->filterByPriceEndOfLife('now'); // WHERE price_end_of_life = '2011-03-14'
|
||||
* $query->filterByPriceEndOfLife(array('max' => 'yesterday')); // WHERE price_end_of_life > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $priceEndOfLife 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 ChildCartItemQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPriceEndOfLife($priceEndOfLife = null, $comparison = null)
|
||||
{
|
||||
if (is_array($priceEndOfLife)) {
|
||||
$useMinMax = false;
|
||||
if (isset($priceEndOfLife['min'])) {
|
||||
$this->addUsingAlias(CartItemTableMap::PRICE_END_OF_LIFE, $priceEndOfLife['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($priceEndOfLife['max'])) {
|
||||
$this->addUsingAlias(CartItemTableMap::PRICE_END_OF_LIFE, $priceEndOfLife['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CartItemTableMap::PRICE_END_OF_LIFE, $priceEndOfLife, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -82,12 +82,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* The value for the link field.
|
||||
* @var string
|
||||
*/
|
||||
protected $link;
|
||||
|
||||
/**
|
||||
* The value for the visible field.
|
||||
* @var int
|
||||
@@ -533,17 +527,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [link] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [visible] column value.
|
||||
*
|
||||
@@ -690,27 +673,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setParent()
|
||||
|
||||
/**
|
||||
* Set the value of [link] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Folder The current object (for fluent API support)
|
||||
*/
|
||||
public function setLink($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->link !== $v) {
|
||||
$this->link = $v;
|
||||
$this->modifiedColumns[] = FolderTableMap::LINK;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setLink()
|
||||
|
||||
/**
|
||||
* Set the value of [visible] column.
|
||||
*
|
||||
@@ -905,37 +867,34 @@ abstract class Folder implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : FolderTableMap::translateFieldName('Parent', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->parent = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FolderTableMap::translateFieldName('Link', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->link = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FolderTableMap::translateFieldName('Visible', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FolderTableMap::translateFieldName('Visible', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->visible = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FolderTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FolderTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->position = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : FolderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FolderTableMap::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 ? 6 + $startcol : FolderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : FolderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : FolderTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : FolderTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : FolderTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : FolderTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : FolderTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : FolderTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version_created_by = (null !== $col) ? (string) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
@@ -945,7 +904,7 @@ abstract class Folder implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 10; // 10 = FolderTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 9; // 9 = FolderTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Folder object", 0, $e);
|
||||
@@ -1325,9 +1284,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(FolderTableMap::PARENT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PARENT';
|
||||
}
|
||||
if ($this->isColumnModified(FolderTableMap::LINK)) {
|
||||
$modifiedColumns[':p' . $index++] = 'LINK';
|
||||
}
|
||||
if ($this->isColumnModified(FolderTableMap::VISIBLE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'VISIBLE';
|
||||
}
|
||||
@@ -1366,9 +1322,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
case 'PARENT':
|
||||
$stmt->bindValue($identifier, $this->parent, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'LINK':
|
||||
$stmt->bindValue($identifier, $this->link, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'VISIBLE':
|
||||
$stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT);
|
||||
break;
|
||||
@@ -1459,27 +1412,24 @@ abstract class Folder implements ActiveRecordInterface
|
||||
return $this->getParent();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getLink();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getVisible();
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
return $this->getPosition();
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
case 7:
|
||||
case 6:
|
||||
return $this->getVersion();
|
||||
break;
|
||||
case 8:
|
||||
case 7:
|
||||
return $this->getVersionCreatedAt();
|
||||
break;
|
||||
case 9:
|
||||
case 8:
|
||||
return $this->getVersionCreatedBy();
|
||||
break;
|
||||
default:
|
||||
@@ -1513,14 +1463,13 @@ abstract class Folder implements ActiveRecordInterface
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getParent(),
|
||||
$keys[2] => $this->getLink(),
|
||||
$keys[3] => $this->getVisible(),
|
||||
$keys[4] => $this->getPosition(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
$keys[7] => $this->getVersion(),
|
||||
$keys[8] => $this->getVersionCreatedAt(),
|
||||
$keys[9] => $this->getVersionCreatedBy(),
|
||||
$keys[2] => $this->getVisible(),
|
||||
$keys[3] => $this->getPosition(),
|
||||
$keys[4] => $this->getCreatedAt(),
|
||||
$keys[5] => $this->getUpdatedAt(),
|
||||
$keys[6] => $this->getVersion(),
|
||||
$keys[7] => $this->getVersionCreatedAt(),
|
||||
$keys[8] => $this->getVersionCreatedBy(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1588,27 +1537,24 @@ abstract class Folder implements ActiveRecordInterface
|
||||
$this->setParent($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setLink($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setVisible($value);
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
$this->setPosition($value);
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
case 7:
|
||||
case 6:
|
||||
$this->setVersion($value);
|
||||
break;
|
||||
case 8:
|
||||
case 7:
|
||||
$this->setVersionCreatedAt($value);
|
||||
break;
|
||||
case 9:
|
||||
case 8:
|
||||
$this->setVersionCreatedBy($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1637,14 +1583,13 @@ abstract class Folder implements ActiveRecordInterface
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setParent($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setLink($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setVisible($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($arr[$keys[8]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1658,7 +1603,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
|
||||
if ($this->isColumnModified(FolderTableMap::ID)) $criteria->add(FolderTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(FolderTableMap::PARENT)) $criteria->add(FolderTableMap::PARENT, $this->parent);
|
||||
if ($this->isColumnModified(FolderTableMap::LINK)) $criteria->add(FolderTableMap::LINK, $this->link);
|
||||
if ($this->isColumnModified(FolderTableMap::VISIBLE)) $criteria->add(FolderTableMap::VISIBLE, $this->visible);
|
||||
if ($this->isColumnModified(FolderTableMap::POSITION)) $criteria->add(FolderTableMap::POSITION, $this->position);
|
||||
if ($this->isColumnModified(FolderTableMap::CREATED_AT)) $criteria->add(FolderTableMap::CREATED_AT, $this->created_at);
|
||||
@@ -1730,7 +1674,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||
{
|
||||
$copyObj->setParent($this->getParent());
|
||||
$copyObj->setLink($this->getLink());
|
||||
$copyObj->setVisible($this->getVisible());
|
||||
$copyObj->setPosition($this->getPosition());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
@@ -3602,7 +3545,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
{
|
||||
$this->id = null;
|
||||
$this->parent = null;
|
||||
$this->link = null;
|
||||
$this->visible = null;
|
||||
$this->position = null;
|
||||
$this->created_at = null;
|
||||
@@ -3970,7 +3912,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
$version = new ChildFolderVersion();
|
||||
$version->setId($this->getId());
|
||||
$version->setParent($this->getParent());
|
||||
$version->setLink($this->getLink());
|
||||
$version->setVisible($this->getVisible());
|
||||
$version->setPosition($this->getPosition());
|
||||
$version->setCreatedAt($this->getCreatedAt());
|
||||
@@ -4017,7 +3958,6 @@ abstract class Folder implements ActiveRecordInterface
|
||||
$loadedObjects['ChildFolder'][$version->getId()][$version->getVersion()] = $this;
|
||||
$this->setId($version->getId());
|
||||
$this->setParent($version->getParent());
|
||||
$this->setLink($version->getLink());
|
||||
$this->setVisible($version->getVisible());
|
||||
$this->setPosition($version->getPosition());
|
||||
$this->setCreatedAt($version->getCreatedAt());
|
||||
|
||||
@@ -24,7 +24,6 @@ use Thelia\Model\Map\FolderTableMap;
|
||||
*
|
||||
* @method ChildFolderQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildFolderQuery orderByParent($order = Criteria::ASC) Order by the parent column
|
||||
* @method ChildFolderQuery orderByLink($order = Criteria::ASC) Order by the link column
|
||||
* @method ChildFolderQuery orderByVisible($order = Criteria::ASC) Order by the visible column
|
||||
* @method ChildFolderQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||
* @method ChildFolderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
@@ -35,7 +34,6 @@ use Thelia\Model\Map\FolderTableMap;
|
||||
*
|
||||
* @method ChildFolderQuery groupById() Group by the id column
|
||||
* @method ChildFolderQuery groupByParent() Group by the parent column
|
||||
* @method ChildFolderQuery groupByLink() Group by the link column
|
||||
* @method ChildFolderQuery groupByVisible() Group by the visible column
|
||||
* @method ChildFolderQuery groupByPosition() Group by the position column
|
||||
* @method ChildFolderQuery groupByCreatedAt() Group by the created_at column
|
||||
@@ -77,7 +75,6 @@ use Thelia\Model\Map\FolderTableMap;
|
||||
*
|
||||
* @method ChildFolder findOneById(int $id) Return the first ChildFolder filtered by the id column
|
||||
* @method ChildFolder findOneByParent(int $parent) Return the first ChildFolder filtered by the parent column
|
||||
* @method ChildFolder findOneByLink(string $link) Return the first ChildFolder filtered by the link column
|
||||
* @method ChildFolder findOneByVisible(int $visible) Return the first ChildFolder filtered by the visible column
|
||||
* @method ChildFolder findOneByPosition(int $position) Return the first ChildFolder filtered by the position column
|
||||
* @method ChildFolder findOneByCreatedAt(string $created_at) Return the first ChildFolder filtered by the created_at column
|
||||
@@ -88,7 +85,6 @@ use Thelia\Model\Map\FolderTableMap;
|
||||
*
|
||||
* @method array findById(int $id) Return ChildFolder objects filtered by the id column
|
||||
* @method array findByParent(int $parent) Return ChildFolder objects filtered by the parent column
|
||||
* @method array findByLink(string $link) Return ChildFolder objects filtered by the link column
|
||||
* @method array findByVisible(int $visible) Return ChildFolder objects filtered by the visible column
|
||||
* @method array findByPosition(int $position) Return ChildFolder objects filtered by the position column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildFolder objects filtered by the created_at column
|
||||
@@ -191,7 +187,7 @@ abstract class FolderQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, PARENT, LINK, 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);
|
||||
@@ -362,35 +358,6 @@ abstract class FolderQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(FolderTableMap::PARENT, $parent, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the link column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLink('fooValue'); // WHERE link = 'fooValue'
|
||||
* $query->filterByLink('%fooValue%'); // WHERE link LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $link The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFolderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLink($link = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($link)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $link)) {
|
||||
$link = str_replace('*', '%', $link);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(FolderTableMap::LINK, $link, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the visible column
|
||||
*
|
||||
|
||||
@@ -67,12 +67,6 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* The value for the link field.
|
||||
* @var string
|
||||
*/
|
||||
protected $link;
|
||||
|
||||
/**
|
||||
* The value for the visible field.
|
||||
* @var int
|
||||
@@ -418,17 +412,6 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [link] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [visible] column value.
|
||||
*
|
||||
@@ -579,27 +562,6 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setParent()
|
||||
|
||||
/**
|
||||
* Set the value of [link] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\FolderVersion The current object (for fluent API support)
|
||||
*/
|
||||
public function setLink($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->link !== $v) {
|
||||
$this->link = $v;
|
||||
$this->modifiedColumns[] = FolderVersionTableMap::LINK;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setLink()
|
||||
|
||||
/**
|
||||
* Set the value of [visible] column.
|
||||
*
|
||||
@@ -794,37 +756,34 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : FolderVersionTableMap::translateFieldName('Parent', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->parent = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FolderVersionTableMap::translateFieldName('Link', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->link = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FolderVersionTableMap::translateFieldName('Visible', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : FolderVersionTableMap::translateFieldName('Visible', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->visible = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FolderVersionTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : FolderVersionTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->position = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : FolderVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : FolderVersionTableMap::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 ? 6 + $startcol : FolderVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : FolderVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : FolderVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : FolderVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : FolderVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : FolderVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : FolderVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : FolderVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version_created_by = (null !== $col) ? (string) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
@@ -834,7 +793,7 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 10; // 10 = FolderVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 9; // 9 = FolderVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\FolderVersion object", 0, $e);
|
||||
@@ -1061,9 +1020,6 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(FolderVersionTableMap::PARENT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PARENT';
|
||||
}
|
||||
if ($this->isColumnModified(FolderVersionTableMap::LINK)) {
|
||||
$modifiedColumns[':p' . $index++] = 'LINK';
|
||||
}
|
||||
if ($this->isColumnModified(FolderVersionTableMap::VISIBLE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'VISIBLE';
|
||||
}
|
||||
@@ -1102,9 +1058,6 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
case 'PARENT':
|
||||
$stmt->bindValue($identifier, $this->parent, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'LINK':
|
||||
$stmt->bindValue($identifier, $this->link, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'VISIBLE':
|
||||
$stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT);
|
||||
break;
|
||||
@@ -1188,27 +1141,24 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
return $this->getParent();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getLink();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getVisible();
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
return $this->getPosition();
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
case 7:
|
||||
case 6:
|
||||
return $this->getVersion();
|
||||
break;
|
||||
case 8:
|
||||
case 7:
|
||||
return $this->getVersionCreatedAt();
|
||||
break;
|
||||
case 9:
|
||||
case 8:
|
||||
return $this->getVersionCreatedBy();
|
||||
break;
|
||||
default:
|
||||
@@ -1242,14 +1192,13 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getParent(),
|
||||
$keys[2] => $this->getLink(),
|
||||
$keys[3] => $this->getVisible(),
|
||||
$keys[4] => $this->getPosition(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
$keys[7] => $this->getVersion(),
|
||||
$keys[8] => $this->getVersionCreatedAt(),
|
||||
$keys[9] => $this->getVersionCreatedBy(),
|
||||
$keys[2] => $this->getVisible(),
|
||||
$keys[3] => $this->getPosition(),
|
||||
$keys[4] => $this->getCreatedAt(),
|
||||
$keys[5] => $this->getUpdatedAt(),
|
||||
$keys[6] => $this->getVersion(),
|
||||
$keys[7] => $this->getVersionCreatedAt(),
|
||||
$keys[8] => $this->getVersionCreatedBy(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1302,27 +1251,24 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
$this->setParent($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setLink($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setVisible($value);
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
$this->setPosition($value);
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
case 7:
|
||||
case 6:
|
||||
$this->setVersion($value);
|
||||
break;
|
||||
case 8:
|
||||
case 7:
|
||||
$this->setVersionCreatedAt($value);
|
||||
break;
|
||||
case 9:
|
||||
case 8:
|
||||
$this->setVersionCreatedBy($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1351,14 +1297,13 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setParent($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setLink($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setVisible($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($arr[$keys[8]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1372,7 +1317,6 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
|
||||
if ($this->isColumnModified(FolderVersionTableMap::ID)) $criteria->add(FolderVersionTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(FolderVersionTableMap::PARENT)) $criteria->add(FolderVersionTableMap::PARENT, $this->parent);
|
||||
if ($this->isColumnModified(FolderVersionTableMap::LINK)) $criteria->add(FolderVersionTableMap::LINK, $this->link);
|
||||
if ($this->isColumnModified(FolderVersionTableMap::VISIBLE)) $criteria->add(FolderVersionTableMap::VISIBLE, $this->visible);
|
||||
if ($this->isColumnModified(FolderVersionTableMap::POSITION)) $criteria->add(FolderVersionTableMap::POSITION, $this->position);
|
||||
if ($this->isColumnModified(FolderVersionTableMap::CREATED_AT)) $criteria->add(FolderVersionTableMap::CREATED_AT, $this->created_at);
|
||||
@@ -1452,7 +1396,6 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
{
|
||||
$copyObj->setId($this->getId());
|
||||
$copyObj->setParent($this->getParent());
|
||||
$copyObj->setLink($this->getLink());
|
||||
$copyObj->setVisible($this->getVisible());
|
||||
$copyObj->setPosition($this->getPosition());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
@@ -1545,7 +1488,6 @@ abstract class FolderVersion implements ActiveRecordInterface
|
||||
{
|
||||
$this->id = null;
|
||||
$this->parent = null;
|
||||
$this->link = null;
|
||||
$this->visible = null;
|
||||
$this->position = null;
|
||||
$this->created_at = null;
|
||||
|
||||
@@ -23,7 +23,6 @@ use Thelia\Model\Map\FolderVersionTableMap;
|
||||
*
|
||||
* @method ChildFolderVersionQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildFolderVersionQuery orderByParent($order = Criteria::ASC) Order by the parent column
|
||||
* @method ChildFolderVersionQuery orderByLink($order = Criteria::ASC) Order by the link column
|
||||
* @method ChildFolderVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
|
||||
* @method ChildFolderVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||
* @method ChildFolderVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
@@ -34,7 +33,6 @@ use Thelia\Model\Map\FolderVersionTableMap;
|
||||
*
|
||||
* @method ChildFolderVersionQuery groupById() Group by the id column
|
||||
* @method ChildFolderVersionQuery groupByParent() Group by the parent column
|
||||
* @method ChildFolderVersionQuery groupByLink() Group by the link column
|
||||
* @method ChildFolderVersionQuery groupByVisible() Group by the visible column
|
||||
* @method ChildFolderVersionQuery groupByPosition() Group by the position column
|
||||
* @method ChildFolderVersionQuery groupByCreatedAt() Group by the created_at column
|
||||
@@ -56,7 +54,6 @@ use Thelia\Model\Map\FolderVersionTableMap;
|
||||
*
|
||||
* @method ChildFolderVersion findOneById(int $id) Return the first ChildFolderVersion filtered by the id column
|
||||
* @method ChildFolderVersion findOneByParent(int $parent) Return the first ChildFolderVersion filtered by the parent column
|
||||
* @method ChildFolderVersion findOneByLink(string $link) Return the first ChildFolderVersion filtered by the link column
|
||||
* @method ChildFolderVersion findOneByVisible(int $visible) Return the first ChildFolderVersion filtered by the visible column
|
||||
* @method ChildFolderVersion findOneByPosition(int $position) Return the first ChildFolderVersion filtered by the position column
|
||||
* @method ChildFolderVersion findOneByCreatedAt(string $created_at) Return the first ChildFolderVersion filtered by the created_at column
|
||||
@@ -67,7 +64,6 @@ use Thelia\Model\Map\FolderVersionTableMap;
|
||||
*
|
||||
* @method array findById(int $id) Return ChildFolderVersion objects filtered by the id column
|
||||
* @method array findByParent(int $parent) Return ChildFolderVersion objects filtered by the parent column
|
||||
* @method array findByLink(string $link) Return ChildFolderVersion objects filtered by the link column
|
||||
* @method array findByVisible(int $visible) Return ChildFolderVersion objects filtered by the visible column
|
||||
* @method array findByPosition(int $position) Return ChildFolderVersion objects filtered by the position column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildFolderVersion objects filtered by the created_at column
|
||||
@@ -163,7 +159,7 @@ abstract class FolderVersionQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, PARENT, LINK, 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);
|
||||
@@ -348,35 +344,6 @@ abstract class FolderVersionQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(FolderVersionTableMap::PARENT, $parent, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the link column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLink('fooValue'); // WHERE link = 'fooValue'
|
||||
* $query->filterByLink('%fooValue%'); // WHERE link LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $link The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildFolderVersionQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLink($link = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($link)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $link)) {
|
||||
$link = str_replace('*', '%', $link);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(FolderVersionTableMap::LINK, $link, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the visible column
|
||||
*
|
||||
|
||||
@@ -2,20 +2,15 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Model\Base\Cart as BaseCart;
|
||||
use Thelia\Model\Base\ProductSaleElementsQuery;
|
||||
use Thelia\Model\ProductSaleElementsQuery;
|
||||
use Thelia\Model\ProductPriceQuery;
|
||||
use Thelia\Model\CartItemQuery;
|
||||
|
||||
class Cart extends BaseCart
|
||||
{
|
||||
|
||||
protected $dispatcher;
|
||||
|
||||
public function setDispatcher(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
public function duplicate($token, Customer $customer = null)
|
||||
{
|
||||
$cartItems = $this->getCartItems();
|
||||
@@ -32,17 +27,34 @@ class Cart extends BaseCart
|
||||
}
|
||||
|
||||
$cart->save();
|
||||
|
||||
$currentDateTime = new \DateTime();
|
||||
foreach ($cartItems as $cartItem){
|
||||
|
||||
$product = $cartItem->getProduct();
|
||||
$productSaleElements = $cartItem->getProductSaleElements();
|
||||
if ($product && $productSaleElements && $product->getVisible() == 1 && $productSaleElements->getQuantity() > $cartItem->getQuantity()) {
|
||||
if ($product &&
|
||||
$productSaleElements &&
|
||||
$product->getVisible() == 1 &&
|
||||
($productSaleElements->getQuantity() > $cartItem->getQuantity() || ! ConfigQuery::read("verifyStock", 1)))
|
||||
{
|
||||
|
||||
$item = new CartItem();
|
||||
$item->setCart($cart);
|
||||
$item->setProductId($cartItem->getProductId());
|
||||
$item->setQuantity($cartItem->getQuantity());
|
||||
$item->setProductSaleElements($productSaleElements);
|
||||
if ($currentDateTime <= $cartItem->getPriceEndOfLife()) {
|
||||
$item->setPrice($cartItem->getPrice());
|
||||
$item->setPromoPrice($cartItem->getPromoPrice());
|
||||
// TODO : new price EOF or duplicate current priceEOF from $cartItem ?
|
||||
$item->setPriceEndOfLife($cartItem->getPriceEndOfLife());
|
||||
} else {
|
||||
$productPrices = ProductPriceQuery::create()->filterByProductSaleElements($productSaleElements)->findOne();
|
||||
|
||||
$item->setPrice($productPrices->getPrice());
|
||||
$item->setPromoPrice($productPrices->getPromoPrice());
|
||||
$item->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30));
|
||||
}
|
||||
$item->save();
|
||||
}
|
||||
|
||||
@@ -51,8 +63,12 @@ class Cart extends BaseCart
|
||||
return $cart;
|
||||
}
|
||||
|
||||
protected function dispatchEvent($name)
|
||||
public function getLastCartItemAdded()
|
||||
{
|
||||
|
||||
$items = CartItemQuery::create()
|
||||
->filterByCartId($this->getId())
|
||||
->orderByCreatedAt(Criteria::DESC)
|
||||
->findOne()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,68 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Core\Event\CartEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Base\CartItem as BaseCartItem;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
class CartItem extends BaseCartItem
|
||||
{
|
||||
protected $dispatcher;
|
||||
|
||||
public function setDisptacher(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
if ($this->dispatcher) {
|
||||
$cartEvent = new CartEvent($this->getCart());
|
||||
|
||||
$this->dispatcher->dispatch(TheliaEvents::CART_ADDITEM, $cartEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
if ($this->dispatcher) {
|
||||
$cartEvent = new CartEvent($this->getCart());
|
||||
|
||||
$this->dispatcher->dispatch(TheliaEvents::CART_MODIFYITEM, $cartEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return $this
|
||||
*/
|
||||
public function addQuantity($value)
|
||||
{
|
||||
$currentQuantity = $this->getQuantity();
|
||||
|
||||
$newQuantity = $currentQuantity + $value;
|
||||
|
||||
if($newQuantity <= 0)
|
||||
{
|
||||
$newQuantity = $currentQuantity;
|
||||
}
|
||||
|
||||
if(ConfigQuery::read("verifyStock", 1) == 1)
|
||||
{
|
||||
$productSaleElements = $this->getProductSaleElements();
|
||||
|
||||
if($productSaleElements->getQuantity() < $newQuantity) {
|
||||
$newQuantity = $currentQuantity;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setQuantity($newQuantity);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
* @param string $phone customer phone number
|
||||
* @param string $cellphone customer cellphone number
|
||||
* @param string $zipcode customer zipcode
|
||||
* @param string $city
|
||||
* @param int $countryId customer country id (from Country table)
|
||||
* @param string $email customer email, must be unique
|
||||
* @param string $plainPassword customer plain password, hash is made calling setPassword method. Not mandatory parameter but an exception is thrown if customer is new without password
|
||||
@@ -53,7 +54,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
* @param null $sponsor
|
||||
* @param int $discount
|
||||
*/
|
||||
public function createOrUpdate($titleId, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $countryId, $email, $plainPassword = null, $lang = null, $reseller = 0, $sponsor = null, $discount = 0)
|
||||
public function createOrUpdate($titleId, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $countryId, $email, $plainPassword = null, $lang = null, $reseller = 0, $sponsor = null, $discount = 0)
|
||||
{
|
||||
$this
|
||||
->setTitleId($titleId)
|
||||
@@ -79,7 +80,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
$address = new Address();
|
||||
|
||||
$address
|
||||
->setCustomerTitleId($titleId)
|
||||
->setTitleId($titleId)
|
||||
->setFirstname($firstname)
|
||||
->setLastname($lastname)
|
||||
->setAddress1($address1)
|
||||
@@ -119,9 +120,15 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
return uniqid(substr($this->getLastname(), 0, (strlen($this->getLastname()) >= 3) ? 3 : strlen($this->getLastname())), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* create hash for plain password and set it in Customer object
|
||||
*
|
||||
* @param string $password plain password before hashing
|
||||
* @return $this|Customer
|
||||
* @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
\Thelia\Log\Tlog::getInstance()->debug($password);
|
||||
if ($this->isNew() && ($password === null || trim($password) == "")) {
|
||||
throw new InvalidArgumentException("customer password is mandatory on creation");
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class CartItemTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 7;
|
||||
const NUM_COLUMNS = 10;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class CartItemTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 7;
|
||||
const NUM_HYDRATE_COLUMNS = 10;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -94,6 +94,21 @@ class CartItemTableMap extends TableMap
|
||||
*/
|
||||
const PRODUCT_SALE_ELEMENTS_ID = 'cart_item.PRODUCT_SALE_ELEMENTS_ID';
|
||||
|
||||
/**
|
||||
* the column name for the PRICE field
|
||||
*/
|
||||
const PRICE = 'cart_item.PRICE';
|
||||
|
||||
/**
|
||||
* the column name for the PROMO_PRICE field
|
||||
*/
|
||||
const PROMO_PRICE = 'cart_item.PROMO_PRICE';
|
||||
|
||||
/**
|
||||
* the column name for the PRICE_END_OF_LIFE field
|
||||
*/
|
||||
const PRICE_END_OF_LIFE = 'cart_item.PRICE_END_OF_LIFE';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
@@ -116,12 +131,12 @@ class CartItemTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CartItemTableMap::ID, CartItemTableMap::CART_ID, CartItemTableMap::PRODUCT_ID, CartItemTableMap::QUANTITY, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, CartItemTableMap::CREATED_AT, CartItemTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CART_ID', 'PRODUCT_ID', 'QUANTITY', 'PRODUCT_SALE_ELEMENTS_ID', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'cart_id', 'product_id', 'quantity', 'product_sale_elements_id', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', '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::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', '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', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -131,12 +146,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, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
||||
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::CREATED_AT => 5, CartItemTableMap::UPDATED_AT => 6, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CART_ID' => 1, 'PRODUCT_ID' => 2, 'QUANTITY' => 3, 'PRODUCT_SALE_ELEMENTS_ID' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'cart_id' => 1, 'product_id' => 2, 'quantity' => 3, 'product_sale_elements_id' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'createdAt' => 8, 'updatedAt' => 9, ),
|
||||
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::CREATED_AT => 8, CartItemTableMap::UPDATED_AT => 9, ),
|
||||
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, 'CREATED_AT' => 8, 'UPDATED_AT' => 9, ),
|
||||
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, 'created_at' => 8, 'updated_at' => 9, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -160,6 +175,9 @@ class CartItemTableMap extends TableMap
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null);
|
||||
$this->addColumn('QUANTITY', 'Quantity', 'FLOAT', false, null, 1);
|
||||
$this->addForeignKey('PRODUCT_SALE_ELEMENTS_ID', 'ProductSaleElementsId', 'INTEGER', 'product_sale_elements', 'ID', true, null, null);
|
||||
$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('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
@@ -330,6 +348,9 @@ class CartItemTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CartItemTableMap::PRODUCT_ID);
|
||||
$criteria->addSelectColumn(CartItemTableMap::QUANTITY);
|
||||
$criteria->addSelectColumn(CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID);
|
||||
$criteria->addSelectColumn(CartItemTableMap::PRICE);
|
||||
$criteria->addSelectColumn(CartItemTableMap::PROMO_PRICE);
|
||||
$criteria->addSelectColumn(CartItemTableMap::PRICE_END_OF_LIFE);
|
||||
$criteria->addSelectColumn(CartItemTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CartItemTableMap::UPDATED_AT);
|
||||
} else {
|
||||
@@ -338,6 +359,9 @@ class CartItemTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.PRODUCT_ID');
|
||||
$criteria->addSelectColumn($alias . '.QUANTITY');
|
||||
$criteria->addSelectColumn($alias . '.PRODUCT_SALE_ELEMENTS_ID');
|
||||
$criteria->addSelectColumn($alias . '.PRICE');
|
||||
$criteria->addSelectColumn($alias . '.PROMO_PRICE');
|
||||
$criteria->addSelectColumn($alias . '.PRICE_END_OF_LIFE');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class FolderTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 10;
|
||||
const NUM_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class FolderTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 10;
|
||||
const NUM_HYDRATE_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -79,11 +79,6 @@ class FolderTableMap extends TableMap
|
||||
*/
|
||||
const PARENT = 'folder.PARENT';
|
||||
|
||||
/**
|
||||
* the column name for the LINK field
|
||||
*/
|
||||
const LINK = 'folder.LINK';
|
||||
|
||||
/**
|
||||
* the column name for the VISIBLE field
|
||||
*/
|
||||
@@ -140,12 +135,12 @@ class FolderTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Parent', 'Link', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'parent', 'link', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
|
||||
self::TYPE_COLNAME => array(FolderTableMap::ID, FolderTableMap::PARENT, FolderTableMap::LINK, FolderTableMap::VISIBLE, FolderTableMap::POSITION, FolderTableMap::CREATED_AT, FolderTableMap::UPDATED_AT, FolderTableMap::VERSION, FolderTableMap::VERSION_CREATED_AT, FolderTableMap::VERSION_CREATED_BY, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PARENT', 'LINK', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'parent', 'link', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Parent', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'parent', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
|
||||
self::TYPE_COLNAME => array(FolderTableMap::ID, FolderTableMap::PARENT, FolderTableMap::VISIBLE, FolderTableMap::POSITION, FolderTableMap::CREATED_AT, FolderTableMap::UPDATED_AT, FolderTableMap::VERSION, FolderTableMap::VERSION_CREATED_AT, FolderTableMap::VERSION_CREATED_BY, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PARENT', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'parent', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -155,12 +150,12 @@ class FolderTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Parent' => 1, 'Link' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, 'Version' => 7, 'VersionCreatedAt' => 8, 'VersionCreatedBy' => 9, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, 'version' => 7, 'versionCreatedAt' => 8, 'versionCreatedBy' => 9, ),
|
||||
self::TYPE_COLNAME => array(FolderTableMap::ID => 0, FolderTableMap::PARENT => 1, FolderTableMap::LINK => 2, FolderTableMap::VISIBLE => 3, FolderTableMap::POSITION => 4, FolderTableMap::CREATED_AT => 5, FolderTableMap::UPDATED_AT => 6, FolderTableMap::VERSION => 7, FolderTableMap::VERSION_CREATED_AT => 8, FolderTableMap::VERSION_CREATED_BY => 9, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PARENT' => 1, 'LINK' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, 'VERSION' => 7, 'VERSION_CREATED_AT' => 8, 'VERSION_CREATED_BY' => 9, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, 'version' => 7, 'version_created_at' => 8, 'version_created_by' => 9, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Parent' => 1, 'Visible' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'Version' => 6, 'VersionCreatedAt' => 7, 'VersionCreatedBy' => 8, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'parent' => 1, 'visible' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, 'version' => 6, 'versionCreatedAt' => 7, 'versionCreatedBy' => 8, ),
|
||||
self::TYPE_COLNAME => array(FolderTableMap::ID => 0, FolderTableMap::PARENT => 1, FolderTableMap::VISIBLE => 2, FolderTableMap::POSITION => 3, FolderTableMap::CREATED_AT => 4, FolderTableMap::UPDATED_AT => 5, FolderTableMap::VERSION => 6, FolderTableMap::VERSION_CREATED_AT => 7, FolderTableMap::VERSION_CREATED_BY => 8, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PARENT' => 1, 'VISIBLE' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, 'VERSION' => 6, 'VERSION_CREATED_AT' => 7, 'VERSION_CREATED_BY' => 8, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'parent' => 1, 'visible' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, 'version' => 6, 'version_created_at' => 7, 'version_created_by' => 8, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -181,7 +176,6 @@ class FolderTableMap extends TableMap
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('PARENT', 'Parent', 'INTEGER', true, null, null);
|
||||
$this->addColumn('LINK', 'Link', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', false, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
@@ -374,7 +368,6 @@ class FolderTableMap extends TableMap
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(FolderTableMap::ID);
|
||||
$criteria->addSelectColumn(FolderTableMap::PARENT);
|
||||
$criteria->addSelectColumn(FolderTableMap::LINK);
|
||||
$criteria->addSelectColumn(FolderTableMap::VISIBLE);
|
||||
$criteria->addSelectColumn(FolderTableMap::POSITION);
|
||||
$criteria->addSelectColumn(FolderTableMap::CREATED_AT);
|
||||
@@ -385,7 +378,6 @@ class FolderTableMap extends TableMap
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.PARENT');
|
||||
$criteria->addSelectColumn($alias . '.LINK');
|
||||
$criteria->addSelectColumn($alias . '.VISIBLE');
|
||||
$criteria->addSelectColumn($alias . '.POSITION');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
|
||||
@@ -57,7 +57,7 @@ class FolderVersionTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 10;
|
||||
const NUM_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class FolderVersionTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 10;
|
||||
const NUM_HYDRATE_COLUMNS = 9;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -79,11 +79,6 @@ class FolderVersionTableMap extends TableMap
|
||||
*/
|
||||
const PARENT = 'folder_version.PARENT';
|
||||
|
||||
/**
|
||||
* the column name for the LINK field
|
||||
*/
|
||||
const LINK = 'folder_version.LINK';
|
||||
|
||||
/**
|
||||
* the column name for the VISIBLE field
|
||||
*/
|
||||
@@ -131,12 +126,12 @@ class FolderVersionTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Parent', 'Link', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'parent', 'link', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
|
||||
self::TYPE_COLNAME => array(FolderVersionTableMap::ID, FolderVersionTableMap::PARENT, FolderVersionTableMap::LINK, FolderVersionTableMap::VISIBLE, FolderVersionTableMap::POSITION, FolderVersionTableMap::CREATED_AT, FolderVersionTableMap::UPDATED_AT, FolderVersionTableMap::VERSION, FolderVersionTableMap::VERSION_CREATED_AT, FolderVersionTableMap::VERSION_CREATED_BY, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PARENT', 'LINK', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'parent', 'link', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Parent', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'parent', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
|
||||
self::TYPE_COLNAME => array(FolderVersionTableMap::ID, FolderVersionTableMap::PARENT, FolderVersionTableMap::VISIBLE, FolderVersionTableMap::POSITION, FolderVersionTableMap::CREATED_AT, FolderVersionTableMap::UPDATED_AT, FolderVersionTableMap::VERSION, FolderVersionTableMap::VERSION_CREATED_AT, FolderVersionTableMap::VERSION_CREATED_BY, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'PARENT', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'parent', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -146,12 +141,12 @@ class FolderVersionTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Parent' => 1, 'Link' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, 'Version' => 7, 'VersionCreatedAt' => 8, 'VersionCreatedBy' => 9, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, 'version' => 7, 'versionCreatedAt' => 8, 'versionCreatedBy' => 9, ),
|
||||
self::TYPE_COLNAME => array(FolderVersionTableMap::ID => 0, FolderVersionTableMap::PARENT => 1, FolderVersionTableMap::LINK => 2, FolderVersionTableMap::VISIBLE => 3, FolderVersionTableMap::POSITION => 4, FolderVersionTableMap::CREATED_AT => 5, FolderVersionTableMap::UPDATED_AT => 6, FolderVersionTableMap::VERSION => 7, FolderVersionTableMap::VERSION_CREATED_AT => 8, FolderVersionTableMap::VERSION_CREATED_BY => 9, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PARENT' => 1, 'LINK' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, 'VERSION' => 7, 'VERSION_CREATED_AT' => 8, 'VERSION_CREATED_BY' => 9, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, 'version' => 7, 'version_created_at' => 8, 'version_created_by' => 9, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Parent' => 1, 'Visible' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'Version' => 6, 'VersionCreatedAt' => 7, 'VersionCreatedBy' => 8, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'parent' => 1, 'visible' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, 'version' => 6, 'versionCreatedAt' => 7, 'versionCreatedBy' => 8, ),
|
||||
self::TYPE_COLNAME => array(FolderVersionTableMap::ID => 0, FolderVersionTableMap::PARENT => 1, FolderVersionTableMap::VISIBLE => 2, FolderVersionTableMap::POSITION => 3, FolderVersionTableMap::CREATED_AT => 4, FolderVersionTableMap::UPDATED_AT => 5, FolderVersionTableMap::VERSION => 6, FolderVersionTableMap::VERSION_CREATED_AT => 7, FolderVersionTableMap::VERSION_CREATED_BY => 8, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PARENT' => 1, 'VISIBLE' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, 'VERSION' => 6, 'VERSION_CREATED_AT' => 7, 'VERSION_CREATED_BY' => 8, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'parent' => 1, 'visible' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, 'version' => 6, 'version_created_at' => 7, 'version_created_by' => 8, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -172,7 +167,6 @@ class FolderVersionTableMap extends TableMap
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'folder', 'ID', true, null, null);
|
||||
$this->addColumn('PARENT', 'Parent', 'INTEGER', true, null, null);
|
||||
$this->addColumn('LINK', 'Link', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', false, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
@@ -257,11 +251,11 @@ class FolderVersionTableMap extends TableMap
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 7 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 6 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 7 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 6 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -379,7 +373,6 @@ class FolderVersionTableMap extends TableMap
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(FolderVersionTableMap::ID);
|
||||
$criteria->addSelectColumn(FolderVersionTableMap::PARENT);
|
||||
$criteria->addSelectColumn(FolderVersionTableMap::LINK);
|
||||
$criteria->addSelectColumn(FolderVersionTableMap::VISIBLE);
|
||||
$criteria->addSelectColumn(FolderVersionTableMap::POSITION);
|
||||
$criteria->addSelectColumn(FolderVersionTableMap::CREATED_AT);
|
||||
@@ -390,7 +383,6 @@ class FolderVersionTableMap extends TableMap
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.PARENT');
|
||||
$criteria->addSelectColumn($alias . '.LINK');
|
||||
$criteria->addSelectColumn($alias . '.VISIBLE');
|
||||
$criteria->addSelectColumn($alias . '.POSITION');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
|
||||
@@ -23,10 +23,13 @@
|
||||
namespace Thelia\Tests\Action;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
use Thelia\Core\Event\DefaultActionEvent;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\HttpFoundation\Session\Session;
|
||||
use Thelia\Model\Cart;
|
||||
use Thelia\Model\Customer;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Model\ProductSaleElementsQuery;
|
||||
|
||||
class CartTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -50,15 +53,25 @@ class CartTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->uniqid = uniqid('', true);
|
||||
|
||||
$dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface");
|
||||
|
||||
$this->actionCart = $this->getMock(
|
||||
"\Thelia\Action\Cart",
|
||||
array("generateCookie")
|
||||
array("generateCookie", "redirect"),
|
||||
array($dispatcher)
|
||||
|
||||
);
|
||||
|
||||
$this->actionCart
|
||||
->expects($this->any())
|
||||
->method("generateCookie")
|
||||
->will($this->returnValue($this->uniqid));
|
||||
|
||||
$this->actionCart
|
||||
->expects($this->any())
|
||||
->method("redirect")
|
||||
->will($this->returnValue(true))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,7 +215,7 @@ class CartTest extends \PHPUnit_Framework_TestCase
|
||||
*
|
||||
* A new cart must be created (duplicated) containing customer id
|
||||
*/
|
||||
public function testGetCartWithExistinsCartAndCustomerButNotSameCustomerId()
|
||||
public function testGetCartWithExistingCartAndCustomerButNotSameCustomerId()
|
||||
{
|
||||
$actionCart = $this->actionCart;
|
||||
|
||||
@@ -236,4 +249,42 @@ class CartTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($customer->getId(), $getCart->getCustomerId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AddArticle action without data in the request, the form must not be valid
|
||||
*/
|
||||
/* public function testAddArticleWithError()
|
||||
{
|
||||
$actionEvent = new DefaultActionEvent($this->request, "AddArticle");
|
||||
|
||||
$this->actionCart->addArticle($actionEvent);
|
||||
|
||||
$this->assertTrue($actionEvent->hasErrorForm(), "no data in the request, so the action must failed and a form error must be present");
|
||||
|
||||
}*/
|
||||
|
||||
/* public function testAddArticleWithValidDataInRequest()
|
||||
{
|
||||
$request = $this->request;
|
||||
$actionCart = $this->actionCart;
|
||||
|
||||
//find valid product
|
||||
|
||||
$product = ProductQuery::create()->findOne();
|
||||
$productSalementElements = ProductSaleElementsQuery::create()->filterByProduct($product)->findOne();
|
||||
|
||||
$request->query->set("thelia_cart_add[product]", $product->getId());
|
||||
$request->query->set("thelia_cart_add[product_sale_elements_id]", $productSalementElements->getId());
|
||||
$request->query->set("thelia_cart_add[quantity]", 1);
|
||||
$request->setMethod('GET');
|
||||
|
||||
$actionEvent = new DefaultActionEvent($request, "AddArticle");
|
||||
|
||||
$actionCart->addArticle($actionEvent);
|
||||
|
||||
$this->assertFalse($actionEvent->hasErrorForm(), "there is data in the request, form must be valid");
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
43
core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php
Normal file
43
core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Tests\Core\HttpFoundation;
|
||||
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
|
||||
|
||||
class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testGetUriAddingParameters()
|
||||
{
|
||||
$request = $this->getMock(
|
||||
"Thelia\Core\HttpFoundation\Request",
|
||||
array("getUri", "getQueryString")
|
||||
);
|
||||
|
||||
$request->expects($this->any())
|
||||
->method("getUri")
|
||||
->will($this->onConsecutiveCalls(
|
||||
"http://localhost/",
|
||||
"http://localhost/?test=fu"
|
||||
));
|
||||
|
||||
$request->expects($this->any())
|
||||
->method("getQueryString")
|
||||
->will($this->onConsecutiveCalls(
|
||||
"",
|
||||
"test=fu"
|
||||
));
|
||||
|
||||
$result = $request->getUriAddingParameters(array("foo" => "bar"));
|
||||
|
||||
$this->assertEquals("http://localhost/?foo=bar", $result);
|
||||
|
||||
$result = $request->getUriAddingParameters(array("foo" => "bar"));
|
||||
|
||||
$this->assertEquals("http://localhost/?test=fu&foo=bar", $result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,7 +32,7 @@ use Thelia\Core\Template\Loop\Product;
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class ProductTest extends BaseLoopTestor
|
||||
/*class ProductTest extends BaseLoopTestor
|
||||
{
|
||||
public function getTestedClassName()
|
||||
{
|
||||
@@ -48,4 +48,4 @@ class ProductTest extends BaseLoopTestor
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@@ -28,11 +28,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
class Redirect
|
||||
{
|
||||
|
||||
public static function unauthorize($url)
|
||||
{
|
||||
self::exec($url, 401);
|
||||
}
|
||||
|
||||
public static function exec($url, $status = 302)
|
||||
{
|
||||
$response = new RedirectResponse($url, $status);
|
||||
|
||||
@@ -9,3 +9,13 @@ Variables Config à initialiser:
|
||||
- asset_dir_from_web_root : le chemin relatif à /web du repertoires des assets (ex. assets)
|
||||
- active_template: chemin du template front relatif au repertoire template (ex. default)
|
||||
- thelia_version: la version de Thelia (ex. 2.0.0 alpha)
|
||||
- cart.priceEOF : durée de vie d'un prix dans le panier (par défaut 1 mois 60*60*24*30)
|
||||
- cart.session_only : pour rattacher le panier uniquement à la session (défaut 0 donc cookie crée)
|
||||
- cart.cookie_lifetime : durée de vie du cookie du panier (défaut 1 an 60*60*24*365)
|
||||
- one_domain_foreach_lang : un domaine par langue, défaut 0
|
||||
- session_config.default : laisser la configuration par défaut de la session
|
||||
- session_config.save_path : dossier en absolu dans lequel les sessions sont enregistrés
|
||||
- default_lang_without_translation : si pas de traduction, prendre la traduction par défaut
|
||||
- password.length : longueur du mot de passe, défaut 4
|
||||
- form.secret : token csrf
|
||||
- verifyStock : vérification du stock lors du paiement/ajout au panier. Defaut 1
|
||||
|
||||
@@ -20,6 +20,28 @@ try {
|
||||
->find();
|
||||
$product->delete();
|
||||
|
||||
$customer = Thelia\Model\CustomerQuery::create()
|
||||
->find();
|
||||
$customer->delete();
|
||||
|
||||
$customer = new Thelia\Model\Customer();
|
||||
$customer->createOrUpdate(
|
||||
1,
|
||||
"thelia",
|
||||
"thelia",
|
||||
"5 rue rochon",
|
||||
"",
|
||||
"",
|
||||
"0102030405",
|
||||
"0601020304",
|
||||
"63000",
|
||||
"clermont-ferrand",
|
||||
64,
|
||||
"test@thelia.net",
|
||||
"azerty"
|
||||
);
|
||||
|
||||
|
||||
$folder = Thelia\Model\FolderQuery::create()
|
||||
->find();
|
||||
$folder->delete();
|
||||
|
||||
@@ -538,7 +538,6 @@ CREATE TABLE `folder`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`parent` INTEGER NOT NULL,
|
||||
`link` VARCHAR(255),
|
||||
`visible` TINYINT,
|
||||
`position` INTEGER,
|
||||
`created_at` DATETIME,
|
||||
@@ -1274,7 +1273,7 @@ DROP TABLE IF EXISTS `cart`;
|
||||
CREATE TABLE `cart`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`token` VARCHAR(255) NOT NULL,
|
||||
`token` VARCHAR(255),
|
||||
`customer_id` INTEGER,
|
||||
`address_delivery_id` INTEGER,
|
||||
`address_invoice_id` INTEGER,
|
||||
@@ -1314,6 +1313,9 @@ CREATE TABLE `cart_item`
|
||||
`product_id` INTEGER NOT NULL,
|
||||
`quantity` FLOAT DEFAULT 1,
|
||||
`product_sale_elements_id` INTEGER NOT NULL,
|
||||
`price` FLOAT,
|
||||
`promo_price` FLOAT,
|
||||
`price_end_of_life` DATETIME,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
@@ -1847,7 +1849,6 @@ CREATE TABLE `folder_version`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`parent` INTEGER NOT NULL,
|
||||
`link` VARCHAR(255),
|
||||
`visible` TINYINT,
|
||||
`position` INTEGER,
|
||||
`created_at` DATETIME,
|
||||
|
||||
@@ -393,7 +393,6 @@
|
||||
<table name="folder" namespace="Thelia\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="parent" required="true" type="INTEGER" />
|
||||
<column name="link" size="255" type="VARCHAR" />
|
||||
<column name="visible" type="TINYINT" />
|
||||
<column name="position" type="INTEGER" />
|
||||
<column name="title" size="255" type="VARCHAR" />
|
||||
@@ -926,7 +925,7 @@
|
||||
</table>
|
||||
<table name="cart" namespace="Thelia\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="token" required="true" size="255" type="VARCHAR" />
|
||||
<column name="token" size="255" type="VARCHAR" />
|
||||
<column name="customer_id" type="INTEGER" />
|
||||
<column name="address_delivery_id" type="INTEGER" />
|
||||
<column name="address_invoice_id" type="INTEGER" />
|
||||
@@ -943,9 +942,6 @@
|
||||
<foreign-key foreignTable="currency" name="fk_cart_currency_id">
|
||||
<reference foreign="id" local="currency_id" />
|
||||
</foreign-key>
|
||||
<unique name="token_UNIQUE">
|
||||
<unique-column name="token" />
|
||||
</unique>
|
||||
<index name="idx_cart_customer_id">
|
||||
<index-column name="customer_id" />
|
||||
</index>
|
||||
@@ -958,6 +954,9 @@
|
||||
<index name="idx_cart_currency_id">
|
||||
<index-column name="currency_id" />
|
||||
</index>
|
||||
<unique name="token_UNIQUE">
|
||||
<unique-column name="token" />
|
||||
</unique>
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
<table name="cart_item" namespace="Thelia\Model">
|
||||
@@ -966,6 +965,9 @@
|
||||
<column name="product_id" required="true" type="INTEGER" />
|
||||
<column defaultValue="1" name="quantity" type="FLOAT" />
|
||||
<column name="product_sale_elements_id" required="true" type="INTEGER" />
|
||||
<column name="price" type="FLOAT" />
|
||||
<column name="promo_price" type="FLOAT" />
|
||||
<column name="price_end_of_life" type="TIMESTAMP" />
|
||||
<foreign-key foreignTable="cart" name="fk_cart_item_cart_id">
|
||||
<reference foreign="id" local="cart_id" />
|
||||
</foreign-key>
|
||||
|
||||
Reference in New Issue
Block a user