Refactor : Coupon effect inputs are now more customisable
Adding effect to be stored as serialised in JSON
This commit is contained in:
@@ -79,10 +79,10 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* The value for the amount field.
|
||||
* @var double
|
||||
* The value for the serialized_effects field.
|
||||
* @var string
|
||||
*/
|
||||
protected $amount;
|
||||
protected $serialized_effects;
|
||||
|
||||
/**
|
||||
* The value for the is_enabled field.
|
||||
@@ -510,14 +510,14 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [amount] column value.
|
||||
* Get the [serialized_effects] column value.
|
||||
*
|
||||
* @return double
|
||||
* @return string
|
||||
*/
|
||||
public function getAmount()
|
||||
public function getSerializedEffects()
|
||||
{
|
||||
|
||||
return $this->amount;
|
||||
return $this->serialized_effects;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -732,25 +732,25 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
} // setType()
|
||||
|
||||
/**
|
||||
* Set the value of [amount] column.
|
||||
* Set the value of [serialized_effects] column.
|
||||
*
|
||||
* @param double $v new value
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||
*/
|
||||
public function setAmount($v)
|
||||
public function setSerializedEffects($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (double) $v;
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->amount !== $v) {
|
||||
$this->amount = $v;
|
||||
$this->modifiedColumns[] = CouponTableMap::AMOUNT;
|
||||
if ($this->serialized_effects !== $v) {
|
||||
$this->serialized_effects = $v;
|
||||
$this->modifiedColumns[] = CouponTableMap::SERIALIZED_EFFECTS;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAmount()
|
||||
} // setSerializedEffects()
|
||||
|
||||
/**
|
||||
* Sets the value of the [is_enabled] column.
|
||||
@@ -1073,8 +1073,8 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->type = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->amount = (null !== $col) ? (double) $col : null;
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('SerializedEffects', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->serialized_effects = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_enabled = (null !== $col) ? (boolean) $col : null;
|
||||
@@ -1401,8 +1401,8 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponTableMap::TYPE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TYPE';
|
||||
}
|
||||
if ($this->isColumnModified(CouponTableMap::AMOUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'AMOUNT';
|
||||
if ($this->isColumnModified(CouponTableMap::SERIALIZED_EFFECTS)) {
|
||||
$modifiedColumns[':p' . $index++] = 'SERIALIZED_EFFECTS';
|
||||
}
|
||||
if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) {
|
||||
$modifiedColumns[':p' . $index++] = 'IS_ENABLED';
|
||||
@@ -1457,8 +1457,8 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
case 'TYPE':
|
||||
$stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'AMOUNT':
|
||||
$stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR);
|
||||
case 'SERIALIZED_EFFECTS':
|
||||
$stmt->bindValue($identifier, $this->serialized_effects, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'IS_ENABLED':
|
||||
$stmt->bindValue($identifier, (int) $this->is_enabled, PDO::PARAM_INT);
|
||||
@@ -1565,7 +1565,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this->getType();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getAmount();
|
||||
return $this->getSerializedEffects();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getIsEnabled();
|
||||
@@ -1632,7 +1632,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getCode(),
|
||||
$keys[2] => $this->getType(),
|
||||
$keys[3] => $this->getAmount(),
|
||||
$keys[3] => $this->getSerializedEffects(),
|
||||
$keys[4] => $this->getIsEnabled(),
|
||||
$keys[5] => $this->getExpirationDate(),
|
||||
$keys[6] => $this->getMaxUsage(),
|
||||
@@ -1701,7 +1701,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->setType($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setAmount($value);
|
||||
$this->setSerializedEffects($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setIsEnabled($value);
|
||||
@@ -1763,7 +1763,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setSerializedEffects($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setIsEnabled($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setExpirationDate($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setMaxUsage($arr[$keys[6]]);
|
||||
@@ -1789,7 +1789,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponTableMap::ID)) $criteria->add(CouponTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(CouponTableMap::CODE)) $criteria->add(CouponTableMap::CODE, $this->code);
|
||||
if ($this->isColumnModified(CouponTableMap::TYPE)) $criteria->add(CouponTableMap::TYPE, $this->type);
|
||||
if ($this->isColumnModified(CouponTableMap::AMOUNT)) $criteria->add(CouponTableMap::AMOUNT, $this->amount);
|
||||
if ($this->isColumnModified(CouponTableMap::SERIALIZED_EFFECTS)) $criteria->add(CouponTableMap::SERIALIZED_EFFECTS, $this->serialized_effects);
|
||||
if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) $criteria->add(CouponTableMap::IS_ENABLED, $this->is_enabled);
|
||||
if ($this->isColumnModified(CouponTableMap::EXPIRATION_DATE)) $criteria->add(CouponTableMap::EXPIRATION_DATE, $this->expiration_date);
|
||||
if ($this->isColumnModified(CouponTableMap::MAX_USAGE)) $criteria->add(CouponTableMap::MAX_USAGE, $this->max_usage);
|
||||
@@ -1866,7 +1866,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
{
|
||||
$copyObj->setCode($this->getCode());
|
||||
$copyObj->setType($this->getType());
|
||||
$copyObj->setAmount($this->getAmount());
|
||||
$copyObj->setSerializedEffects($this->getSerializedEffects());
|
||||
$copyObj->setIsEnabled($this->getIsEnabled());
|
||||
$copyObj->setExpirationDate($this->getExpirationDate());
|
||||
$copyObj->setMaxUsage($this->getMaxUsage());
|
||||
@@ -2399,7 +2399,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->id = null;
|
||||
$this->code = null;
|
||||
$this->type = null;
|
||||
$this->amount = null;
|
||||
$this->serialized_effects = null;
|
||||
$this->is_enabled = null;
|
||||
$this->expiration_date = null;
|
||||
$this->max_usage = null;
|
||||
@@ -2703,7 +2703,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$version->setId($this->getId());
|
||||
$version->setCode($this->getCode());
|
||||
$version->setType($this->getType());
|
||||
$version->setAmount($this->getAmount());
|
||||
$version->setSerializedEffects($this->getSerializedEffects());
|
||||
$version->setIsEnabled($this->getIsEnabled());
|
||||
$version->setExpirationDate($this->getExpirationDate());
|
||||
$version->setMaxUsage($this->getMaxUsage());
|
||||
@@ -2755,7 +2755,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->setId($version->getId());
|
||||
$this->setCode($version->getCode());
|
||||
$this->setType($version->getType());
|
||||
$this->setAmount($version->getAmount());
|
||||
$this->setSerializedEffects($version->getSerializedEffects());
|
||||
$this->setIsEnabled($version->getIsEnabled());
|
||||
$this->setExpirationDate($version->getExpirationDate());
|
||||
$this->setMaxUsage($version->getMaxUsage());
|
||||
|
||||
@@ -25,7 +25,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildCouponQuery orderByCode($order = Criteria::ASC) Order by the code column
|
||||
* @method ChildCouponQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||
* @method ChildCouponQuery orderByAmount($order = Criteria::ASC) Order by the amount column
|
||||
* @method ChildCouponQuery orderBySerializedEffects($order = Criteria::ASC) Order by the serialized_effects column
|
||||
* @method ChildCouponQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column
|
||||
* @method ChildCouponQuery orderByExpirationDate($order = Criteria::ASC) Order by the expiration_date column
|
||||
* @method ChildCouponQuery orderByMaxUsage($order = Criteria::ASC) Order by the max_usage column
|
||||
@@ -41,7 +41,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery groupById() Group by the id column
|
||||
* @method ChildCouponQuery groupByCode() Group by the code column
|
||||
* @method ChildCouponQuery groupByType() Group by the type column
|
||||
* @method ChildCouponQuery groupByAmount() Group by the amount column
|
||||
* @method ChildCouponQuery groupBySerializedEffects() Group by the serialized_effects column
|
||||
* @method ChildCouponQuery groupByIsEnabled() Group by the is_enabled column
|
||||
* @method ChildCouponQuery groupByExpirationDate() Group by the expiration_date column
|
||||
* @method ChildCouponQuery groupByMaxUsage() Group by the max_usage column
|
||||
@@ -72,7 +72,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCoupon findOneById(int $id) Return the first ChildCoupon filtered by the id column
|
||||
* @method ChildCoupon findOneByCode(string $code) Return the first ChildCoupon filtered by the code column
|
||||
* @method ChildCoupon findOneByType(string $type) Return the first ChildCoupon filtered by the type column
|
||||
* @method ChildCoupon findOneByAmount(double $amount) Return the first ChildCoupon filtered by the amount column
|
||||
* @method ChildCoupon findOneBySerializedEffects(string $serialized_effects) Return the first ChildCoupon filtered by the serialized_effects column
|
||||
* @method ChildCoupon findOneByIsEnabled(boolean $is_enabled) Return the first ChildCoupon filtered by the is_enabled column
|
||||
* @method ChildCoupon findOneByExpirationDate(string $expiration_date) Return the first ChildCoupon filtered by the expiration_date column
|
||||
* @method ChildCoupon findOneByMaxUsage(int $max_usage) Return the first ChildCoupon filtered by the max_usage column
|
||||
@@ -88,7 +88,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method array findById(int $id) Return ChildCoupon objects filtered by the id column
|
||||
* @method array findByCode(string $code) Return ChildCoupon objects filtered by the code column
|
||||
* @method array findByType(string $type) Return ChildCoupon objects filtered by the type column
|
||||
* @method array findByAmount(double $amount) Return ChildCoupon objects filtered by the amount column
|
||||
* @method array findBySerializedEffects(string $serialized_effects) Return ChildCoupon objects filtered by the serialized_effects column
|
||||
* @method array findByIsEnabled(boolean $is_enabled) Return ChildCoupon objects filtered by the is_enabled column
|
||||
* @method array findByExpirationDate(string $expiration_date) Return ChildCoupon objects filtered by the expiration_date column
|
||||
* @method array findByMaxUsage(int $max_usage) Return ChildCoupon objects filtered by the max_usage column
|
||||
@@ -195,7 +195,7 @@ abstract class CouponQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_ENABLED, EXPIRATION_DATE, MAX_USAGE, IS_CUMULATIVE, IS_REMOVING_POSTAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, IS_USED, SERIALIZED_CONDITIONS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, CODE, TYPE, SERIALIZED_EFFECTS, IS_ENABLED, EXPIRATION_DATE, MAX_USAGE, IS_CUMULATIVE, IS_REMOVING_POSTAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, IS_USED, SERIALIZED_CONDITIONS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -384,44 +384,32 @@ abstract class CouponQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the amount column
|
||||
* Filter the query on the serialized_effects column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByAmount(1234); // WHERE amount = 1234
|
||||
* $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34)
|
||||
* $query->filterByAmount(array('min' => 12)); // WHERE amount > 12
|
||||
* $query->filterBySerializedEffects('fooValue'); // WHERE serialized_effects = 'fooValue'
|
||||
* $query->filterBySerializedEffects('%fooValue%'); // WHERE serialized_effects LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $amount The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $serializedEffects The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAmount($amount = null, $comparison = null)
|
||||
public function filterBySerializedEffects($serializedEffects = null, $comparison = null)
|
||||
{
|
||||
if (is_array($amount)) {
|
||||
$useMinMax = false;
|
||||
if (isset($amount['min'])) {
|
||||
$this->addUsingAlias(CouponTableMap::AMOUNT, $amount['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($amount['max'])) {
|
||||
$this->addUsingAlias(CouponTableMap::AMOUNT, $amount['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
if (null === $comparison) {
|
||||
if (is_array($serializedEffects)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $serializedEffects)) {
|
||||
$serializedEffects = str_replace('*', '%', $serializedEffects);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponTableMap::AMOUNT, $amount, $comparison);
|
||||
return $this->addUsingAlias(CouponTableMap::SERIALIZED_EFFECTS, $serializedEffects, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,10 +74,10 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* The value for the amount field.
|
||||
* @var double
|
||||
* The value for the serialized_effects field.
|
||||
* @var string
|
||||
*/
|
||||
protected $amount;
|
||||
protected $serialized_effects;
|
||||
|
||||
/**
|
||||
* The value for the is_enabled field.
|
||||
@@ -464,14 +464,14 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [amount] column value.
|
||||
* Get the [serialized_effects] column value.
|
||||
*
|
||||
* @return double
|
||||
* @return string
|
||||
*/
|
||||
public function getAmount()
|
||||
public function getSerializedEffects()
|
||||
{
|
||||
|
||||
return $this->amount;
|
||||
return $this->serialized_effects;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -690,25 +690,25 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
} // setType()
|
||||
|
||||
/**
|
||||
* Set the value of [amount] column.
|
||||
* Set the value of [serialized_effects] column.
|
||||
*
|
||||
* @param double $v new value
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponVersion The current object (for fluent API support)
|
||||
*/
|
||||
public function setAmount($v)
|
||||
public function setSerializedEffects($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (double) $v;
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->amount !== $v) {
|
||||
$this->amount = $v;
|
||||
$this->modifiedColumns[] = CouponVersionTableMap::AMOUNT;
|
||||
if ($this->serialized_effects !== $v) {
|
||||
$this->serialized_effects = $v;
|
||||
$this->modifiedColumns[] = CouponVersionTableMap::SERIALIZED_EFFECTS;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAmount()
|
||||
} // setSerializedEffects()
|
||||
|
||||
/**
|
||||
* Sets the value of the [is_enabled] column.
|
||||
@@ -1031,8 +1031,8 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponVersionTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->type = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponVersionTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->amount = (null !== $col) ? (double) $col : null;
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponVersionTableMap::translateFieldName('SerializedEffects', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->serialized_effects = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponVersionTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_enabled = (null !== $col) ? (boolean) $col : null;
|
||||
@@ -1313,8 +1313,8 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponVersionTableMap::TYPE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TYPE';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'AMOUNT';
|
||||
if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_EFFECTS)) {
|
||||
$modifiedColumns[':p' . $index++] = 'SERIALIZED_EFFECTS';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::IS_ENABLED)) {
|
||||
$modifiedColumns[':p' . $index++] = 'IS_ENABLED';
|
||||
@@ -1369,8 +1369,8 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
case 'TYPE':
|
||||
$stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'AMOUNT':
|
||||
$stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR);
|
||||
case 'SERIALIZED_EFFECTS':
|
||||
$stmt->bindValue($identifier, $this->serialized_effects, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'IS_ENABLED':
|
||||
$stmt->bindValue($identifier, (int) $this->is_enabled, PDO::PARAM_INT);
|
||||
@@ -1470,7 +1470,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this->getType();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getAmount();
|
||||
return $this->getSerializedEffects();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getIsEnabled();
|
||||
@@ -1537,7 +1537,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getCode(),
|
||||
$keys[2] => $this->getType(),
|
||||
$keys[3] => $this->getAmount(),
|
||||
$keys[3] => $this->getSerializedEffects(),
|
||||
$keys[4] => $this->getIsEnabled(),
|
||||
$keys[5] => $this->getExpirationDate(),
|
||||
$keys[6] => $this->getMaxUsage(),
|
||||
@@ -1603,7 +1603,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->setType($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setAmount($value);
|
||||
$this->setSerializedEffects($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setIsEnabled($value);
|
||||
@@ -1665,7 +1665,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setSerializedEffects($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setIsEnabled($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setExpirationDate($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setMaxUsage($arr[$keys[6]]);
|
||||
@@ -1691,7 +1691,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponVersionTableMap::ID)) $criteria->add(CouponVersionTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::CODE)) $criteria->add(CouponVersionTableMap::CODE, $this->code);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::TYPE)) $criteria->add(CouponVersionTableMap::TYPE, $this->type);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) $criteria->add(CouponVersionTableMap::AMOUNT, $this->amount);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_EFFECTS)) $criteria->add(CouponVersionTableMap::SERIALIZED_EFFECTS, $this->serialized_effects);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::IS_ENABLED)) $criteria->add(CouponVersionTableMap::IS_ENABLED, $this->is_enabled);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::EXPIRATION_DATE)) $criteria->add(CouponVersionTableMap::EXPIRATION_DATE, $this->expiration_date);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::MAX_USAGE)) $criteria->add(CouponVersionTableMap::MAX_USAGE, $this->max_usage);
|
||||
@@ -1776,7 +1776,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$copyObj->setId($this->getId());
|
||||
$copyObj->setCode($this->getCode());
|
||||
$copyObj->setType($this->getType());
|
||||
$copyObj->setAmount($this->getAmount());
|
||||
$copyObj->setSerializedEffects($this->getSerializedEffects());
|
||||
$copyObj->setIsEnabled($this->getIsEnabled());
|
||||
$copyObj->setExpirationDate($this->getExpirationDate());
|
||||
$copyObj->setMaxUsage($this->getMaxUsage());
|
||||
@@ -1874,7 +1874,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->id = null;
|
||||
$this->code = null;
|
||||
$this->type = null;
|
||||
$this->amount = null;
|
||||
$this->serialized_effects = null;
|
||||
$this->is_enabled = null;
|
||||
$this->expiration_date = null;
|
||||
$this->max_usage = null;
|
||||
|
||||
@@ -24,7 +24,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersionQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildCouponVersionQuery orderByCode($order = Criteria::ASC) Order by the code column
|
||||
* @method ChildCouponVersionQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||
* @method ChildCouponVersionQuery orderByAmount($order = Criteria::ASC) Order by the amount column
|
||||
* @method ChildCouponVersionQuery orderBySerializedEffects($order = Criteria::ASC) Order by the serialized_effects column
|
||||
* @method ChildCouponVersionQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column
|
||||
* @method ChildCouponVersionQuery orderByExpirationDate($order = Criteria::ASC) Order by the expiration_date column
|
||||
* @method ChildCouponVersionQuery orderByMaxUsage($order = Criteria::ASC) Order by the max_usage column
|
||||
@@ -40,7 +40,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersionQuery groupById() Group by the id column
|
||||
* @method ChildCouponVersionQuery groupByCode() Group by the code column
|
||||
* @method ChildCouponVersionQuery groupByType() Group by the type column
|
||||
* @method ChildCouponVersionQuery groupByAmount() Group by the amount column
|
||||
* @method ChildCouponVersionQuery groupBySerializedEffects() Group by the serialized_effects column
|
||||
* @method ChildCouponVersionQuery groupByIsEnabled() Group by the is_enabled column
|
||||
* @method ChildCouponVersionQuery groupByExpirationDate() Group by the expiration_date column
|
||||
* @method ChildCouponVersionQuery groupByMaxUsage() Group by the max_usage column
|
||||
@@ -67,7 +67,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersion findOneById(int $id) Return the first ChildCouponVersion filtered by the id column
|
||||
* @method ChildCouponVersion findOneByCode(string $code) Return the first ChildCouponVersion filtered by the code column
|
||||
* @method ChildCouponVersion findOneByType(string $type) Return the first ChildCouponVersion filtered by the type column
|
||||
* @method ChildCouponVersion findOneByAmount(double $amount) Return the first ChildCouponVersion filtered by the amount column
|
||||
* @method ChildCouponVersion findOneBySerializedEffects(string $serialized_effects) Return the first ChildCouponVersion filtered by the serialized_effects column
|
||||
* @method ChildCouponVersion findOneByIsEnabled(boolean $is_enabled) Return the first ChildCouponVersion filtered by the is_enabled column
|
||||
* @method ChildCouponVersion findOneByExpirationDate(string $expiration_date) Return the first ChildCouponVersion filtered by the expiration_date column
|
||||
* @method ChildCouponVersion findOneByMaxUsage(int $max_usage) Return the first ChildCouponVersion filtered by the max_usage column
|
||||
@@ -83,7 +83,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method array findById(int $id) Return ChildCouponVersion objects filtered by the id column
|
||||
* @method array findByCode(string $code) Return ChildCouponVersion objects filtered by the code column
|
||||
* @method array findByType(string $type) Return ChildCouponVersion objects filtered by the type column
|
||||
* @method array findByAmount(double $amount) Return ChildCouponVersion objects filtered by the amount column
|
||||
* @method array findBySerializedEffects(string $serialized_effects) Return ChildCouponVersion objects filtered by the serialized_effects column
|
||||
* @method array findByIsEnabled(boolean $is_enabled) Return ChildCouponVersion objects filtered by the is_enabled column
|
||||
* @method array findByExpirationDate(string $expiration_date) Return ChildCouponVersion objects filtered by the expiration_date column
|
||||
* @method array findByMaxUsage(int $max_usage) Return ChildCouponVersion objects filtered by the max_usage column
|
||||
@@ -183,7 +183,7 @@ abstract class CouponVersionQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_ENABLED, EXPIRATION_DATE, MAX_USAGE, IS_CUMULATIVE, IS_REMOVING_POSTAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, IS_USED, SERIALIZED_CONDITIONS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1';
|
||||
$sql = 'SELECT ID, CODE, TYPE, SERIALIZED_EFFECTS, IS_ENABLED, EXPIRATION_DATE, MAX_USAGE, IS_CUMULATIVE, IS_REMOVING_POSTAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, IS_USED, SERIALIZED_CONDITIONS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
@@ -386,44 +386,32 @@ abstract class CouponVersionQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the amount column
|
||||
* Filter the query on the serialized_effects column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByAmount(1234); // WHERE amount = 1234
|
||||
* $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34)
|
||||
* $query->filterByAmount(array('min' => 12)); // WHERE amount > 12
|
||||
* $query->filterBySerializedEffects('fooValue'); // WHERE serialized_effects = 'fooValue'
|
||||
* $query->filterBySerializedEffects('%fooValue%'); // WHERE serialized_effects LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $amount The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $serializedEffects The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponVersionQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAmount($amount = null, $comparison = null)
|
||||
public function filterBySerializedEffects($serializedEffects = null, $comparison = null)
|
||||
{
|
||||
if (is_array($amount)) {
|
||||
$useMinMax = false;
|
||||
if (isset($amount['min'])) {
|
||||
$this->addUsingAlias(CouponVersionTableMap::AMOUNT, $amount['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($amount['max'])) {
|
||||
$this->addUsingAlias(CouponVersionTableMap::AMOUNT, $amount['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
if (null === $comparison) {
|
||||
if (is_array($serializedEffects)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $serializedEffects)) {
|
||||
$serializedEffects = str_replace('*', '%', $serializedEffects);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponVersionTableMap::AMOUNT, $amount, $comparison);
|
||||
return $this->addUsingAlias(CouponVersionTableMap::SERIALIZED_EFFECTS, $serializedEffects, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
0
core/lib/Thelia/Model/Base/OrderCouponQuery.php
Normal file → Executable file
0
core/lib/Thelia/Model/Base/OrderCouponQuery.php
Normal file → Executable file
Reference in New Issue
Block a user