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:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
678
core/lib/Thelia/Model/Base/CouponOrderQuery.php
Normal file
678
core/lib/Thelia/Model/Base/CouponOrderQuery.php
Normal 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
|
||||
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user