Merge branch 'modules' of https://github.com/thelia/thelia into modules

Conflicts:
	core/lib/Thelia/Core/Template/Assets/AssetManagerInterface.php
	core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php
	core/lib/Thelia/Core/Template/Loop/Template.php
	core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
	core/lib/Thelia/Core/Template/TemplateDefinition.php
	core/lib/Thelia/Model/Base/CartItem.php
	core/lib/Thelia/Model/Base/CartItemQuery.php
	core/lib/Thelia/Model/Base/CouponOrder.php
	core/lib/Thelia/Model/Base/Order.php
	core/lib/Thelia/Model/Base/OrderCouponQuery.php
	core/lib/Thelia/Model/Base/OrderQuery.php
This commit is contained in:
Franck Allimant
2013-12-20 14:30:50 +01:00
144 changed files with 1945 additions and 1986 deletions

View File

@@ -109,6 +109,13 @@ abstract class CartItem implements ActiveRecordInterface
*/
protected $price_end_of_life;
/**
* The value for the discount field.
* Note: this column has a database default value of: 0
* @var double
*/
protected $discount;
/**
* The value for the promo field.
* @var int
@@ -159,6 +166,7 @@ abstract class CartItem implements ActiveRecordInterface
public function applyDefaultValues()
{
$this->quantity = 1;
$this->discount = 0;
}
/**
@@ -518,6 +526,17 @@ abstract class CartItem implements ActiveRecordInterface
}
}
/**
* Get the [discount] column value.
*
* @return double
*/
public function getDiscount()
{
return $this->discount;
}
/**
* Get the [promo] column value.
*
@@ -749,6 +768,27 @@ abstract class CartItem implements ActiveRecordInterface
return $this;
} // setPriceEndOfLife()
/**
* Set the value of [discount] column.
*
* @param double $v new value
* @return \Thelia\Model\CartItem The current object (for fluent API support)
*/
public function setDiscount($v)
{
if ($v !== null) {
$v = (double) $v;
}
if ($this->discount !== $v) {
$this->discount = $v;
$this->modifiedColumns[] = CartItemTableMap::DISCOUNT;
}
return $this;
} // setDiscount()
/**
* Set the value of [promo] column.
*
@@ -826,6 +866,10 @@ abstract class CartItem implements ActiveRecordInterface
return false;
}
if ($this->discount !== 0) {
return false;
}
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -880,16 +924,19 @@ abstract class CartItem implements ActiveRecordInterface
}
$this->price_end_of_life = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CartItemTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CartItemTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
$this->discount = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
$this->promo = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CartItemTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $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 ? 10 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CartItemTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -902,7 +949,7 @@ abstract class CartItem implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 11; // 11 = CartItemTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 12; // 12 = CartItemTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\CartItem object", 0, $e);
@@ -1184,6 +1231,9 @@ abstract class CartItem implements ActiveRecordInterface
if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) {
$modifiedColumns[':p' . $index++] = 'PRICE_END_OF_LIFE';
}
if ($this->isColumnModified(CartItemTableMap::DISCOUNT)) {
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
}
if ($this->isColumnModified(CartItemTableMap::PROMO)) {
$modifiedColumns[':p' . $index++] = 'PROMO';
}
@@ -1228,6 +1278,9 @@ abstract class CartItem implements ActiveRecordInterface
case 'PRICE_END_OF_LIFE':
$stmt->bindValue($identifier, $this->price_end_of_life ? $this->price_end_of_life->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
case 'DISCOUNT':
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
break;
case 'PROMO':
$stmt->bindValue($identifier, $this->promo, PDO::PARAM_INT);
break;
@@ -1324,12 +1377,15 @@ abstract class CartItem implements ActiveRecordInterface
return $this->getPriceEndOfLife();
break;
case 8:
return $this->getPromo();
return $this->getDiscount();
break;
case 9:
return $this->getCreatedAt();
return $this->getPromo();
break;
case 10:
return $this->getCreatedAt();
break;
case 11:
return $this->getUpdatedAt();
break;
default:
@@ -1369,9 +1425,10 @@ abstract class CartItem implements ActiveRecordInterface
$keys[5] => $this->getPrice(),
$keys[6] => $this->getPromoPrice(),
$keys[7] => $this->getPriceEndOfLife(),
$keys[8] => $this->getPromo(),
$keys[9] => $this->getCreatedAt(),
$keys[10] => $this->getUpdatedAt(),
$keys[8] => $this->getDiscount(),
$keys[9] => $this->getPromo(),
$keys[10] => $this->getCreatedAt(),
$keys[11] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1447,12 +1504,15 @@ abstract class CartItem implements ActiveRecordInterface
$this->setPriceEndOfLife($value);
break;
case 8:
$this->setPromo($value);
$this->setDiscount($value);
break;
case 9:
$this->setCreatedAt($value);
$this->setPromo($value);
break;
case 10:
$this->setCreatedAt($value);
break;
case 11:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1487,9 +1547,10 @@ abstract class CartItem implements ActiveRecordInterface
if (array_key_exists($keys[5], $arr)) $this->setPrice($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setPromoPrice($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setPriceEndOfLife($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setPromo($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setCreatedAt($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setUpdatedAt($arr[$keys[10]]);
if (array_key_exists($keys[8], $arr)) $this->setDiscount($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setPromo($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setUpdatedAt($arr[$keys[11]]);
}
/**
@@ -1509,6 +1570,7 @@ abstract class CartItem implements ActiveRecordInterface
if ($this->isColumnModified(CartItemTableMap::PRICE)) $criteria->add(CartItemTableMap::PRICE, $this->price);
if ($this->isColumnModified(CartItemTableMap::PROMO_PRICE)) $criteria->add(CartItemTableMap::PROMO_PRICE, $this->promo_price);
if ($this->isColumnModified(CartItemTableMap::PRICE_END_OF_LIFE)) $criteria->add(CartItemTableMap::PRICE_END_OF_LIFE, $this->price_end_of_life);
if ($this->isColumnModified(CartItemTableMap::DISCOUNT)) $criteria->add(CartItemTableMap::DISCOUNT, $this->discount);
if ($this->isColumnModified(CartItemTableMap::PROMO)) $criteria->add(CartItemTableMap::PROMO, $this->promo);
if ($this->isColumnModified(CartItemTableMap::CREATED_AT)) $criteria->add(CartItemTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(CartItemTableMap::UPDATED_AT)) $criteria->add(CartItemTableMap::UPDATED_AT, $this->updated_at);
@@ -1582,6 +1644,7 @@ abstract class CartItem implements ActiveRecordInterface
$copyObj->setPrice($this->getPrice());
$copyObj->setPromoPrice($this->getPromoPrice());
$copyObj->setPriceEndOfLife($this->getPriceEndOfLife());
$copyObj->setDiscount($this->getDiscount());
$copyObj->setPromo($this->getPromo());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1779,6 +1842,7 @@ abstract class CartItem implements ActiveRecordInterface
$this->price = null;
$this->promo_price = null;
$this->price_end_of_life = null;
$this->discount = null;
$this->promo = null;
$this->created_at = null;
$this->updated_at = null;

View File

@@ -29,6 +29,7 @@ use Thelia\Model\Map\CartItemTableMap;
* @method ChildCartItemQuery orderByPrice($order = Criteria::ASC) Order by the price column
* @method ChildCartItemQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column
* @method ChildCartItemQuery orderByPriceEndOfLife($order = Criteria::ASC) Order by the price_end_of_life column
* @method ChildCartItemQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
* @method ChildCartItemQuery orderByPromo($order = Criteria::ASC) Order by the promo column
* @method ChildCartItemQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCartItemQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
@@ -41,6 +42,7 @@ use Thelia\Model\Map\CartItemTableMap;
* @method ChildCartItemQuery groupByPrice() Group by the price column
* @method ChildCartItemQuery groupByPromoPrice() Group by the promo_price column
* @method ChildCartItemQuery groupByPriceEndOfLife() Group by the price_end_of_life column
* @method ChildCartItemQuery groupByDiscount() Group by the discount column
* @method ChildCartItemQuery groupByPromo() Group by the promo column
* @method ChildCartItemQuery groupByCreatedAt() Group by the created_at column
* @method ChildCartItemQuery groupByUpdatedAt() Group by the updated_at column
@@ -72,6 +74,7 @@ use Thelia\Model\Map\CartItemTableMap;
* @method ChildCartItem findOneByPrice(double $price) Return the first ChildCartItem filtered by the price column
* @method ChildCartItem findOneByPromoPrice(double $promo_price) Return the first ChildCartItem filtered by the promo_price column
* @method ChildCartItem findOneByPriceEndOfLife(string $price_end_of_life) Return the first ChildCartItem filtered by the price_end_of_life column
* @method ChildCartItem findOneByDiscount(double $discount) Return the first ChildCartItem filtered by the discount column
* @method ChildCartItem findOneByPromo(int $promo) Return the first ChildCartItem filtered by the promo column
* @method ChildCartItem findOneByCreatedAt(string $created_at) Return the first ChildCartItem filtered by the created_at column
* @method ChildCartItem findOneByUpdatedAt(string $updated_at) Return the first ChildCartItem filtered by the updated_at column
@@ -84,6 +87,7 @@ use Thelia\Model\Map\CartItemTableMap;
* @method array findByPrice(double $price) Return ChildCartItem objects filtered by the price column
* @method array findByPromoPrice(double $promo_price) Return ChildCartItem objects filtered by the promo_price column
* @method array findByPriceEndOfLife(string $price_end_of_life) Return ChildCartItem objects filtered by the price_end_of_life column
* @method array findByDiscount(double $discount) Return ChildCartItem objects filtered by the discount column
* @method array findByPromo(int $promo) Return ChildCartItem objects filtered by the promo column
* @method array findByCreatedAt(string $created_at) Return ChildCartItem objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCartItem objects filtered by the updated_at column
@@ -175,7 +179,7 @@ abstract class CartItemQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, CART_ID, PRODUCT_ID, QUANTITY, PRODUCT_SALE_ELEMENTS_ID, PRICE, PROMO_PRICE, PRICE_END_OF_LIFE, PROMO, CREATED_AT, UPDATED_AT FROM cart_item WHERE ID = :p0';
$sql = 'SELECT ID, CART_ID, PRODUCT_ID, QUANTITY, PRODUCT_SALE_ELEMENTS_ID, PRICE, PROMO_PRICE, PRICE_END_OF_LIFE, DISCOUNT, PROMO, CREATED_AT, UPDATED_AT FROM cart_item WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -600,6 +604,47 @@ abstract class CartItemQuery extends ModelCriteria
return $this->addUsingAlias(CartItemTableMap::PRICE_END_OF_LIFE, $priceEndOfLife, $comparison);
}
/**
* Filter the query on the discount column
*
* Example usage:
* <code>
* $query->filterByDiscount(1234); // WHERE discount = 1234
* $query->filterByDiscount(array(12, 34)); // WHERE discount IN (12, 34)
* $query->filterByDiscount(array('min' => 12)); // WHERE discount > 12
* </code>
*
* @param mixed $discount The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCartItemQuery The current query, for fluid interface
*/
public function filterByDiscount($discount = null, $comparison = null)
{
if (is_array($discount)) {
$useMinMax = false;
if (isset($discount['min'])) {
$this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($discount['max'])) {
$this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CartItemTableMap::DISCOUNT, $discount, $comparison);
}
/**
* Filter the query on the promo column
*

View File

@@ -0,0 +1,678 @@
<?php
namespace Thelia\Model\Base;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\CouponOrder as ChildCouponOrder;
use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery;
use Thelia\Model\Map\CouponOrderTableMap;
/**
* Base class that represents a query for the 'coupon_order' table.
*
*
*
* @method ChildCouponOrderQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildCouponOrderQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
* @method ChildCouponOrderQuery orderByValue($order = Criteria::ASC) Order by the value column
* @method ChildCouponOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCouponOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildCouponOrderQuery groupById() Group by the id column
* @method ChildCouponOrderQuery groupByOrderId() Group by the order_id column
* @method ChildCouponOrderQuery groupByValue() Group by the value column
* @method ChildCouponOrderQuery groupByCreatedAt() Group by the created_at column
* @method ChildCouponOrderQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildCouponOrderQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCouponOrderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildCouponOrderQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildCouponOrderQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
* @method ChildCouponOrderQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
* @method ChildCouponOrderQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
*
* @method ChildCouponOrder findOne(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query
* @method ChildCouponOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query, or a new ChildCouponOrder object populated from the query conditions when no match is found
*
* @method ChildCouponOrder findOneById(int $id) Return the first ChildCouponOrder filtered by the id column
* @method ChildCouponOrder findOneByOrderId(int $order_id) Return the first ChildCouponOrder filtered by the order_id column
* @method ChildCouponOrder findOneByValue(double $value) Return the first ChildCouponOrder filtered by the value column
* @method ChildCouponOrder findOneByCreatedAt(string $created_at) Return the first ChildCouponOrder filtered by the created_at column
* @method ChildCouponOrder findOneByUpdatedAt(string $updated_at) Return the first ChildCouponOrder filtered by the updated_at column
*
* @method array findById(int $id) Return ChildCouponOrder objects filtered by the id column
* @method array findByOrderId(int $order_id) Return ChildCouponOrder objects filtered by the order_id column
* @method array findByValue(double $value) Return ChildCouponOrder objects filtered by the value column
* @method array findByCreatedAt(string $created_at) Return ChildCouponOrder objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCouponOrder objects filtered by the updated_at column
*
*/
abstract class CouponOrderQuery extends ModelCriteria
{
/**
* Initializes internal state of \Thelia\Model\Base\CouponOrderQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\CouponOrder', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildCouponOrderQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildCouponOrderQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \Thelia\Model\CouponOrderQuery) {
return $criteria;
}
$query = new \Thelia\Model\CouponOrderQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ChildCouponOrder|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = CouponOrderTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(CouponOrderTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCouponOrder A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, ORDER_ID, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildCouponOrder();
$obj->hydrate($row);
CouponOrderTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return ChildCouponOrder|array|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object
*
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$dataFetcher = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CouponOrderTableMap::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CouponOrderTableMap::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(CouponOrderTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CouponOrderTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the order_id column
*
* Example usage:
* <code>
* $query->filterByOrderId(1234); // WHERE order_id = 1234
* $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34)
* $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12
* </code>
*
* @see filterByOrder()
*
* @param mixed $orderId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByOrderId($orderId = null, $comparison = null)
{
if (is_array($orderId)) {
$useMinMax = false;
if (isset($orderId['min'])) {
$this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($orderId['max'])) {
$this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId, $comparison);
}
/**
* Filter the query on the value column
*
* Example usage:
* <code>
* $query->filterByValue(1234); // WHERE value = 1234
* $query->filterByValue(array(12, 34)); // WHERE value IN (12, 34)
* $query->filterByValue(array('min' => 12)); // WHERE value > 12
* </code>
*
* @param mixed $value The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByValue($value = null, $comparison = null)
{
if (is_array($value)) {
$useMinMax = false;
if (isset($value['min'])) {
$this->addUsingAlias(CouponOrderTableMap::VALUE, $value['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($value['max'])) {
$this->addUsingAlias(CouponOrderTableMap::VALUE, $value['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::VALUE, $value, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(CouponOrderTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(CouponOrderTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Order object
*
* @param \Thelia\Model\Order|ObjectCollection $order The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function filterByOrder($order, $comparison = null)
{
if ($order instanceof \Thelia\Model\Order) {
return $this
->addUsingAlias(CouponOrderTableMap::ORDER_ID, $order->getId(), $comparison);
} elseif ($order instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CouponOrderTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByOrder() only accepts arguments of type \Thelia\Model\Order or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Order relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Order');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Order');
}
return $this;
}
/**
* Use the Order relation Order object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
*/
public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
}
/**
* Exclude object from result
*
* @param ChildCouponOrder $couponOrder Object to remove from the list of results
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function prune($couponOrder = null)
{
if ($couponOrder) {
$this->addUsingAlias(CouponOrderTableMap::ID, $couponOrder->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the coupon_order table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public function doDeleteAll(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += parent::doDeleteAll($con);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CouponOrderTableMap::clearInstancePool();
CouponOrderTableMap::clearRelatedInstancePool();
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
return $affectedRows;
}
/**
* Performs a DELETE on the database, given a ChildCouponOrder or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ChildCouponOrder object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME);
}
$criteria = $this;
// Set the correct dbName
$criteria->setDbName(CouponOrderTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
CouponOrderTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
CouponOrderTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(CouponOrderTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(CouponOrderTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(CouponOrderTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(CouponOrderTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(CouponOrderTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildCouponOrderQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(CouponOrderTableMap::CREATED_AT);
}
} // CouponOrderQuery

View File

@@ -17,6 +17,8 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\CouponOrder as ChildCouponOrder;
use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery;
use Thelia\Model\Currency as ChildCurrency;
use Thelia\Model\CurrencyQuery as ChildCurrencyQuery;
use Thelia\Model\Customer as ChildCustomer;
@@ -28,8 +30,6 @@ use Thelia\Model\ModuleQuery as ChildModuleQuery;
use Thelia\Model\Order as ChildOrder;
use Thelia\Model\OrderAddress as ChildOrderAddress;
use Thelia\Model\OrderAddressQuery as ChildOrderAddressQuery;
use Thelia\Model\OrderCoupon as ChildOrderCoupon;
use Thelia\Model\OrderCouponQuery as ChildOrderCouponQuery;
use Thelia\Model\OrderProduct as ChildOrderProduct;
use Thelia\Model\OrderProductQuery as ChildOrderProductQuery;
use Thelia\Model\OrderQuery as ChildOrderQuery;
@@ -137,12 +137,6 @@ abstract class Order implements ActiveRecordInterface
*/
protected $invoice_ref;
/**
* The value for the discount field.
* @var double
*/
protected $discount;
/**
* The value for the postage field.
* @var double
@@ -232,10 +226,10 @@ abstract class Order implements ActiveRecordInterface
protected $collOrderProductsPartial;
/**
* @var ObjectCollection|ChildOrderCoupon[] Collection to store aggregation of ChildOrderCoupon objects.
* @var ObjectCollection|ChildCouponOrder[] Collection to store aggregation of ChildCouponOrder objects.
*/
protected $collOrderCoupons;
protected $collOrderCouponsPartial;
protected $collCouponOrders;
protected $collCouponOrdersPartial;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -255,7 +249,7 @@ abstract class Order implements ActiveRecordInterface
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $orderCouponsScheduledForDeletion = null;
protected $couponOrdersScheduledForDeletion = null;
/**
* Initializes internal state of Thelia\Model\Base\Order object.
@@ -645,17 +639,6 @@ abstract class Order implements ActiveRecordInterface
return $this->invoice_ref;
}
/**
* Get the [discount] column value.
*
* @return double
*/
public function getDiscount()
{
return $this->discount;
}
/**
* Get the [postage] column value.
*
@@ -998,27 +981,6 @@ abstract class Order implements ActiveRecordInterface
return $this;
} // setInvoiceRef()
/**
* Set the value of [discount] column.
*
* @param double $v new value
* @return \Thelia\Model\Order The current object (for fluent API support)
*/
public function setDiscount($v)
{
if ($v !== null) {
$v = (double) $v;
}
if ($this->discount !== $v) {
$this->discount = $v;
$this->modifiedColumns[] = OrderTableMap::DISCOUNT;
}
return $this;
} // setDiscount()
/**
* Set the value of [postage] column.
*
@@ -1255,31 +1217,28 @@ abstract class Order implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : OrderTableMap::translateFieldName('InvoiceRef', TableMap::TYPE_PHPNAME, $indexType)];
$this->invoice_ref = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : OrderTableMap::translateFieldName('Discount', TableMap::TYPE_PHPNAME, $indexType)];
$this->discount = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : OrderTableMap::translateFieldName('Postage', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : OrderTableMap::translateFieldName('Postage', TableMap::TYPE_PHPNAME, $indexType)];
$this->postage = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderTableMap::translateFieldName('PaymentModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : OrderTableMap::translateFieldName('PaymentModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->payment_module_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderTableMap::translateFieldName('DeliveryModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderTableMap::translateFieldName('DeliveryModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->delivery_module_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderTableMap::translateFieldName('StatusId', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderTableMap::translateFieldName('StatusId', TableMap::TYPE_PHPNAME, $indexType)];
$this->status_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderTableMap::translateFieldName('LangId', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderTableMap::translateFieldName('LangId', TableMap::TYPE_PHPNAME, $indexType)];
$this->lang_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : OrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 18 + $startcol : OrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : OrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -1292,7 +1251,7 @@ abstract class Order implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 19; // 19 = OrderTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 18; // 18 = OrderTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Order object", 0, $e);
@@ -1387,7 +1346,7 @@ abstract class Order implements ActiveRecordInterface
$this->aLang = null;
$this->collOrderProducts = null;
$this->collOrderCoupons = null;
$this->collCouponOrders = null;
} // if (deep)
}
@@ -1600,17 +1559,17 @@ abstract class Order implements ActiveRecordInterface
}
}
if ($this->orderCouponsScheduledForDeletion !== null) {
if (!$this->orderCouponsScheduledForDeletion->isEmpty()) {
\Thelia\Model\OrderCouponQuery::create()
->filterByPrimaryKeys($this->orderCouponsScheduledForDeletion->getPrimaryKeys(false))
if ($this->couponOrdersScheduledForDeletion !== null) {
if (!$this->couponOrdersScheduledForDeletion->isEmpty()) {
\Thelia\Model\CouponOrderQuery::create()
->filterByPrimaryKeys($this->couponOrdersScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->orderCouponsScheduledForDeletion = null;
$this->couponOrdersScheduledForDeletion = null;
}
}
if ($this->collOrderCoupons !== null) {
foreach ($this->collOrderCoupons as $referrerFK) {
if ($this->collCouponOrders !== null) {
foreach ($this->collCouponOrders as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
@@ -1676,9 +1635,6 @@ abstract class Order implements ActiveRecordInterface
if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) {
$modifiedColumns[':p' . $index++] = 'INVOICE_REF';
}
if ($this->isColumnModified(OrderTableMap::DISCOUNT)) {
$modifiedColumns[':p' . $index++] = 'DISCOUNT';
}
if ($this->isColumnModified(OrderTableMap::POSTAGE)) {
$modifiedColumns[':p' . $index++] = 'POSTAGE';
}
@@ -1744,9 +1700,6 @@ abstract class Order implements ActiveRecordInterface
case 'INVOICE_REF':
$stmt->bindValue($identifier, $this->invoice_ref, PDO::PARAM_STR);
break;
case 'DISCOUNT':
$stmt->bindValue($identifier, $this->discount, PDO::PARAM_STR);
break;
case 'POSTAGE':
$stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR);
break;
@@ -1864,27 +1817,24 @@ abstract class Order implements ActiveRecordInterface
return $this->getInvoiceRef();
break;
case 11:
return $this->getDiscount();
break;
case 12:
return $this->getPostage();
break;
case 13:
case 12:
return $this->getPaymentModuleId();
break;
case 14:
case 13:
return $this->getDeliveryModuleId();
break;
case 15:
case 14:
return $this->getStatusId();
break;
case 16:
case 15:
return $this->getLangId();
break;
case 17:
case 16:
return $this->getCreatedAt();
break;
case 18:
case 17:
return $this->getUpdatedAt();
break;
default:
@@ -1927,14 +1877,13 @@ abstract class Order implements ActiveRecordInterface
$keys[8] => $this->getTransactionRef(),
$keys[9] => $this->getDeliveryRef(),
$keys[10] => $this->getInvoiceRef(),
$keys[11] => $this->getDiscount(),
$keys[12] => $this->getPostage(),
$keys[13] => $this->getPaymentModuleId(),
$keys[14] => $this->getDeliveryModuleId(),
$keys[15] => $this->getStatusId(),
$keys[16] => $this->getLangId(),
$keys[17] => $this->getCreatedAt(),
$keys[18] => $this->getUpdatedAt(),
$keys[11] => $this->getPostage(),
$keys[12] => $this->getPaymentModuleId(),
$keys[13] => $this->getDeliveryModuleId(),
$keys[14] => $this->getStatusId(),
$keys[15] => $this->getLangId(),
$keys[16] => $this->getCreatedAt(),
$keys[17] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1969,8 +1918,8 @@ abstract class Order implements ActiveRecordInterface
if (null !== $this->collOrderProducts) {
$result['OrderProducts'] = $this->collOrderProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collOrderCoupons) {
$result['OrderCoupons'] = $this->collOrderCoupons->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
if (null !== $this->collCouponOrders) {
$result['CouponOrders'] = $this->collCouponOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
@@ -2040,27 +1989,24 @@ abstract class Order implements ActiveRecordInterface
$this->setInvoiceRef($value);
break;
case 11:
$this->setDiscount($value);
break;
case 12:
$this->setPostage($value);
break;
case 13:
case 12:
$this->setPaymentModuleId($value);
break;
case 14:
case 13:
$this->setDeliveryModuleId($value);
break;
case 15:
case 14:
$this->setStatusId($value);
break;
case 16:
case 15:
$this->setLangId($value);
break;
case 17:
case 16:
$this->setCreatedAt($value);
break;
case 18:
case 17:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -2098,14 +2044,13 @@ abstract class Order implements ActiveRecordInterface
if (array_key_exists($keys[8], $arr)) $this->setTransactionRef($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDeliveryRef($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setInvoiceRef($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDiscount($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setPostage($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setPaymentModuleId($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setDeliveryModuleId($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setStatusId($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setLangId($arr[$keys[16]]);
if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]);
if (array_key_exists($keys[18], $arr)) $this->setUpdatedAt($arr[$keys[18]]);
if (array_key_exists($keys[11], $arr)) $this->setPostage($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setPaymentModuleId($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setDeliveryModuleId($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setStatusId($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setLangId($arr[$keys[15]]);
if (array_key_exists($keys[16], $arr)) $this->setCreatedAt($arr[$keys[16]]);
if (array_key_exists($keys[17], $arr)) $this->setUpdatedAt($arr[$keys[17]]);
}
/**
@@ -2128,7 +2073,6 @@ abstract class Order implements ActiveRecordInterface
if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) $criteria->add(OrderTableMap::TRANSACTION_REF, $this->transaction_ref);
if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) $criteria->add(OrderTableMap::DELIVERY_REF, $this->delivery_ref);
if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) $criteria->add(OrderTableMap::INVOICE_REF, $this->invoice_ref);
if ($this->isColumnModified(OrderTableMap::DISCOUNT)) $criteria->add(OrderTableMap::DISCOUNT, $this->discount);
if ($this->isColumnModified(OrderTableMap::POSTAGE)) $criteria->add(OrderTableMap::POSTAGE, $this->postage);
if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) $criteria->add(OrderTableMap::PAYMENT_MODULE_ID, $this->payment_module_id);
if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) $criteria->add(OrderTableMap::DELIVERY_MODULE_ID, $this->delivery_module_id);
@@ -2209,7 +2153,6 @@ abstract class Order implements ActiveRecordInterface
$copyObj->setTransactionRef($this->getTransactionRef());
$copyObj->setDeliveryRef($this->getDeliveryRef());
$copyObj->setInvoiceRef($this->getInvoiceRef());
$copyObj->setDiscount($this->getDiscount());
$copyObj->setPostage($this->getPostage());
$copyObj->setPaymentModuleId($this->getPaymentModuleId());
$copyObj->setDeliveryModuleId($this->getDeliveryModuleId());
@@ -2229,9 +2172,9 @@ abstract class Order implements ActiveRecordInterface
}
}
foreach ($this->getOrderCoupons() as $relObj) {
foreach ($this->getCouponOrders() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addOrderCoupon($relObj->copy($deepCopy));
$copyObj->addCouponOrder($relObj->copy($deepCopy));
}
}
@@ -2687,8 +2630,8 @@ abstract class Order implements ActiveRecordInterface
if ('OrderProduct' == $relationName) {
return $this->initOrderProducts();
}
if ('OrderCoupon' == $relationName) {
return $this->initOrderCoupons();
if ('CouponOrder' == $relationName) {
return $this->initCouponOrders();
}
}
@@ -2911,31 +2854,31 @@ abstract class Order implements ActiveRecordInterface
}
/**
* Clears out the collOrderCoupons collection
* Clears out the collCouponOrders collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addOrderCoupons()
* @see addCouponOrders()
*/
public function clearOrderCoupons()
public function clearCouponOrders()
{
$this->collOrderCoupons = null; // important to set this to NULL since that means it is uninitialized
$this->collCouponOrders = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collOrderCoupons collection loaded partially.
* Reset is the collCouponOrders collection loaded partially.
*/
public function resetPartialOrderCoupons($v = true)
public function resetPartialCouponOrders($v = true)
{
$this->collOrderCouponsPartial = $v;
$this->collCouponOrdersPartial = $v;
}
/**
* Initializes the collOrderCoupons collection.
* Initializes the collCouponOrders collection.
*
* By default this just sets the collOrderCoupons collection to an empty array (like clearcollOrderCoupons());
* By default this just sets the collCouponOrders collection to an empty array (like clearcollCouponOrders());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
@@ -2944,17 +2887,17 @@ abstract class Order implements ActiveRecordInterface
*
* @return void
*/
public function initOrderCoupons($overrideExisting = true)
public function initCouponOrders($overrideExisting = true)
{
if (null !== $this->collOrderCoupons && !$overrideExisting) {
if (null !== $this->collCouponOrders && !$overrideExisting) {
return;
}
$this->collOrderCoupons = new ObjectCollection();
$this->collOrderCoupons->setModel('\Thelia\Model\OrderCoupon');
$this->collCouponOrders = new ObjectCollection();
$this->collCouponOrders->setModel('\Thelia\Model\CouponOrder');
}
/**
* Gets an array of ChildOrderCoupon objects which contain a foreign key that references this object.
* Gets an array of ChildCouponOrder objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -2964,109 +2907,109 @@ abstract class Order implements ActiveRecordInterface
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object
* @return Collection|ChildOrderCoupon[] List of ChildOrderCoupon objects
* @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects
* @throws PropelException
*/
public function getOrderCoupons($criteria = null, ConnectionInterface $con = null)
public function getCouponOrders($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collOrderCouponsPartial && !$this->isNew();
if (null === $this->collOrderCoupons || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrderCoupons) {
$partial = $this->collCouponOrdersPartial && !$this->isNew();
if (null === $this->collCouponOrders || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCouponOrders) {
// return empty collection
$this->initOrderCoupons();
$this->initCouponOrders();
} else {
$collOrderCoupons = ChildOrderCouponQuery::create(null, $criteria)
$collCouponOrders = ChildCouponOrderQuery::create(null, $criteria)
->filterByOrder($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collOrderCouponsPartial && count($collOrderCoupons)) {
$this->initOrderCoupons(false);
if (false !== $this->collCouponOrdersPartial && count($collCouponOrders)) {
$this->initCouponOrders(false);
foreach ($collOrderCoupons as $obj) {
if (false == $this->collOrderCoupons->contains($obj)) {
$this->collOrderCoupons->append($obj);
foreach ($collCouponOrders as $obj) {
if (false == $this->collCouponOrders->contains($obj)) {
$this->collCouponOrders->append($obj);
}
}
$this->collOrderCouponsPartial = true;
$this->collCouponOrdersPartial = true;
}
$collOrderCoupons->getInternalIterator()->rewind();
$collCouponOrders->getInternalIterator()->rewind();
return $collOrderCoupons;
return $collCouponOrders;
}
if ($partial && $this->collOrderCoupons) {
foreach ($this->collOrderCoupons as $obj) {
if ($partial && $this->collCouponOrders) {
foreach ($this->collCouponOrders as $obj) {
if ($obj->isNew()) {
$collOrderCoupons[] = $obj;
$collCouponOrders[] = $obj;
}
}
}
$this->collOrderCoupons = $collOrderCoupons;
$this->collOrderCouponsPartial = false;
$this->collCouponOrders = $collCouponOrders;
$this->collCouponOrdersPartial = false;
}
}
return $this->collOrderCoupons;
return $this->collCouponOrders;
}
/**
* Sets a collection of OrderCoupon objects related by a one-to-many relationship
* Sets a collection of CouponOrder objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
* @param Collection $orderCoupons A Propel collection.
* @param Collection $couponOrders A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildOrder The current object (for fluent API support)
*/
public function setOrderCoupons(Collection $orderCoupons, ConnectionInterface $con = null)
public function setCouponOrders(Collection $couponOrders, ConnectionInterface $con = null)
{
$orderCouponsToDelete = $this->getOrderCoupons(new Criteria(), $con)->diff($orderCoupons);
$couponOrdersToDelete = $this->getCouponOrders(new Criteria(), $con)->diff($couponOrders);
$this->orderCouponsScheduledForDeletion = $orderCouponsToDelete;
$this->couponOrdersScheduledForDeletion = $couponOrdersToDelete;
foreach ($orderCouponsToDelete as $orderCouponRemoved) {
$orderCouponRemoved->setOrder(null);
foreach ($couponOrdersToDelete as $couponOrderRemoved) {
$couponOrderRemoved->setOrder(null);
}
$this->collOrderCoupons = null;
foreach ($orderCoupons as $orderCoupon) {
$this->addOrderCoupon($orderCoupon);
$this->collCouponOrders = null;
foreach ($couponOrders as $couponOrder) {
$this->addCouponOrder($couponOrder);
}
$this->collOrderCoupons = $orderCoupons;
$this->collOrderCouponsPartial = false;
$this->collCouponOrders = $couponOrders;
$this->collCouponOrdersPartial = false;
return $this;
}
/**
* Returns the number of related OrderCoupon objects.
* Returns the number of related CouponOrder objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related OrderCoupon objects.
* @return int Count of related CouponOrder objects.
* @throws PropelException
*/
public function countOrderCoupons(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
public function countCouponOrders(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collOrderCouponsPartial && !$this->isNew();
if (null === $this->collOrderCoupons || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collOrderCoupons) {
$partial = $this->collCouponOrdersPartial && !$this->isNew();
if (null === $this->collCouponOrders || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCouponOrders) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getOrderCoupons());
return count($this->getCouponOrders());
}
$query = ChildOrderCouponQuery::create(null, $criteria);
$query = ChildCouponOrderQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -3076,53 +3019,53 @@ abstract class Order implements ActiveRecordInterface
->count($con);
}
return count($this->collOrderCoupons);
return count($this->collCouponOrders);
}
/**
* Method called to associate a ChildOrderCoupon object to this object
* through the ChildOrderCoupon foreign key attribute.
* Method called to associate a ChildCouponOrder object to this object
* through the ChildCouponOrder foreign key attribute.
*
* @param ChildOrderCoupon $l ChildOrderCoupon
* @param ChildCouponOrder $l ChildCouponOrder
* @return \Thelia\Model\Order The current object (for fluent API support)
*/
public function addOrderCoupon(ChildOrderCoupon $l)
public function addCouponOrder(ChildCouponOrder $l)
{
if ($this->collOrderCoupons === null) {
$this->initOrderCoupons();
$this->collOrderCouponsPartial = true;
if ($this->collCouponOrders === null) {
$this->initCouponOrders();
$this->collCouponOrdersPartial = true;
}
if (!in_array($l, $this->collOrderCoupons->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddOrderCoupon($l);
if (!in_array($l, $this->collCouponOrders->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddCouponOrder($l);
}
return $this;
}
/**
* @param OrderCoupon $orderCoupon The orderCoupon object to add.
* @param CouponOrder $couponOrder The couponOrder object to add.
*/
protected function doAddOrderCoupon($orderCoupon)
protected function doAddCouponOrder($couponOrder)
{
$this->collOrderCoupons[]= $orderCoupon;
$orderCoupon->setOrder($this);
$this->collCouponOrders[]= $couponOrder;
$couponOrder->setOrder($this);
}
/**
* @param OrderCoupon $orderCoupon The orderCoupon object to remove.
* @param CouponOrder $couponOrder The couponOrder object to remove.
* @return ChildOrder The current object (for fluent API support)
*/
public function removeOrderCoupon($orderCoupon)
public function removeCouponOrder($couponOrder)
{
if ($this->getOrderCoupons()->contains($orderCoupon)) {
$this->collOrderCoupons->remove($this->collOrderCoupons->search($orderCoupon));
if (null === $this->orderCouponsScheduledForDeletion) {
$this->orderCouponsScheduledForDeletion = clone $this->collOrderCoupons;
$this->orderCouponsScheduledForDeletion->clear();
if ($this->getCouponOrders()->contains($couponOrder)) {
$this->collCouponOrders->remove($this->collCouponOrders->search($couponOrder));
if (null === $this->couponOrdersScheduledForDeletion) {
$this->couponOrdersScheduledForDeletion = clone $this->collCouponOrders;
$this->couponOrdersScheduledForDeletion->clear();
}
$this->orderCouponsScheduledForDeletion[]= clone $orderCoupon;
$orderCoupon->setOrder(null);
$this->couponOrdersScheduledForDeletion[]= clone $couponOrder;
$couponOrder->setOrder(null);
}
return $this;
@@ -3144,7 +3087,6 @@ abstract class Order implements ActiveRecordInterface
$this->transaction_ref = null;
$this->delivery_ref = null;
$this->invoice_ref = null;
$this->discount = null;
$this->postage = null;
$this->payment_module_id = null;
$this->delivery_module_id = null;
@@ -3176,8 +3118,8 @@ abstract class Order implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
if ($this->collOrderCoupons) {
foreach ($this->collOrderCoupons as $o) {
if ($this->collCouponOrders) {
foreach ($this->collCouponOrders as $o) {
$o->clearAllReferences($deep);
}
}
@@ -3187,10 +3129,10 @@ abstract class Order implements ActiveRecordInterface
$this->collOrderProducts->clearIterator();
}
$this->collOrderProducts = null;
if ($this->collOrderCoupons instanceof Collection) {
$this->collOrderCoupons->clearIterator();
if ($this->collCouponOrders instanceof Collection) {
$this->collCouponOrders->clearIterator();
}
$this->collOrderCoupons = null;
$this->collCouponOrders = null;
$this->aCurrency = null;
$this->aCustomer = null;
$this->aOrderAddressRelatedByInvoiceOrderAddressId = null;

View File

@@ -32,7 +32,6 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrderQuery orderByTransactionRef($order = Criteria::ASC) Order by the transaction_ref column
* @method ChildOrderQuery orderByDeliveryRef($order = Criteria::ASC) Order by the delivery_ref column
* @method ChildOrderQuery orderByInvoiceRef($order = Criteria::ASC) Order by the invoice_ref column
* @method ChildOrderQuery orderByDiscount($order = Criteria::ASC) Order by the discount column
* @method ChildOrderQuery orderByPostage($order = Criteria::ASC) Order by the postage column
* @method ChildOrderQuery orderByPaymentModuleId($order = Criteria::ASC) Order by the payment_module_id column
* @method ChildOrderQuery orderByDeliveryModuleId($order = Criteria::ASC) Order by the delivery_module_id column
@@ -52,7 +51,6 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrderQuery groupByTransactionRef() Group by the transaction_ref column
* @method ChildOrderQuery groupByDeliveryRef() Group by the delivery_ref column
* @method ChildOrderQuery groupByInvoiceRef() Group by the invoice_ref column
* @method ChildOrderQuery groupByDiscount() Group by the discount column
* @method ChildOrderQuery groupByPostage() Group by the postage column
* @method ChildOrderQuery groupByPaymentModuleId() Group by the payment_module_id column
* @method ChildOrderQuery groupByDeliveryModuleId() Group by the delivery_module_id column
@@ -101,9 +99,9 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrderQuery rightJoinOrderProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderProduct relation
* @method ChildOrderQuery innerJoinOrderProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderProduct relation
*
* @method ChildOrderQuery leftJoinOrderCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderCoupon relation
* @method ChildOrderQuery rightJoinOrderCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderCoupon relation
* @method ChildOrderQuery innerJoinOrderCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderCoupon relation
* @method ChildOrderQuery leftJoinCouponOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponOrder relation
* @method ChildOrderQuery rightJoinCouponOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponOrder relation
* @method ChildOrderQuery innerJoinCouponOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponOrder relation
*
* @method ChildOrder findOne(ConnectionInterface $con = null) Return the first ChildOrder matching the query
* @method ChildOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrder matching the query, or a new ChildOrder object populated from the query conditions when no match is found
@@ -119,7 +117,6 @@ use Thelia\Model\Map\OrderTableMap;
* @method ChildOrder findOneByTransactionRef(string $transaction_ref) Return the first ChildOrder filtered by the transaction_ref column
* @method ChildOrder findOneByDeliveryRef(string $delivery_ref) Return the first ChildOrder filtered by the delivery_ref column
* @method ChildOrder findOneByInvoiceRef(string $invoice_ref) Return the first ChildOrder filtered by the invoice_ref column
* @method ChildOrder findOneByDiscount(double $discount) Return the first ChildOrder filtered by the discount column
* @method ChildOrder findOneByPostage(double $postage) Return the first ChildOrder filtered by the postage column
* @method ChildOrder findOneByPaymentModuleId(int $payment_module_id) Return the first ChildOrder filtered by the payment_module_id column
* @method ChildOrder findOneByDeliveryModuleId(int $delivery_module_id) Return the first ChildOrder filtered by the delivery_module_id column
@@ -139,7 +136,6 @@ use Thelia\Model\Map\OrderTableMap;
* @method array findByTransactionRef(string $transaction_ref) Return ChildOrder objects filtered by the transaction_ref column
* @method array findByDeliveryRef(string $delivery_ref) Return ChildOrder objects filtered by the delivery_ref column
* @method array findByInvoiceRef(string $invoice_ref) Return ChildOrder objects filtered by the invoice_ref column
* @method array findByDiscount(double $discount) Return ChildOrder objects filtered by the discount column
* @method array findByPostage(double $postage) Return ChildOrder objects filtered by the postage column
* @method array findByPaymentModuleId(int $payment_module_id) Return ChildOrder objects filtered by the payment_module_id column
* @method array findByDeliveryModuleId(int $delivery_module_id) Return ChildOrder objects filtered by the delivery_module_id column
@@ -235,7 +231,7 @@ abstract class OrderQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, REF, CUSTOMER_ID, INVOICE_ORDER_ADDRESS_ID, DELIVERY_ORDER_ADDRESS_ID, INVOICE_DATE, CURRENCY_ID, CURRENCY_RATE, TRANSACTION_REF, DELIVERY_REF, INVOICE_REF, DISCOUNT, POSTAGE, PAYMENT_MODULE_ID, DELIVERY_MODULE_ID, STATUS_ID, LANG_ID, CREATED_AT, UPDATED_AT FROM order WHERE ID = :p0';
$sql = 'SELECT ID, REF, CUSTOMER_ID, INVOICE_ORDER_ADDRESS_ID, DELIVERY_ORDER_ADDRESS_ID, INVOICE_DATE, CURRENCY_ID, CURRENCY_RATE, TRANSACTION_REF, DELIVERY_REF, INVOICE_REF, POSTAGE, PAYMENT_MODULE_ID, DELIVERY_MODULE_ID, STATUS_ID, LANG_ID, CREATED_AT, UPDATED_AT FROM order WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -737,47 +733,6 @@ abstract class OrderQuery extends ModelCriteria
return $this->addUsingAlias(OrderTableMap::INVOICE_REF, $invoiceRef, $comparison);
}
/**
* Filter the query on the discount column
*
* Example usage:
* <code>
* $query->filterByDiscount(1234); // WHERE discount = 1234
* $query->filterByDiscount(array(12, 34)); // WHERE discount IN (12, 34)
* $query->filterByDiscount(array('min' => 12)); // WHERE discount > 12
* </code>
*
* @param mixed $discount The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderQuery The current query, for fluid interface
*/
public function filterByDiscount($discount = null, $comparison = null)
{
if (is_array($discount)) {
$useMinMax = false;
if (isset($discount['min'])) {
$this->addUsingAlias(OrderTableMap::DISCOUNT, $discount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($discount['max'])) {
$this->addUsingAlias(OrderTableMap::DISCOUNT, $discount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(OrderTableMap::DISCOUNT, $discount, $comparison);
}
/**
* Filter the query on the postage column
*
@@ -1751,40 +1706,40 @@ abstract class OrderQuery extends ModelCriteria
}
/**
* Filter the query by a related \Thelia\Model\OrderCoupon object
* Filter the query by a related \Thelia\Model\CouponOrder object
*
* @param \Thelia\Model\OrderCoupon|ObjectCollection $orderCoupon the related object to use as filter
* @param \Thelia\Model\CouponOrder|ObjectCollection $couponOrder the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildOrderQuery The current query, for fluid interface
*/
public function filterByOrderCoupon($orderCoupon, $comparison = null)
public function filterByCouponOrder($couponOrder, $comparison = null)
{
if ($orderCoupon instanceof \Thelia\Model\OrderCoupon) {
if ($couponOrder instanceof \Thelia\Model\CouponOrder) {
return $this
->addUsingAlias(OrderTableMap::ID, $orderCoupon->getOrderId(), $comparison);
} elseif ($orderCoupon instanceof ObjectCollection) {
->addUsingAlias(OrderTableMap::ID, $couponOrder->getOrderId(), $comparison);
} elseif ($couponOrder instanceof ObjectCollection) {
return $this
->useOrderCouponQuery()
->filterByPrimaryKeys($orderCoupon->getPrimaryKeys())
->useCouponOrderQuery()
->filterByPrimaryKeys($couponOrder->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByOrderCoupon() only accepts arguments of type \Thelia\Model\OrderCoupon or Collection');
throw new PropelException('filterByCouponOrder() only accepts arguments of type \Thelia\Model\CouponOrder or Collection');
}
}
/**
* Adds a JOIN clause to the query using the OrderCoupon relation
* Adds a JOIN clause to the query using the CouponOrder relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildOrderQuery The current query, for fluid interface
*/
public function joinOrderCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function joinCouponOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('OrderCoupon');
$relationMap = $tableMap->getRelation('CouponOrder');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -1799,14 +1754,14 @@ abstract class OrderQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'OrderCoupon');
$this->addJoinObject($join, 'CouponOrder');
}
return $this;
}
/**
* Use the OrderCoupon relation OrderCoupon object
* Use the CouponOrder relation CouponOrder object
*
* @see useQuery()
*
@@ -1814,13 +1769,13 @@ abstract class OrderQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return \Thelia\Model\OrderCouponQuery A secondary query class using the current class as primary query
* @return \Thelia\Model\CouponOrderQuery A secondary query class using the current class as primary query
*/
public function useOrderCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
public function useCouponOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinOrderCoupon($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'OrderCoupon', '\Thelia\Model\OrderCouponQuery');
->joinCouponOrder($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CouponOrder', '\Thelia\Model\CouponOrderQuery');
}
/**

View File

@@ -83,6 +83,7 @@ class Cart extends BaseCart
foreach($this->getCartItems() as $cartItem) {
$subtotal = $cartItem->getRealPrice();
$subtotal -= $cartItem->getDiscount();
/* we round it for the unit price, before the quantity factor */
$subtotal = round($taxCalculator->load($cartItem->getProduct(), $country)->getTaxedPrice($subtotal), 2);
$subtotal *= $cartItem->getQuantity();
@@ -101,6 +102,7 @@ class Cart extends BaseCart
foreach($this->getCartItems() as $cartItem) {
$subtotal = $cartItem->getRealPrice();
$subtotal -= $cartItem->getDiscount();
$subtotal *= $cartItem->getQuantity();
$total += $subtotal;

View File

@@ -0,0 +1,9 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\CouponOrder as BaseCouponOrder;
class CouponOrder extends BaseCouponOrder {
}

View File

@@ -2,11 +2,11 @@
namespace Thelia\Model;
use Thelia\Model\Base\OrderCouponQuery as BaseOrderCouponQuery;
use Thelia\Model\Base\CouponOrderQuery as BaseCouponOrderQuery;
/**
* Skeleton subclass for performing query and update operations on the 'order_coupon' table.
* Skeleton subclass for performing query and update operations on the 'coupon_order' table.
*
*
*
@@ -15,7 +15,6 @@ use Thelia\Model\Base\OrderCouponQuery as BaseOrderCouponQuery;
* long as it does not already exist in the output directory.
*
*/
class OrderCouponQuery extends BaseOrderCouponQuery
{
class CouponOrderQuery extends BaseCouponOrderQuery {
} // OrderCouponQuery
} // CouponOrderQuery

View File

@@ -57,7 +57,7 @@ class CartItemTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 11;
const NUM_COLUMNS = 12;
/**
* 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 = 11;
const NUM_HYDRATE_COLUMNS = 12;
/**
* the column name for the ID field
@@ -109,6 +109,11 @@ class CartItemTableMap extends TableMap
*/
const PRICE_END_OF_LIFE = 'cart_item.PRICE_END_OF_LIFE';
/**
* the column name for the DISCOUNT field
*/
const DISCOUNT = 'cart_item.DISCOUNT';
/**
* the column name for the PROMO field
*/
@@ -136,12 +141,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', 'Price', 'PromoPrice', 'PriceEndOfLife', 'Promo', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', 'promo', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(CartItemTableMap::ID, CartItemTableMap::CART_ID, CartItemTableMap::PRODUCT_ID, CartItemTableMap::QUANTITY, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, CartItemTableMap::PRICE, CartItemTableMap::PROMO_PRICE, CartItemTableMap::PRICE_END_OF_LIFE, CartItemTableMap::PROMO, CartItemTableMap::CREATED_AT, CartItemTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'CART_ID', 'PRODUCT_ID', 'QUANTITY', 'PRODUCT_SALE_ELEMENTS_ID', 'PRICE', 'PROMO_PRICE', 'PRICE_END_OF_LIFE', 'PROMO', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'cart_id', 'product_id', 'quantity', 'product_sale_elements_id', 'price', 'promo_price', 'price_end_of_life', 'promo', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
self::TYPE_PHPNAME => array('Id', 'CartId', 'ProductId', 'Quantity', 'ProductSaleElementsId', 'Price', 'PromoPrice', 'PriceEndOfLife', 'Discount', 'Promo', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'cartId', 'productId', 'quantity', 'productSaleElementsId', 'price', 'promoPrice', 'priceEndOfLife', 'discount', 'promo', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(CartItemTableMap::ID, CartItemTableMap::CART_ID, CartItemTableMap::PRODUCT_ID, CartItemTableMap::QUANTITY, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID, CartItemTableMap::PRICE, CartItemTableMap::PROMO_PRICE, CartItemTableMap::PRICE_END_OF_LIFE, CartItemTableMap::DISCOUNT, CartItemTableMap::PROMO, CartItemTableMap::CREATED_AT, CartItemTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'CART_ID', 'PRODUCT_ID', 'QUANTITY', 'PRODUCT_SALE_ELEMENTS_ID', 'PRICE', 'PROMO_PRICE', 'PRICE_END_OF_LIFE', 'DISCOUNT', 'PROMO', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'cart_id', 'product_id', 'quantity', 'product_sale_elements_id', 'price', 'promo_price', 'price_end_of_life', 'discount', 'promo', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -151,12 +156,12 @@ class CartItemTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'Promo' => 8, 'CreatedAt' => 9, 'UpdatedAt' => 10, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'promo' => 8, 'createdAt' => 9, 'updatedAt' => 10, ),
self::TYPE_COLNAME => array(CartItemTableMap::ID => 0, CartItemTableMap::CART_ID => 1, CartItemTableMap::PRODUCT_ID => 2, CartItemTableMap::QUANTITY => 3, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID => 4, CartItemTableMap::PRICE => 5, CartItemTableMap::PROMO_PRICE => 6, CartItemTableMap::PRICE_END_OF_LIFE => 7, CartItemTableMap::PROMO => 8, CartItemTableMap::CREATED_AT => 9, CartItemTableMap::UPDATED_AT => 10, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CART_ID' => 1, 'PRODUCT_ID' => 2, 'QUANTITY' => 3, 'PRODUCT_SALE_ELEMENTS_ID' => 4, 'PRICE' => 5, 'PROMO_PRICE' => 6, 'PRICE_END_OF_LIFE' => 7, 'PROMO' => 8, 'CREATED_AT' => 9, 'UPDATED_AT' => 10, ),
self::TYPE_FIELDNAME => array('id' => 0, 'cart_id' => 1, 'product_id' => 2, 'quantity' => 3, 'product_sale_elements_id' => 4, 'price' => 5, 'promo_price' => 6, 'price_end_of_life' => 7, 'promo' => 8, 'created_at' => 9, 'updated_at' => 10, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
self::TYPE_PHPNAME => array('Id' => 0, 'CartId' => 1, 'ProductId' => 2, 'Quantity' => 3, 'ProductSaleElementsId' => 4, 'Price' => 5, 'PromoPrice' => 6, 'PriceEndOfLife' => 7, 'Discount' => 8, 'Promo' => 9, 'CreatedAt' => 10, 'UpdatedAt' => 11, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'cartId' => 1, 'productId' => 2, 'quantity' => 3, 'productSaleElementsId' => 4, 'price' => 5, 'promoPrice' => 6, 'priceEndOfLife' => 7, 'discount' => 8, 'promo' => 9, 'createdAt' => 10, 'updatedAt' => 11, ),
self::TYPE_COLNAME => array(CartItemTableMap::ID => 0, CartItemTableMap::CART_ID => 1, CartItemTableMap::PRODUCT_ID => 2, CartItemTableMap::QUANTITY => 3, CartItemTableMap::PRODUCT_SALE_ELEMENTS_ID => 4, CartItemTableMap::PRICE => 5, CartItemTableMap::PROMO_PRICE => 6, CartItemTableMap::PRICE_END_OF_LIFE => 7, CartItemTableMap::DISCOUNT => 8, CartItemTableMap::PROMO => 9, CartItemTableMap::CREATED_AT => 10, CartItemTableMap::UPDATED_AT => 11, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CART_ID' => 1, 'PRODUCT_ID' => 2, 'QUANTITY' => 3, 'PRODUCT_SALE_ELEMENTS_ID' => 4, 'PRICE' => 5, 'PROMO_PRICE' => 6, 'PRICE_END_OF_LIFE' => 7, 'DISCOUNT' => 8, 'PROMO' => 9, 'CREATED_AT' => 10, 'UPDATED_AT' => 11, ),
self::TYPE_FIELDNAME => array('id' => 0, 'cart_id' => 1, 'product_id' => 2, 'quantity' => 3, 'product_sale_elements_id' => 4, 'price' => 5, 'promo_price' => 6, 'price_end_of_life' => 7, 'discount' => 8, 'promo' => 9, 'created_at' => 10, 'updated_at' => 11, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -183,6 +188,7 @@ class CartItemTableMap extends TableMap
$this->addColumn('PRICE', 'Price', 'FLOAT', false, null, null);
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null);
$this->addColumn('PRICE_END_OF_LIFE', 'PriceEndOfLife', 'TIMESTAMP', false, null, null);
$this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, 0);
$this->addColumn('PROMO', 'Promo', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
@@ -357,6 +363,7 @@ class CartItemTableMap extends TableMap
$criteria->addSelectColumn(CartItemTableMap::PRICE);
$criteria->addSelectColumn(CartItemTableMap::PROMO_PRICE);
$criteria->addSelectColumn(CartItemTableMap::PRICE_END_OF_LIFE);
$criteria->addSelectColumn(CartItemTableMap::DISCOUNT);
$criteria->addSelectColumn(CartItemTableMap::PROMO);
$criteria->addSelectColumn(CartItemTableMap::CREATED_AT);
$criteria->addSelectColumn(CartItemTableMap::UPDATED_AT);
@@ -369,6 +376,7 @@ class CartItemTableMap extends TableMap
$criteria->addSelectColumn($alias . '.PRICE');
$criteria->addSelectColumn($alias . '.PROMO_PRICE');
$criteria->addSelectColumn($alias . '.PRICE_END_OF_LIFE');
$criteria->addSelectColumn($alias . '.DISCOUNT');
$criteria->addSelectColumn($alias . '.PROMO');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');

View File

@@ -10,12 +10,12 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\OrderCoupon;
use Thelia\Model\OrderCouponQuery;
use Thelia\Model\CouponOrder;
use Thelia\Model\CouponOrderQuery;
/**
* This class defines the structure of the 'order_coupon' table.
* This class defines the structure of the 'coupon_order' table.
*
*
*
@@ -25,14 +25,14 @@ use Thelia\Model\OrderCouponQuery;
* (i.e. if it's a text column type).
*
*/
class OrderCouponTableMap extends TableMap
class CouponOrderTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'Thelia.Model.Map.OrderCouponTableMap';
const CLASS_NAME = 'Thelia.Model.Map.CouponOrderTableMap';
/**
* The default database name for this class
@@ -42,22 +42,22 @@ class OrderCouponTableMap extends TableMap
/**
* The table name for this class
*/
const TABLE_NAME = 'order_coupon';
const TABLE_NAME = 'coupon_order';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\Thelia\\Model\\OrderCoupon';
const OM_CLASS = '\\Thelia\\Model\\CouponOrder';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'Thelia.Model.OrderCoupon';
const CLASS_DEFAULT = 'Thelia.Model.CouponOrder';
/**
* The total number of columns
*/
const NUM_COLUMNS = 15;
const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
@@ -67,82 +67,32 @@ class OrderCouponTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 15;
const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the ID field
*/
const ID = 'order_coupon.ID';
const ID = 'coupon_order.ID';
/**
* the column name for the ORDER_ID field
*/
const ORDER_ID = 'order_coupon.ORDER_ID';
const ORDER_ID = 'coupon_order.ORDER_ID';
/**
* the column name for the CODE field
* the column name for the VALUE field
*/
const CODE = 'order_coupon.CODE';
/**
* the column name for the TYPE field
*/
const TYPE = 'order_coupon.TYPE';
/**
* the column name for the AMOUNT field
*/
const AMOUNT = 'order_coupon.AMOUNT';
/**
* the column name for the TITLE field
*/
const TITLE = 'order_coupon.TITLE';
/**
* the column name for the SHORT_DESCRIPTION field
*/
const SHORT_DESCRIPTION = 'order_coupon.SHORT_DESCRIPTION';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'order_coupon.DESCRIPTION';
/**
* the column name for the EXPIRATION_DATE field
*/
const EXPIRATION_DATE = 'order_coupon.EXPIRATION_DATE';
/**
* the column name for the IS_CUMULATIVE field
*/
const IS_CUMULATIVE = 'order_coupon.IS_CUMULATIVE';
/**
* the column name for the IS_REMOVING_POSTAGE field
*/
const IS_REMOVING_POSTAGE = 'order_coupon.IS_REMOVING_POSTAGE';
/**
* the column name for the IS_AVAILABLE_ON_SPECIAL_OFFERS field
*/
const IS_AVAILABLE_ON_SPECIAL_OFFERS = 'order_coupon.IS_AVAILABLE_ON_SPECIAL_OFFERS';
/**
* the column name for the SERIALIZED_CONDITIONS field
*/
const SERIALIZED_CONDITIONS = 'order_coupon.SERIALIZED_CONDITIONS';
const VALUE = 'coupon_order.VALUE';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'order_coupon.CREATED_AT';
const CREATED_AT = 'coupon_order.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'order_coupon.UPDATED_AT';
const UPDATED_AT = 'coupon_order.UPDATED_AT';
/**
* The default string format for model objects of the related table
@@ -156,12 +106,12 @@ class OrderCouponTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'OrderId', 'Code', 'Type', 'Amount', 'Title', 'ShortDescription', 'Description', 'ExpirationDate', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'SerializedConditions', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'code', 'type', 'amount', 'title', 'shortDescription', 'description', 'expirationDate', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'serializedConditions', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(OrderCouponTableMap::ID, OrderCouponTableMap::ORDER_ID, OrderCouponTableMap::CODE, OrderCouponTableMap::TYPE, OrderCouponTableMap::AMOUNT, OrderCouponTableMap::TITLE, OrderCouponTableMap::SHORT_DESCRIPTION, OrderCouponTableMap::DESCRIPTION, OrderCouponTableMap::EXPIRATION_DATE, OrderCouponTableMap::IS_CUMULATIVE, OrderCouponTableMap::IS_REMOVING_POSTAGE, OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, OrderCouponTableMap::SERIALIZED_CONDITIONS, OrderCouponTableMap::CREATED_AT, OrderCouponTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'CODE', 'TYPE', 'AMOUNT', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'EXPIRATION_DATE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'SERIALIZED_CONDITIONS', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'order_id', 'code', 'type', 'amount', 'title', 'short_description', 'description', 'expiration_date', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'serialized_conditions', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
self::TYPE_PHPNAME => array('Id', 'OrderId', 'Value', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'value', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'order_id', 'value', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -171,12 +121,12 @@ class OrderCouponTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Code' => 2, 'Type' => 3, 'Amount' => 4, 'Title' => 5, 'ShortDescription' => 6, 'Description' => 7, 'ExpirationDate' => 8, 'IsCumulative' => 9, 'IsRemovingPostage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'SerializedConditions' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'code' => 2, 'type' => 3, 'amount' => 4, 'title' => 5, 'shortDescription' => 6, 'description' => 7, 'expirationDate' => 8, 'isCumulative' => 9, 'isRemovingPostage' => 10, 'isAvailableOnSpecialOffers' => 11, 'serializedConditions' => 12, 'createdAt' => 13, 'updatedAt' => 14, ),
self::TYPE_COLNAME => array(OrderCouponTableMap::ID => 0, OrderCouponTableMap::ORDER_ID => 1, OrderCouponTableMap::CODE => 2, OrderCouponTableMap::TYPE => 3, OrderCouponTableMap::AMOUNT => 4, OrderCouponTableMap::TITLE => 5, OrderCouponTableMap::SHORT_DESCRIPTION => 6, OrderCouponTableMap::DESCRIPTION => 7, OrderCouponTableMap::EXPIRATION_DATE => 8, OrderCouponTableMap::IS_CUMULATIVE => 9, OrderCouponTableMap::IS_REMOVING_POSTAGE => 10, OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, OrderCouponTableMap::SERIALIZED_CONDITIONS => 12, OrderCouponTableMap::CREATED_AT => 13, OrderCouponTableMap::UPDATED_AT => 14, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'CODE' => 2, 'TYPE' => 3, 'AMOUNT' => 4, 'TITLE' => 5, 'SHORT_DESCRIPTION' => 6, 'DESCRIPTION' => 7, 'EXPIRATION_DATE' => 8, 'IS_CUMULATIVE' => 9, 'IS_REMOVING_POSTAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'SERIALIZED_CONDITIONS' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, ),
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'code' => 2, 'type' => 3, 'amount' => 4, 'title' => 5, 'short_description' => 6, 'description' => 7, 'expiration_date' => 8, 'is_cumulative' => 9, 'is_removing_postage' => 10, 'is_available_on_special_offers' => 11, 'serialized_conditions' => 12, 'created_at' => 13, 'updated_at' => 14, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Value' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'value' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::VALUE => 2, CouponOrderTableMap::CREATED_AT => 3, CouponOrderTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'VALUE' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'value' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -189,25 +139,15 @@ class OrderCouponTableMap extends TableMap
public function initialize()
{
// attributes
$this->setName('order_coupon');
$this->setPhpName('OrderCoupon');
$this->setClassName('\\Thelia\\Model\\OrderCoupon');
$this->setName('coupon_order');
$this->setPhpName('CouponOrder');
$this->setClassName('\\Thelia\\Model\\CouponOrder');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null);
$this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null);
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
$this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null);
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null);
$this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null);
$this->addColumn('IS_CUMULATIVE', 'IsCumulative', 'BOOLEAN', true, 1, null);
$this->addColumn('IS_REMOVING_POSTAGE', 'IsRemovingPostage', 'BOOLEAN', true, 1, null);
$this->addColumn('IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IsAvailableOnSpecialOffers', 'BOOLEAN', true, 1, null);
$this->addColumn('SERIALIZED_CONDITIONS', 'SerializedConditions', 'LONGVARCHAR', true, null, null);
$this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -289,7 +229,7 @@ class OrderCouponTableMap extends TableMap
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? OrderCouponTableMap::CLASS_DEFAULT : OrderCouponTableMap::OM_CLASS;
return $withPrefix ? CouponOrderTableMap::CLASS_DEFAULT : CouponOrderTableMap::OM_CLASS;
}
/**
@@ -303,21 +243,21 @@ class OrderCouponTableMap extends TableMap
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (OrderCoupon object, last column rank)
* @return array (CouponOrder object, last column rank)
*/
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{
$key = OrderCouponTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = OrderCouponTableMap::getInstanceFromPool($key))) {
$key = CouponOrderTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = CouponOrderTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $offset, true); // rehydrate
$col = $offset + OrderCouponTableMap::NUM_HYDRATE_COLUMNS;
$col = $offset + CouponOrderTableMap::NUM_HYDRATE_COLUMNS;
} else {
$cls = OrderCouponTableMap::OM_CLASS;
$cls = CouponOrderTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
OrderCouponTableMap::addInstanceToPool($obj, $key);
CouponOrderTableMap::addInstanceToPool($obj, $key);
}
return array($obj, $col);
@@ -340,8 +280,8 @@ class OrderCouponTableMap extends TableMap
$cls = static::getOMClass(false);
// populate the object(s)
while ($row = $dataFetcher->fetch()) {
$key = OrderCouponTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = OrderCouponTableMap::getInstanceFromPool($key))) {
$key = CouponOrderTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = CouponOrderTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate
@@ -350,7 +290,7 @@ class OrderCouponTableMap extends TableMap
$obj = new $cls();
$obj->hydrate($row);
$results[] = $obj;
OrderCouponTableMap::addInstanceToPool($obj, $key);
CouponOrderTableMap::addInstanceToPool($obj, $key);
} // if key exists
}
@@ -371,35 +311,15 @@ class OrderCouponTableMap extends TableMap
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(OrderCouponTableMap::ID);
$criteria->addSelectColumn(OrderCouponTableMap::ORDER_ID);
$criteria->addSelectColumn(OrderCouponTableMap::CODE);
$criteria->addSelectColumn(OrderCouponTableMap::TYPE);
$criteria->addSelectColumn(OrderCouponTableMap::AMOUNT);
$criteria->addSelectColumn(OrderCouponTableMap::TITLE);
$criteria->addSelectColumn(OrderCouponTableMap::SHORT_DESCRIPTION);
$criteria->addSelectColumn(OrderCouponTableMap::DESCRIPTION);
$criteria->addSelectColumn(OrderCouponTableMap::EXPIRATION_DATE);
$criteria->addSelectColumn(OrderCouponTableMap::IS_CUMULATIVE);
$criteria->addSelectColumn(OrderCouponTableMap::IS_REMOVING_POSTAGE);
$criteria->addSelectColumn(OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS);
$criteria->addSelectColumn(OrderCouponTableMap::SERIALIZED_CONDITIONS);
$criteria->addSelectColumn(OrderCouponTableMap::CREATED_AT);
$criteria->addSelectColumn(OrderCouponTableMap::UPDATED_AT);
$criteria->addSelectColumn(CouponOrderTableMap::ID);
$criteria->addSelectColumn(CouponOrderTableMap::ORDER_ID);
$criteria->addSelectColumn(CouponOrderTableMap::VALUE);
$criteria->addSelectColumn(CouponOrderTableMap::CREATED_AT);
$criteria->addSelectColumn(CouponOrderTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.ORDER_ID');
$criteria->addSelectColumn($alias . '.CODE');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.AMOUNT');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.EXPIRATION_DATE');
$criteria->addSelectColumn($alias . '.IS_CUMULATIVE');
$criteria->addSelectColumn($alias . '.IS_REMOVING_POSTAGE');
$criteria->addSelectColumn($alias . '.IS_AVAILABLE_ON_SPECIAL_OFFERS');
$criteria->addSelectColumn($alias . '.SERIALIZED_CONDITIONS');
$criteria->addSelectColumn($alias . '.VALUE');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
@@ -414,7 +334,7 @@ class OrderCouponTableMap extends TableMap
*/
public static function getTableMap()
{
return Propel::getServiceContainer()->getDatabaseMap(OrderCouponTableMap::DATABASE_NAME)->getTable(OrderCouponTableMap::TABLE_NAME);
return Propel::getServiceContainer()->getDatabaseMap(CouponOrderTableMap::DATABASE_NAME)->getTable(CouponOrderTableMap::TABLE_NAME);
}
/**
@@ -422,16 +342,16 @@ class OrderCouponTableMap extends TableMap
*/
public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderCouponTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(OrderCouponTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new OrderCouponTableMap());
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponOrderTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(CouponOrderTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new CouponOrderTableMap());
}
}
/**
* Performs a DELETE on the database, given a OrderCoupon or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CouponOrder or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or OrderCoupon object or primary key or array of primary keys
* @param mixed $values Criteria or CouponOrder object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
@@ -442,25 +362,25 @@ class OrderCouponTableMap extends TableMap
public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponTableMap::DATABASE_NAME);
$con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \Thelia\Model\OrderCoupon) { // it's a model object
} elseif ($values instanceof \Thelia\Model\CouponOrder) { // it's a model object
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(OrderCouponTableMap::DATABASE_NAME);
$criteria->add(OrderCouponTableMap::ID, (array) $values, Criteria::IN);
$criteria = new Criteria(CouponOrderTableMap::DATABASE_NAME);
$criteria->add(CouponOrderTableMap::ID, (array) $values, Criteria::IN);
}
$query = OrderCouponQuery::create()->mergeWith($criteria);
$query = CouponOrderQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { OrderCouponTableMap::clearInstancePool();
if ($values instanceof Criteria) { CouponOrderTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { OrderCouponTableMap::removeInstanceFromPool($singleval);
foreach ((array) $values as $singleval) { CouponOrderTableMap::removeInstanceFromPool($singleval);
}
}
@@ -468,20 +388,20 @@ class OrderCouponTableMap extends TableMap
}
/**
* Deletes all rows from the order_coupon table.
* Deletes all rows from the coupon_order table.
*
* @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll(ConnectionInterface $con = null)
{
return OrderCouponQuery::create()->doDeleteAll($con);
return CouponOrderQuery::create()->doDeleteAll($con);
}
/**
* Performs an INSERT on the database, given a OrderCoupon or Criteria object.
* Performs an INSERT on the database, given a CouponOrder or Criteria object.
*
* @param mixed $criteria Criteria or OrderCoupon object containing data that is used to create the INSERT statement.
* @param mixed $criteria Criteria or CouponOrder object containing data that is used to create the INSERT statement.
* @param ConnectionInterface $con the ConnectionInterface connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
@@ -490,22 +410,22 @@ class OrderCouponTableMap extends TableMap
public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderCouponTableMap::DATABASE_NAME);
$con = Propel::getServiceContainer()->getWriteConnection(CouponOrderTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} else {
$criteria = $criteria->buildCriteria(); // build Criteria from OrderCoupon object
$criteria = $criteria->buildCriteria(); // build Criteria from CouponOrder object
}
if ($criteria->containsKey(OrderCouponTableMap::ID) && $criteria->keyContainsValue(OrderCouponTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.OrderCouponTableMap::ID.')');
if ($criteria->containsKey(CouponOrderTableMap::ID) && $criteria->keyContainsValue(CouponOrderTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CouponOrderTableMap::ID.')');
}
// Set the correct dbName
$query = OrderCouponQuery::create()->mergeWith($criteria);
$query = CouponOrderQuery::create()->mergeWith($criteria);
try {
// use transaction because $criteria could contain info
@@ -521,7 +441,7 @@ class OrderCouponTableMap extends TableMap
return $pk;
}
} // OrderCouponTableMap
} // CouponOrderTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
OrderCouponTableMap::buildTableMap();
CouponOrderTableMap::buildTableMap();

View File

@@ -57,7 +57,7 @@ class OrderTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 19;
const NUM_COLUMNS = 18;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class OrderTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 19;
const NUM_HYDRATE_COLUMNS = 18;
/**
* the column name for the ID field
@@ -124,11 +124,6 @@ class OrderTableMap extends TableMap
*/
const INVOICE_REF = 'order.INVOICE_REF';
/**
* the column name for the DISCOUNT field
*/
const DISCOUNT = 'order.DISCOUNT';
/**
* the column name for the POSTAGE field
*/
@@ -176,12 +171,12 @@ class OrderTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Ref', 'CustomerId', 'InvoiceOrderAddressId', 'DeliveryOrderAddressId', 'InvoiceDate', 'CurrencyId', 'CurrencyRate', 'TransactionRef', 'DeliveryRef', 'InvoiceRef', 'Discount', 'Postage', 'PaymentModuleId', 'DeliveryModuleId', 'StatusId', 'LangId', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'customerId', 'invoiceOrderAddressId', 'deliveryOrderAddressId', 'invoiceDate', 'currencyId', 'currencyRate', 'transactionRef', 'deliveryRef', 'invoiceRef', 'discount', 'postage', 'paymentModuleId', 'deliveryModuleId', 'statusId', 'langId', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(OrderTableMap::ID, OrderTableMap::REF, OrderTableMap::CUSTOMER_ID, OrderTableMap::INVOICE_ORDER_ADDRESS_ID, OrderTableMap::DELIVERY_ORDER_ADDRESS_ID, OrderTableMap::INVOICE_DATE, OrderTableMap::CURRENCY_ID, OrderTableMap::CURRENCY_RATE, OrderTableMap::TRANSACTION_REF, OrderTableMap::DELIVERY_REF, OrderTableMap::INVOICE_REF, OrderTableMap::DISCOUNT, OrderTableMap::POSTAGE, OrderTableMap::PAYMENT_MODULE_ID, OrderTableMap::DELIVERY_MODULE_ID, OrderTableMap::STATUS_ID, OrderTableMap::LANG_ID, OrderTableMap::CREATED_AT, OrderTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'REF', 'CUSTOMER_ID', 'INVOICE_ORDER_ADDRESS_ID', 'DELIVERY_ORDER_ADDRESS_ID', 'INVOICE_DATE', 'CURRENCY_ID', 'CURRENCY_RATE', 'TRANSACTION_REF', 'DELIVERY_REF', 'INVOICE_REF', 'DISCOUNT', 'POSTAGE', 'PAYMENT_MODULE_ID', 'DELIVERY_MODULE_ID', 'STATUS_ID', 'LANG_ID', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'ref', 'customer_id', 'invoice_order_address_id', 'delivery_order_address_id', 'invoice_date', 'currency_id', 'currency_rate', 'transaction_ref', 'delivery_ref', 'invoice_ref', 'discount', 'postage', 'payment_module_id', 'delivery_module_id', 'status_id', 'lang_id', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, )
self::TYPE_PHPNAME => array('Id', 'Ref', 'CustomerId', 'InvoiceOrderAddressId', 'DeliveryOrderAddressId', 'InvoiceDate', 'CurrencyId', 'CurrencyRate', 'TransactionRef', 'DeliveryRef', 'InvoiceRef', 'Postage', 'PaymentModuleId', 'DeliveryModuleId', 'StatusId', 'LangId', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'ref', 'customerId', 'invoiceOrderAddressId', 'deliveryOrderAddressId', 'invoiceDate', 'currencyId', 'currencyRate', 'transactionRef', 'deliveryRef', 'invoiceRef', 'postage', 'paymentModuleId', 'deliveryModuleId', 'statusId', 'langId', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(OrderTableMap::ID, OrderTableMap::REF, OrderTableMap::CUSTOMER_ID, OrderTableMap::INVOICE_ORDER_ADDRESS_ID, OrderTableMap::DELIVERY_ORDER_ADDRESS_ID, OrderTableMap::INVOICE_DATE, OrderTableMap::CURRENCY_ID, OrderTableMap::CURRENCY_RATE, OrderTableMap::TRANSACTION_REF, OrderTableMap::DELIVERY_REF, OrderTableMap::INVOICE_REF, OrderTableMap::POSTAGE, OrderTableMap::PAYMENT_MODULE_ID, OrderTableMap::DELIVERY_MODULE_ID, OrderTableMap::STATUS_ID, OrderTableMap::LANG_ID, OrderTableMap::CREATED_AT, OrderTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'REF', 'CUSTOMER_ID', 'INVOICE_ORDER_ADDRESS_ID', 'DELIVERY_ORDER_ADDRESS_ID', 'INVOICE_DATE', 'CURRENCY_ID', 'CURRENCY_RATE', 'TRANSACTION_REF', 'DELIVERY_REF', 'INVOICE_REF', 'POSTAGE', 'PAYMENT_MODULE_ID', 'DELIVERY_MODULE_ID', 'STATUS_ID', 'LANG_ID', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'ref', 'customer_id', 'invoice_order_address_id', 'delivery_order_address_id', 'invoice_date', 'currency_id', 'currency_rate', 'transaction_ref', 'delivery_ref', 'invoice_ref', 'postage', 'payment_module_id', 'delivery_module_id', 'status_id', 'lang_id', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -191,12 +186,12 @@ class OrderTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'CustomerId' => 2, 'InvoiceOrderAddressId' => 3, 'DeliveryOrderAddressId' => 4, 'InvoiceDate' => 5, 'CurrencyId' => 6, 'CurrencyRate' => 7, 'TransactionRef' => 8, 'DeliveryRef' => 9, 'InvoiceRef' => 10, 'Discount' => 11, 'Postage' => 12, 'PaymentModuleId' => 13, 'DeliveryModuleId' => 14, 'StatusId' => 15, 'LangId' => 16, 'CreatedAt' => 17, 'UpdatedAt' => 18, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'customerId' => 2, 'invoiceOrderAddressId' => 3, 'deliveryOrderAddressId' => 4, 'invoiceDate' => 5, 'currencyId' => 6, 'currencyRate' => 7, 'transactionRef' => 8, 'deliveryRef' => 9, 'invoiceRef' => 10, 'discount' => 11, 'postage' => 12, 'paymentModuleId' => 13, 'deliveryModuleId' => 14, 'statusId' => 15, 'langId' => 16, 'createdAt' => 17, 'updatedAt' => 18, ),
self::TYPE_COLNAME => array(OrderTableMap::ID => 0, OrderTableMap::REF => 1, OrderTableMap::CUSTOMER_ID => 2, OrderTableMap::INVOICE_ORDER_ADDRESS_ID => 3, OrderTableMap::DELIVERY_ORDER_ADDRESS_ID => 4, OrderTableMap::INVOICE_DATE => 5, OrderTableMap::CURRENCY_ID => 6, OrderTableMap::CURRENCY_RATE => 7, OrderTableMap::TRANSACTION_REF => 8, OrderTableMap::DELIVERY_REF => 9, OrderTableMap::INVOICE_REF => 10, OrderTableMap::DISCOUNT => 11, OrderTableMap::POSTAGE => 12, OrderTableMap::PAYMENT_MODULE_ID => 13, OrderTableMap::DELIVERY_MODULE_ID => 14, OrderTableMap::STATUS_ID => 15, OrderTableMap::LANG_ID => 16, OrderTableMap::CREATED_AT => 17, OrderTableMap::UPDATED_AT => 18, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'CUSTOMER_ID' => 2, 'INVOICE_ORDER_ADDRESS_ID' => 3, 'DELIVERY_ORDER_ADDRESS_ID' => 4, 'INVOICE_DATE' => 5, 'CURRENCY_ID' => 6, 'CURRENCY_RATE' => 7, 'TRANSACTION_REF' => 8, 'DELIVERY_REF' => 9, 'INVOICE_REF' => 10, 'DISCOUNT' => 11, 'POSTAGE' => 12, 'PAYMENT_MODULE_ID' => 13, 'DELIVERY_MODULE_ID' => 14, 'STATUS_ID' => 15, 'LANG_ID' => 16, 'CREATED_AT' => 17, 'UPDATED_AT' => 18, ),
self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'customer_id' => 2, 'invoice_order_address_id' => 3, 'delivery_order_address_id' => 4, 'invoice_date' => 5, 'currency_id' => 6, 'currency_rate' => 7, 'transaction_ref' => 8, 'delivery_ref' => 9, 'invoice_ref' => 10, 'discount' => 11, 'postage' => 12, 'payment_module_id' => 13, 'delivery_module_id' => 14, 'status_id' => 15, 'lang_id' => 16, 'created_at' => 17, 'updated_at' => 18, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, )
self::TYPE_PHPNAME => array('Id' => 0, 'Ref' => 1, 'CustomerId' => 2, 'InvoiceOrderAddressId' => 3, 'DeliveryOrderAddressId' => 4, 'InvoiceDate' => 5, 'CurrencyId' => 6, 'CurrencyRate' => 7, 'TransactionRef' => 8, 'DeliveryRef' => 9, 'InvoiceRef' => 10, 'Postage' => 11, 'PaymentModuleId' => 12, 'DeliveryModuleId' => 13, 'StatusId' => 14, 'LangId' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'ref' => 1, 'customerId' => 2, 'invoiceOrderAddressId' => 3, 'deliveryOrderAddressId' => 4, 'invoiceDate' => 5, 'currencyId' => 6, 'currencyRate' => 7, 'transactionRef' => 8, 'deliveryRef' => 9, 'invoiceRef' => 10, 'postage' => 11, 'paymentModuleId' => 12, 'deliveryModuleId' => 13, 'statusId' => 14, 'langId' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
self::TYPE_COLNAME => array(OrderTableMap::ID => 0, OrderTableMap::REF => 1, OrderTableMap::CUSTOMER_ID => 2, OrderTableMap::INVOICE_ORDER_ADDRESS_ID => 3, OrderTableMap::DELIVERY_ORDER_ADDRESS_ID => 4, OrderTableMap::INVOICE_DATE => 5, OrderTableMap::CURRENCY_ID => 6, OrderTableMap::CURRENCY_RATE => 7, OrderTableMap::TRANSACTION_REF => 8, OrderTableMap::DELIVERY_REF => 9, OrderTableMap::INVOICE_REF => 10, OrderTableMap::POSTAGE => 11, OrderTableMap::PAYMENT_MODULE_ID => 12, OrderTableMap::DELIVERY_MODULE_ID => 13, OrderTableMap::STATUS_ID => 14, OrderTableMap::LANG_ID => 15, OrderTableMap::CREATED_AT => 16, OrderTableMap::UPDATED_AT => 17, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'REF' => 1, 'CUSTOMER_ID' => 2, 'INVOICE_ORDER_ADDRESS_ID' => 3, 'DELIVERY_ORDER_ADDRESS_ID' => 4, 'INVOICE_DATE' => 5, 'CURRENCY_ID' => 6, 'CURRENCY_RATE' => 7, 'TRANSACTION_REF' => 8, 'DELIVERY_REF' => 9, 'INVOICE_REF' => 10, 'POSTAGE' => 11, 'PAYMENT_MODULE_ID' => 12, 'DELIVERY_MODULE_ID' => 13, 'STATUS_ID' => 14, 'LANG_ID' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
self::TYPE_FIELDNAME => array('id' => 0, 'ref' => 1, 'customer_id' => 2, 'invoice_order_address_id' => 3, 'delivery_order_address_id' => 4, 'invoice_date' => 5, 'currency_id' => 6, 'currency_rate' => 7, 'transaction_ref' => 8, 'delivery_ref' => 9, 'invoice_ref' => 10, 'postage' => 11, 'payment_module_id' => 12, 'delivery_module_id' => 13, 'status_id' => 14, 'lang_id' => 15, 'created_at' => 16, 'updated_at' => 17, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -226,7 +221,6 @@ class OrderTableMap extends TableMap
$this->addColumn('TRANSACTION_REF', 'TransactionRef', 'VARCHAR', false, 100, null);
$this->addColumn('DELIVERY_REF', 'DeliveryRef', 'VARCHAR', false, 100, null);
$this->addColumn('INVOICE_REF', 'InvoiceRef', 'VARCHAR', false, 100, null);
$this->addColumn('DISCOUNT', 'Discount', 'FLOAT', false, null, null);
$this->addColumn('POSTAGE', 'Postage', 'FLOAT', true, null, null);
$this->addForeignKey('PAYMENT_MODULE_ID', 'PaymentModuleId', 'INTEGER', 'module', 'ID', true, null, null);
$this->addForeignKey('DELIVERY_MODULE_ID', 'DeliveryModuleId', 'INTEGER', 'module', 'ID', true, null, null);
@@ -250,7 +244,7 @@ class OrderTableMap extends TableMap
$this->addRelation('ModuleRelatedByDeliveryModuleId', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('delivery_module_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Lang', '\\Thelia\\Model\\Lang', RelationMap::MANY_TO_ONE, array('lang_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('OrderProduct', '\\Thelia\\Model\\OrderProduct', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT', 'OrderProducts');
$this->addRelation('OrderCoupon', '\\Thelia\\Model\\OrderCoupon', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT', 'OrderCoupons');
$this->addRelation('CouponOrder', '\\Thelia\\Model\\CouponOrder', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT', 'CouponOrders');
} // buildRelations()
/**
@@ -273,7 +267,7 @@ class OrderTableMap extends TableMap
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
OrderProductTableMap::clearInstancePool();
OrderCouponTableMap::clearInstancePool();
CouponOrderTableMap::clearInstancePool();
}
/**
@@ -425,7 +419,6 @@ class OrderTableMap extends TableMap
$criteria->addSelectColumn(OrderTableMap::TRANSACTION_REF);
$criteria->addSelectColumn(OrderTableMap::DELIVERY_REF);
$criteria->addSelectColumn(OrderTableMap::INVOICE_REF);
$criteria->addSelectColumn(OrderTableMap::DISCOUNT);
$criteria->addSelectColumn(OrderTableMap::POSTAGE);
$criteria->addSelectColumn(OrderTableMap::PAYMENT_MODULE_ID);
$criteria->addSelectColumn(OrderTableMap::DELIVERY_MODULE_ID);
@@ -445,7 +438,6 @@ class OrderTableMap extends TableMap
$criteria->addSelectColumn($alias . '.TRANSACTION_REF');
$criteria->addSelectColumn($alias . '.DELIVERY_REF');
$criteria->addSelectColumn($alias . '.INVOICE_REF');
$criteria->addSelectColumn($alias . '.DISCOUNT');
$criteria->addSelectColumn($alias . '.POSTAGE');
$criteria->addSelectColumn($alias . '.PAYMENT_MODULE_ID');
$criteria->addSelectColumn($alias . '.DELIVERY_MODULE_ID');

View File

@@ -55,7 +55,7 @@ class Order extends BaseOrder
*
* @return float|int|string
*/
public function getTotalAmount(&$tax = 0, $includePostage = true, $includeDiscount = true)
public function getTotalAmount(&$tax = 0, $includePostage = true)
{
$amount = 0;
$tax = 0;
@@ -79,21 +79,177 @@ class Order extends BaseOrder
$total = $amount + $tax;
// @todo : manage discount : free postage ?
if(true === $includeDiscount) {
$total -= $this->getDiscount();
if($total<0) {
$total = 0;
} else {
$total = round($total, 2);
}
}
if(false !== $includePostage) {
$total += $this->getPostage();
}
return $total;
return $total; // @todo : manage discount
}
/**
* PROPEL SHOULD FIX IT
*
* Insert the row in the database.
*
* @param ConnectionInterface $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(ConnectionInterface $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = OrderTableMap::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderTableMap::ID . ')');
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(OrderTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID';
}
if ($this->isColumnModified(OrderTableMap::REF)) {
$modifiedColumns[':p' . $index++] = 'REF';
}
if ($this->isColumnModified(OrderTableMap::CUSTOMER_ID)) {
$modifiedColumns[':p' . $index++] = 'CUSTOMER_ID';
}
if ($this->isColumnModified(OrderTableMap::INVOICE_ORDER_ADDRESS_ID)) {
$modifiedColumns[':p' . $index++] = 'INVOICE_ORDER_ADDRESS_ID';
}
if ($this->isColumnModified(OrderTableMap::DELIVERY_ORDER_ADDRESS_ID)) {
$modifiedColumns[':p' . $index++] = 'DELIVERY_ORDER_ADDRESS_ID';
}
if ($this->isColumnModified(OrderTableMap::INVOICE_DATE)) {
$modifiedColumns[':p' . $index++] = 'INVOICE_DATE';
}
if ($this->isColumnModified(OrderTableMap::CURRENCY_ID)) {
$modifiedColumns[':p' . $index++] = 'CURRENCY_ID';
}
if ($this->isColumnModified(OrderTableMap::CURRENCY_RATE)) {
$modifiedColumns[':p' . $index++] = 'CURRENCY_RATE';
}
if ($this->isColumnModified(OrderTableMap::TRANSACTION_REF)) {
$modifiedColumns[':p' . $index++] = 'TRANSACTION_REF';
}
if ($this->isColumnModified(OrderTableMap::DELIVERY_REF)) {
$modifiedColumns[':p' . $index++] = 'DELIVERY_REF';
}
if ($this->isColumnModified(OrderTableMap::INVOICE_REF)) {
$modifiedColumns[':p' . $index++] = 'INVOICE_REF';
}
if ($this->isColumnModified(OrderTableMap::POSTAGE)) {
$modifiedColumns[':p' . $index++] = 'POSTAGE';
}
if ($this->isColumnModified(OrderTableMap::PAYMENT_MODULE_ID)) {
$modifiedColumns[':p' . $index++] = 'PAYMENT_MODULE_ID';
}
if ($this->isColumnModified(OrderTableMap::DELIVERY_MODULE_ID)) {
$modifiedColumns[':p' . $index++] = 'DELIVERY_MODULE_ID';
}
if ($this->isColumnModified(OrderTableMap::STATUS_ID)) {
$modifiedColumns[':p' . $index++] = 'STATUS_ID';
}
if ($this->isColumnModified(OrderTableMap::LANG_ID)) {
$modifiedColumns[':p' . $index++] = 'LANG_ID';
}
if ($this->isColumnModified(OrderTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
if ($this->isColumnModified(OrderTableMap::UPDATED_AT)) {
$modifiedColumns[':p' . $index++] = 'UPDATED_AT';
}
$db = Propel::getServiceContainer()->getAdapter(OrderTableMap::DATABASE_NAME);
if ($db->useQuoteIdentifier()) {
$tableName = $db->quoteIdentifierTable(OrderTableMap::TABLE_NAME);
} else {
$tableName = OrderTableMap::TABLE_NAME;
}
$sql = sprintf(
'INSERT INTO %s (%s) VALUES (%s)',
$tableName,
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case 'REF':
$stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
break;
case 'CUSTOMER_ID':
$stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT);
break;
case 'INVOICE_ORDER_ADDRESS_ID':
$stmt->bindValue($identifier, $this->invoice_order_address_id, PDO::PARAM_INT);
break;
case 'DELIVERY_ORDER_ADDRESS_ID':
$stmt->bindValue($identifier, $this->delivery_order_address_id, PDO::PARAM_INT);
break;
case 'INVOICE_DATE':
$stmt->bindValue($identifier, $this->invoice_date ? $this->invoice_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
case 'CURRENCY_ID':
$stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT);
break;
case 'CURRENCY_RATE':
$stmt->bindValue($identifier, $this->currency_rate, PDO::PARAM_STR);
break;
case 'TRANSACTION_REF':
$stmt->bindValue($identifier, $this->transaction_ref, PDO::PARAM_STR);
break;
case 'DELIVERY_REF':
$stmt->bindValue($identifier, $this->delivery_ref, PDO::PARAM_STR);
break;
case 'INVOICE_REF':
$stmt->bindValue($identifier, $this->invoice_ref, PDO::PARAM_STR);
break;
case 'POSTAGE':
$stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR);
break;
case 'PAYMENT_MODULE_ID':
$stmt->bindValue($identifier, $this->payment_module_id, PDO::PARAM_INT);
break;
case 'DELIVERY_MODULE_ID':
$stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT);
break;
case 'STATUS_ID':
$stmt->bindValue($identifier, $this->status_id, PDO::PARAM_INT);
break;
case 'LANG_ID':
$stmt->bindValue($identifier, $this->lang_id, PDO::PARAM_INT);
break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
case 'UPDATED_AT':
$stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
}
try {
$pk = $con->lastInsertId();
} catch (Exception $e) {
throw new PropelException('Unable to get autoincrement id.', 0, $e);
}
$this->setId($pk);
$this->setNew(false);
}
}

View File

@@ -1,10 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\OrderCoupon as BaseOrderCoupon;
class OrderCoupon extends BaseOrderCoupon
{
}

View File

@@ -22,6 +22,39 @@ use Thelia\Model\Map\OrderTableMap;
*/
class OrderQuery extends BaseOrderQuery
{
/**
* PROPEL SHOULD FIX IT
*
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object
*
* @return Order A model object, or null if the key is not found
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, REF, CUSTOMER_ID, INVOICE_ORDER_ADDRESS_ID, DELIVERY_ORDER_ADDRESS_ID, INVOICE_DATE, CURRENCY_ID, CURRENCY_RATE, TRANSACTION_REF, DELIVERY_REF, INVOICE_REF, POSTAGE, PAYMENT_MODULE_ID, DELIVERY_MODULE_ID, STATUS_ID, LANG_ID, CREATED_AT, UPDATED_AT FROM `order` WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (\Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new Order();
$obj->hydrate($row);
OrderTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
public static function getMonthlySaleStats($month, $year)
{
$numberOfDay = cal_days_in_month(CAL_GREGORIAN, $month, $year);