Added per-user coupon maximum usage count
This commit is contained in:
@@ -22,6 +22,8 @@ use Thelia\Model\CountryQuery as ChildCountryQuery;
|
||||
use Thelia\Model\Coupon as ChildCoupon;
|
||||
use Thelia\Model\CouponCountry as ChildCouponCountry;
|
||||
use Thelia\Model\CouponCountryQuery as ChildCouponCountryQuery;
|
||||
use Thelia\Model\CouponCustomerCount as ChildCouponCustomerCount;
|
||||
use Thelia\Model\CouponCustomerCountQuery as ChildCouponCustomerCountQuery;
|
||||
use Thelia\Model\CouponI18n as ChildCouponI18n;
|
||||
use Thelia\Model\CouponI18nQuery as ChildCouponI18nQuery;
|
||||
use Thelia\Model\CouponModule as ChildCouponModule;
|
||||
@@ -29,6 +31,8 @@ use Thelia\Model\CouponModuleQuery as ChildCouponModuleQuery;
|
||||
use Thelia\Model\CouponQuery as ChildCouponQuery;
|
||||
use Thelia\Model\CouponVersion as ChildCouponVersion;
|
||||
use Thelia\Model\CouponVersionQuery as ChildCouponVersionQuery;
|
||||
use Thelia\Model\Customer as ChildCustomer;
|
||||
use Thelia\Model\CustomerQuery as ChildCustomerQuery;
|
||||
use Thelia\Model\Module as ChildModule;
|
||||
use Thelia\Model\ModuleQuery as ChildModuleQuery;
|
||||
use Thelia\Model\Map\CouponTableMap;
|
||||
@@ -140,6 +144,12 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
*/
|
||||
protected $serialized_conditions;
|
||||
|
||||
/**
|
||||
* The value for the per_customer_usage_count field.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $per_customer_usage_count;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -171,6 +181,12 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
protected $collCouponModules;
|
||||
protected $collCouponModulesPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildCouponCustomerCount[] Collection to store aggregation of ChildCouponCustomerCount objects.
|
||||
*/
|
||||
protected $collCouponCustomerCounts;
|
||||
protected $collCouponCustomerCountsPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildCouponI18n[] Collection to store aggregation of ChildCouponI18n objects.
|
||||
*/
|
||||
@@ -193,6 +209,11 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
*/
|
||||
protected $collModules;
|
||||
|
||||
/**
|
||||
* @var ChildCustomer[] Collection to store aggregation of ChildCustomer objects.
|
||||
*/
|
||||
protected $collCustomers;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
@@ -235,6 +256,12 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
*/
|
||||
protected $modulesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $customersScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
@@ -247,6 +274,12 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
*/
|
||||
protected $couponModulesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $couponCustomerCountsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
@@ -671,6 +704,17 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this->serialized_conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [per_customer_usage_count] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPerCustomerUsageCount()
|
||||
{
|
||||
|
||||
return $this->per_customer_usage_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -1014,6 +1058,35 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setSerializedConditions()
|
||||
|
||||
/**
|
||||
* Sets the value of the [per_customer_usage_count] column.
|
||||
* Non-boolean arguments are converted using the following rules:
|
||||
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
|
||||
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
|
||||
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
|
||||
*
|
||||
* @param boolean|integer|string $v The new value
|
||||
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||
*/
|
||||
public function setPerCustomerUsageCount($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
if (is_string($v)) {
|
||||
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
} else {
|
||||
$v = (boolean) $v;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->per_customer_usage_count !== $v) {
|
||||
$this->per_customer_usage_count = $v;
|
||||
$this->modifiedColumns[CouponTableMap::PER_CUSTOMER_USAGE_COUNT] = true;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setPerCustomerUsageCount()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -1157,19 +1230,22 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('SerializedConditions', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->serialized_conditions = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('PerCustomerUsageCount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->per_customer_usage_count = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::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 ? 13 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version = (null !== $col) ? (int) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
@@ -1179,7 +1255,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 15; // 15 = CouponTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 16; // 16 = CouponTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e);
|
||||
@@ -1244,12 +1320,15 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
|
||||
$this->collCouponModules = null;
|
||||
|
||||
$this->collCouponCustomerCounts = null;
|
||||
|
||||
$this->collCouponI18ns = null;
|
||||
|
||||
$this->collCouponVersions = null;
|
||||
|
||||
$this->collCountries = null;
|
||||
$this->collModules = null;
|
||||
$this->collCustomers = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -1446,6 +1525,33 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->customersScheduledForDeletion !== null) {
|
||||
if (!$this->customersScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
$pk = $this->getPrimaryKey();
|
||||
foreach ($this->customersScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($remotePk, $pk);
|
||||
}
|
||||
|
||||
CouponCustomerCountQuery::create()
|
||||
->filterByPrimaryKeys($pks)
|
||||
->delete($con);
|
||||
$this->customersScheduledForDeletion = null;
|
||||
}
|
||||
|
||||
foreach ($this->getCustomers() as $customer) {
|
||||
if ($customer->isModified()) {
|
||||
$customer->save($con);
|
||||
}
|
||||
}
|
||||
} elseif ($this->collCustomers) {
|
||||
foreach ($this->collCustomers as $customer) {
|
||||
if ($customer->isModified()) {
|
||||
$customer->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->couponCountriesScheduledForDeletion !== null) {
|
||||
if (!$this->couponCountriesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\CouponCountryQuery::create()
|
||||
@@ -1480,6 +1586,23 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->couponCustomerCountsScheduledForDeletion !== null) {
|
||||
if (!$this->couponCustomerCountsScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\CouponCustomerCountQuery::create()
|
||||
->filterByPrimaryKeys($this->couponCustomerCountsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->couponCustomerCountsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collCouponCustomerCounts !== null) {
|
||||
foreach ($this->collCouponCustomerCounts as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->couponI18nsScheduledForDeletion !== null) {
|
||||
if (!$this->couponI18nsScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\CouponI18nQuery::create()
|
||||
@@ -1576,6 +1699,9 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponTableMap::SERIALIZED_CONDITIONS)) {
|
||||
$modifiedColumns[':p' . $index++] = '`SERIALIZED_CONDITIONS`';
|
||||
}
|
||||
if ($this->isColumnModified(CouponTableMap::PER_CUSTOMER_USAGE_COUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = '`PER_CUSTOMER_USAGE_COUNT`';
|
||||
}
|
||||
if ($this->isColumnModified(CouponTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = '`CREATED_AT`';
|
||||
}
|
||||
@@ -1632,6 +1758,9 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
case '`SERIALIZED_CONDITIONS`':
|
||||
$stmt->bindValue($identifier, $this->serialized_conditions, PDO::PARAM_STR);
|
||||
break;
|
||||
case '`PER_CUSTOMER_USAGE_COUNT`':
|
||||
$stmt->bindValue($identifier, (int) $this->per_customer_usage_count, PDO::PARAM_INT);
|
||||
break;
|
||||
case '`CREATED_AT`':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1740,12 +1869,15 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this->getSerializedConditions();
|
||||
break;
|
||||
case 12:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getPerCustomerUsageCount();
|
||||
break;
|
||||
case 13:
|
||||
return $this->getUpdatedAt();
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 14:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
case 15:
|
||||
return $this->getVersion();
|
||||
break;
|
||||
default:
|
||||
@@ -1789,9 +1921,10 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$keys[9] => $this->getIsAvailableOnSpecialOffers(),
|
||||
$keys[10] => $this->getIsUsed(),
|
||||
$keys[11] => $this->getSerializedConditions(),
|
||||
$keys[12] => $this->getCreatedAt(),
|
||||
$keys[13] => $this->getUpdatedAt(),
|
||||
$keys[14] => $this->getVersion(),
|
||||
$keys[12] => $this->getPerCustomerUsageCount(),
|
||||
$keys[13] => $this->getCreatedAt(),
|
||||
$keys[14] => $this->getUpdatedAt(),
|
||||
$keys[15] => $this->getVersion(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1805,6 +1938,9 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if (null !== $this->collCouponModules) {
|
||||
$result['CouponModules'] = $this->collCouponModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collCouponCustomerCounts) {
|
||||
$result['CouponCustomerCounts'] = $this->collCouponCustomerCounts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collCouponI18ns) {
|
||||
$result['CouponI18ns'] = $this->collCouponI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
@@ -1882,12 +2018,15 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->setSerializedConditions($value);
|
||||
break;
|
||||
case 12:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setPerCustomerUsageCount($value);
|
||||
break;
|
||||
case 13:
|
||||
$this->setUpdatedAt($value);
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 14:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
case 15:
|
||||
$this->setVersion($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1926,9 +2065,10 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[9], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setIsUsed($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setSerializedConditions($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setPerCustomerUsageCount($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setVersion($arr[$keys[15]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1952,6 +2092,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) $criteria->add(CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $this->is_available_on_special_offers);
|
||||
if ($this->isColumnModified(CouponTableMap::IS_USED)) $criteria->add(CouponTableMap::IS_USED, $this->is_used);
|
||||
if ($this->isColumnModified(CouponTableMap::SERIALIZED_CONDITIONS)) $criteria->add(CouponTableMap::SERIALIZED_CONDITIONS, $this->serialized_conditions);
|
||||
if ($this->isColumnModified(CouponTableMap::PER_CUSTOMER_USAGE_COUNT)) $criteria->add(CouponTableMap::PER_CUSTOMER_USAGE_COUNT, $this->per_customer_usage_count);
|
||||
if ($this->isColumnModified(CouponTableMap::CREATED_AT)) $criteria->add(CouponTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CouponTableMap::UPDATED_AT)) $criteria->add(CouponTableMap::UPDATED_AT, $this->updated_at);
|
||||
if ($this->isColumnModified(CouponTableMap::VERSION)) $criteria->add(CouponTableMap::VERSION, $this->version);
|
||||
@@ -2029,6 +2170,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$copyObj->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers());
|
||||
$copyObj->setIsUsed($this->getIsUsed());
|
||||
$copyObj->setSerializedConditions($this->getSerializedConditions());
|
||||
$copyObj->setPerCustomerUsageCount($this->getPerCustomerUsageCount());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
$copyObj->setVersion($this->getVersion());
|
||||
@@ -2050,6 +2192,12 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getCouponCustomerCounts() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCouponCustomerCount($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getCouponI18ns() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCouponI18n($relObj->copy($deepCopy));
|
||||
@@ -2109,6 +2257,9 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if ('CouponModule' == $relationName) {
|
||||
return $this->initCouponModules();
|
||||
}
|
||||
if ('CouponCustomerCount' == $relationName) {
|
||||
return $this->initCouponCustomerCounts();
|
||||
}
|
||||
if ('CouponI18n' == $relationName) {
|
||||
return $this->initCouponI18ns();
|
||||
}
|
||||
@@ -2609,6 +2760,249 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this->getCouponModules($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCouponCustomerCounts 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 addCouponCustomerCounts()
|
||||
*/
|
||||
public function clearCouponCustomerCounts()
|
||||
{
|
||||
$this->collCouponCustomerCounts = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collCouponCustomerCounts collection loaded partially.
|
||||
*/
|
||||
public function resetPartialCouponCustomerCounts($v = true)
|
||||
{
|
||||
$this->collCouponCustomerCountsPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCouponCustomerCounts collection.
|
||||
*
|
||||
* By default this just sets the collCouponCustomerCounts collection to an empty array (like clearcollCouponCustomerCounts());
|
||||
* 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.
|
||||
*
|
||||
* @param boolean $overrideExisting If set to true, the method call initializes
|
||||
* the collection even if it is not empty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initCouponCustomerCounts($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collCouponCustomerCounts && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collCouponCustomerCounts = new ObjectCollection();
|
||||
$this->collCouponCustomerCounts->setModel('\Thelia\Model\CouponCustomerCount');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildCouponCustomerCount 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.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildCoupon is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildCouponCustomerCount[] List of ChildCouponCustomerCount objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCouponCustomerCounts($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collCouponCustomerCountsPartial && !$this->isNew();
|
||||
if (null === $this->collCouponCustomerCounts || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCouponCustomerCounts) {
|
||||
// return empty collection
|
||||
$this->initCouponCustomerCounts();
|
||||
} else {
|
||||
$collCouponCustomerCounts = ChildCouponCustomerCountQuery::create(null, $criteria)
|
||||
->filterByCoupon($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collCouponCustomerCountsPartial && count($collCouponCustomerCounts)) {
|
||||
$this->initCouponCustomerCounts(false);
|
||||
|
||||
foreach ($collCouponCustomerCounts as $obj) {
|
||||
if (false == $this->collCouponCustomerCounts->contains($obj)) {
|
||||
$this->collCouponCustomerCounts->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCountsPartial = true;
|
||||
}
|
||||
|
||||
reset($collCouponCustomerCounts);
|
||||
|
||||
return $collCouponCustomerCounts;
|
||||
}
|
||||
|
||||
if ($partial && $this->collCouponCustomerCounts) {
|
||||
foreach ($this->collCouponCustomerCounts as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collCouponCustomerCounts[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCounts = $collCouponCustomerCounts;
|
||||
$this->collCouponCustomerCountsPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCouponCustomerCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of CouponCustomerCount 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 $couponCustomerCounts A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildCoupon The current object (for fluent API support)
|
||||
*/
|
||||
public function setCouponCustomerCounts(Collection $couponCustomerCounts, ConnectionInterface $con = null)
|
||||
{
|
||||
$couponCustomerCountsToDelete = $this->getCouponCustomerCounts(new Criteria(), $con)->diff($couponCustomerCounts);
|
||||
|
||||
|
||||
$this->couponCustomerCountsScheduledForDeletion = $couponCustomerCountsToDelete;
|
||||
|
||||
foreach ($couponCustomerCountsToDelete as $couponCustomerCountRemoved) {
|
||||
$couponCustomerCountRemoved->setCoupon(null);
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCounts = null;
|
||||
foreach ($couponCustomerCounts as $couponCustomerCount) {
|
||||
$this->addCouponCustomerCount($couponCustomerCount);
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCounts = $couponCustomerCounts;
|
||||
$this->collCouponCustomerCountsPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related CouponCustomerCount objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related CouponCustomerCount objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countCouponCustomerCounts(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collCouponCustomerCountsPartial && !$this->isNew();
|
||||
if (null === $this->collCouponCustomerCounts || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCouponCustomerCounts) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getCouponCustomerCounts());
|
||||
}
|
||||
|
||||
$query = ChildCouponCustomerCountQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByCoupon($this)
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collCouponCustomerCounts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildCouponCustomerCount object to this object
|
||||
* through the ChildCouponCustomerCount foreign key attribute.
|
||||
*
|
||||
* @param ChildCouponCustomerCount $l ChildCouponCustomerCount
|
||||
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||
*/
|
||||
public function addCouponCustomerCount(ChildCouponCustomerCount $l)
|
||||
{
|
||||
if ($this->collCouponCustomerCounts === null) {
|
||||
$this->initCouponCustomerCounts();
|
||||
$this->collCouponCustomerCountsPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collCouponCustomerCounts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCouponCustomerCount($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CouponCustomerCount $couponCustomerCount The couponCustomerCount object to add.
|
||||
*/
|
||||
protected function doAddCouponCustomerCount($couponCustomerCount)
|
||||
{
|
||||
$this->collCouponCustomerCounts[]= $couponCustomerCount;
|
||||
$couponCustomerCount->setCoupon($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CouponCustomerCount $couponCustomerCount The couponCustomerCount object to remove.
|
||||
* @return ChildCoupon The current object (for fluent API support)
|
||||
*/
|
||||
public function removeCouponCustomerCount($couponCustomerCount)
|
||||
{
|
||||
if ($this->getCouponCustomerCounts()->contains($couponCustomerCount)) {
|
||||
$this->collCouponCustomerCounts->remove($this->collCouponCustomerCounts->search($couponCustomerCount));
|
||||
if (null === $this->couponCustomerCountsScheduledForDeletion) {
|
||||
$this->couponCustomerCountsScheduledForDeletion = clone $this->collCouponCustomerCounts;
|
||||
$this->couponCustomerCountsScheduledForDeletion->clear();
|
||||
}
|
||||
$this->couponCustomerCountsScheduledForDeletion[]= clone $couponCustomerCount;
|
||||
$couponCustomerCount->setCoupon(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Coupon is new, it will return
|
||||
* an empty collection; or if this Coupon has previously
|
||||
* been saved, it will retrieve related CouponCustomerCounts from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Coupon.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildCouponCustomerCount[] List of ChildCouponCustomerCount objects
|
||||
*/
|
||||
public function getCouponCustomerCountsJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildCouponCustomerCountQuery::create(null, $criteria);
|
||||
$query->joinWith('Customer', $joinBehavior);
|
||||
|
||||
return $this->getCouponCustomerCounts($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCouponI18ns collection
|
||||
*
|
||||
@@ -3421,6 +3815,189 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCustomers 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 addCustomers()
|
||||
*/
|
||||
public function clearCustomers()
|
||||
{
|
||||
$this->collCustomers = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collCustomersPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCustomers collection.
|
||||
*
|
||||
* By default this just sets the collCustomers collection to an empty collection (like clearCustomers());
|
||||
* 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.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initCustomers()
|
||||
{
|
||||
$this->collCustomers = new ObjectCollection();
|
||||
$this->collCustomers->setModel('\Thelia\Model\Customer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of ChildCustomer objects related by a many-to-many relationship
|
||||
* to the current object by way of the coupon_customer_count cross-reference table.
|
||||
*
|
||||
* 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.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildCoupon is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return ObjectCollection|ChildCustomer[] List of ChildCustomer objects
|
||||
*/
|
||||
public function getCustomers($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCustomers || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCustomers) {
|
||||
// return empty collection
|
||||
$this->initCustomers();
|
||||
} else {
|
||||
$collCustomers = ChildCustomerQuery::create(null, $criteria)
|
||||
->filterByCoupon($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCustomers;
|
||||
}
|
||||
$this->collCustomers = $collCustomers;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCustomers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Customer objects related by a many-to-many relationship
|
||||
* to the current object by way of the coupon_customer_count cross-reference table.
|
||||
* 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 $customers A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildCoupon The current object (for fluent API support)
|
||||
*/
|
||||
public function setCustomers(Collection $customers, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->clearCustomers();
|
||||
$currentCustomers = $this->getCustomers();
|
||||
|
||||
$this->customersScheduledForDeletion = $currentCustomers->diff($customers);
|
||||
|
||||
foreach ($customers as $customer) {
|
||||
if (!$currentCustomers->contains($customer)) {
|
||||
$this->doAddCustomer($customer);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCustomers = $customers;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of ChildCustomer objects related by a many-to-many relationship
|
||||
* to the current object by way of the coupon_customer_count cross-reference table.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param boolean $distinct Set to true to force count distinct
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return int the number of related ChildCustomer objects
|
||||
*/
|
||||
public function countCustomers($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCustomers || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCustomers) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = ChildCustomerQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByCoupon($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collCustomers);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a ChildCustomer object to this object
|
||||
* through the coupon_customer_count cross reference table.
|
||||
*
|
||||
* @param ChildCustomer $customer The ChildCouponCustomerCount object to relate
|
||||
* @return ChildCoupon The current object (for fluent API support)
|
||||
*/
|
||||
public function addCustomer(ChildCustomer $customer)
|
||||
{
|
||||
if ($this->collCustomers === null) {
|
||||
$this->initCustomers();
|
||||
}
|
||||
|
||||
if (!$this->collCustomers->contains($customer)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCustomer($customer);
|
||||
$this->collCustomers[] = $customer;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Customer $customer The customer object to add.
|
||||
*/
|
||||
protected function doAddCustomer($customer)
|
||||
{
|
||||
$couponCustomerCount = new ChildCouponCustomerCount();
|
||||
$couponCustomerCount->setCustomer($customer);
|
||||
$this->addCouponCustomerCount($couponCustomerCount);
|
||||
// set the back reference to this object directly as using provided method either results
|
||||
// in endless loop or in multiple relations
|
||||
if (!$customer->getCoupons()->contains($this)) {
|
||||
$foreignCollection = $customer->getCoupons();
|
||||
$foreignCollection[] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a ChildCustomer object to this object
|
||||
* through the coupon_customer_count cross reference table.
|
||||
*
|
||||
* @param ChildCustomer $customer The ChildCouponCustomerCount object to relate
|
||||
* @return ChildCoupon The current object (for fluent API support)
|
||||
*/
|
||||
public function removeCustomer(ChildCustomer $customer)
|
||||
{
|
||||
if ($this->getCustomers()->contains($customer)) {
|
||||
$this->collCustomers->remove($this->collCustomers->search($customer));
|
||||
|
||||
if (null === $this->customersScheduledForDeletion) {
|
||||
$this->customersScheduledForDeletion = clone $this->collCustomers;
|
||||
$this->customersScheduledForDeletion->clear();
|
||||
}
|
||||
|
||||
$this->customersScheduledForDeletion[] = $customer;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -3438,6 +4015,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->is_available_on_special_offers = null;
|
||||
$this->is_used = null;
|
||||
$this->serialized_conditions = null;
|
||||
$this->per_customer_usage_count = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->version = null;
|
||||
@@ -3471,6 +4049,11 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCouponCustomerCounts) {
|
||||
foreach ($this->collCouponCustomerCounts as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCouponI18ns) {
|
||||
foreach ($this->collCouponI18ns as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
@@ -3491,6 +4074,11 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCustomers) {
|
||||
foreach ($this->collCustomers as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
// i18n behavior
|
||||
@@ -3499,10 +4087,12 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
|
||||
$this->collCouponCountries = null;
|
||||
$this->collCouponModules = null;
|
||||
$this->collCouponCustomerCounts = null;
|
||||
$this->collCouponI18ns = null;
|
||||
$this->collCouponVersions = null;
|
||||
$this->collCountries = null;
|
||||
$this->collModules = null;
|
||||
$this->collCustomers = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3760,6 +4350,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$version->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers());
|
||||
$version->setIsUsed($this->getIsUsed());
|
||||
$version->setSerializedConditions($this->getSerializedConditions());
|
||||
$version->setPerCustomerUsageCount($this->getPerCustomerUsageCount());
|
||||
$version->setCreatedAt($this->getCreatedAt());
|
||||
$version->setUpdatedAt($this->getUpdatedAt());
|
||||
$version->setVersion($this->getVersion());
|
||||
@@ -3812,6 +4403,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->setIsAvailableOnSpecialOffers($version->getIsAvailableOnSpecialOffers());
|
||||
$this->setIsUsed($version->getIsUsed());
|
||||
$this->setSerializedConditions($version->getSerializedConditions());
|
||||
$this->setPerCustomerUsageCount($version->getPerCustomerUsageCount());
|
||||
$this->setCreatedAt($version->getCreatedAt());
|
||||
$this->setUpdatedAt($version->getUpdatedAt());
|
||||
$this->setVersion($version->getVersion());
|
||||
|
||||
1341
core/lib/Thelia/Model/Base/CouponCustomerCount.php
Normal file
1341
core/lib/Thelia/Model/Base/CouponCustomerCount.php
Normal file
File diff suppressed because it is too large
Load Diff
521
core/lib/Thelia/Model/Base/CouponCustomerCountQuery.php
Normal file
521
core/lib/Thelia/Model/Base/CouponCustomerCountQuery.php
Normal file
@@ -0,0 +1,521 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
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\CouponCustomerCount as ChildCouponCustomerCount;
|
||||
use Thelia\Model\CouponCustomerCountQuery as ChildCouponCustomerCountQuery;
|
||||
use Thelia\Model\Map\CouponCustomerCountTableMap;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'coupon_customer_count' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery orderByCouponId($order = Criteria::ASC) Order by the coupon_id column
|
||||
* @method ChildCouponCustomerCountQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column
|
||||
* @method ChildCouponCustomerCountQuery orderByCount($order = Criteria::ASC) Order by the count column
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery groupByCouponId() Group by the coupon_id column
|
||||
* @method ChildCouponCustomerCountQuery groupByCustomerId() Group by the customer_id column
|
||||
* @method ChildCouponCustomerCountQuery groupByCount() Group by the count column
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildCouponCustomerCountQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildCouponCustomerCountQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery leftJoinCustomer($relationAlias = null) Adds a LEFT JOIN clause to the query using the Customer relation
|
||||
* @method ChildCouponCustomerCountQuery rightJoinCustomer($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Customer relation
|
||||
* @method ChildCouponCustomerCountQuery innerJoinCustomer($relationAlias = null) Adds a INNER JOIN clause to the query using the Customer relation
|
||||
*
|
||||
* @method ChildCouponCustomerCountQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponCustomerCountQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponCustomerCountQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @method ChildCouponCustomerCount findOne(ConnectionInterface $con = null) Return the first ChildCouponCustomerCount matching the query
|
||||
* @method ChildCouponCustomerCount findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponCustomerCount matching the query, or a new ChildCouponCustomerCount object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildCouponCustomerCount findOneByCouponId(int $coupon_id) Return the first ChildCouponCustomerCount filtered by the coupon_id column
|
||||
* @method ChildCouponCustomerCount findOneByCustomerId(int $customer_id) Return the first ChildCouponCustomerCount filtered by the customer_id column
|
||||
* @method ChildCouponCustomerCount findOneByCount(int $count) Return the first ChildCouponCustomerCount filtered by the count column
|
||||
*
|
||||
* @method array findByCouponId(int $coupon_id) Return ChildCouponCustomerCount objects filtered by the coupon_id column
|
||||
* @method array findByCustomerId(int $customer_id) Return ChildCouponCustomerCount objects filtered by the customer_id column
|
||||
* @method array findByCount(int $count) Return ChildCouponCustomerCount objects filtered by the count column
|
||||
*
|
||||
*/
|
||||
abstract class CouponCustomerCountQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \Thelia\Model\Base\CouponCustomerCountQuery 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\\CouponCustomerCount', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildCouponCustomerCountQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \Thelia\Model\CouponCustomerCountQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \Thelia\Model\CouponCustomerCountQuery();
|
||||
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 ChildCouponCustomerCount|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
throw new \LogicException('The ChildCouponCustomerCount class has no primary key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $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)
|
||||
{
|
||||
throw new \LogicException('The ChildCouponCustomerCount class has no primary key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by primary key
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
throw new \LogicException('The ChildCouponCustomerCount class has no primary key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a list of primary keys
|
||||
*
|
||||
* @param array $keys The list of primary key to use for the query
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
throw new \LogicException('The ChildCouponCustomerCount class has no primary key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the coupon_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCouponId(1234); // WHERE coupon_id = 1234
|
||||
* $query->filterByCouponId(array(12, 34)); // WHERE coupon_id IN (12, 34)
|
||||
* $query->filterByCouponId(array('min' => 12)); // WHERE coupon_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCoupon()
|
||||
*
|
||||
* @param mixed $couponId 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 ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponId($couponId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($couponId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($couponId['min'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($couponId['max'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $couponId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the customer_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCustomerId(1234); // WHERE customer_id = 1234
|
||||
* $query->filterByCustomerId(array(12, 34)); // WHERE customer_id IN (12, 34)
|
||||
* $query->filterByCustomerId(array('min' => 12)); // WHERE customer_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCustomer()
|
||||
*
|
||||
* @param mixed $customerId 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 ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCustomerId($customerId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($customerId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($customerId['min'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customerId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($customerId['max'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customerId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customerId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the count column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCount(1234); // WHERE count = 1234
|
||||
* $query->filterByCount(array(12, 34)); // WHERE count IN (12, 34)
|
||||
* $query->filterByCount(array('min' => 12)); // WHERE count > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $count 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 ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCount($count = null, $comparison = null)
|
||||
{
|
||||
if (is_array($count)) {
|
||||
$useMinMax = false;
|
||||
if (isset($count['min'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::COUNT, $count['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($count['max'])) {
|
||||
$this->addUsingAlias(CouponCustomerCountTableMap::COUNT, $count['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponCustomerCountTableMap::COUNT, $count, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Customer object
|
||||
*
|
||||
* @param \Thelia\Model\Customer|ObjectCollection $customer The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCustomer($customer, $comparison = null)
|
||||
{
|
||||
if ($customer instanceof \Thelia\Model\Customer) {
|
||||
return $this
|
||||
->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customer->getId(), $comparison);
|
||||
} elseif ($customer instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(CouponCustomerCountTableMap::CUSTOMER_ID, $customer->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCustomer() only accepts arguments of type \Thelia\Model\Customer or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Customer relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCustomer($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Customer');
|
||||
|
||||
// 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, 'Customer');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Customer relation Customer 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\CustomerQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCustomerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCustomer($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Customer', '\Thelia\Model\CustomerQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Coupon object
|
||||
*
|
||||
* @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCoupon($coupon, $comparison = null)
|
||||
{
|
||||
if ($coupon instanceof \Thelia\Model\Coupon) {
|
||||
return $this
|
||||
->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $coupon->getId(), $comparison);
|
||||
} elseif ($coupon instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(CouponCustomerCountTableMap::COUPON_ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Coupon');
|
||||
|
||||
// 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, 'Coupon');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Coupon relation Coupon 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\CouponQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCoupon($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildCouponCustomerCount $couponCustomerCount Object to remove from the list of results
|
||||
*
|
||||
* @return ChildCouponCustomerCountQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($couponCustomerCount = null)
|
||||
{
|
||||
if ($couponCustomerCount) {
|
||||
throw new \LogicException('ChildCouponCustomerCount class has no primary key');
|
||||
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the coupon_customer_count 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(CouponCustomerCountTableMap::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).
|
||||
CouponCustomerCountTableMap::clearInstancePool();
|
||||
CouponCustomerCountTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildCouponCustomerCount or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildCouponCustomerCount 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(CouponCustomerCountTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(CouponCustomerCountTableMap::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();
|
||||
|
||||
|
||||
CouponCustomerCountTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
CouponCustomerCountTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // CouponCustomerCountQuery
|
||||
@@ -34,6 +34,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery orderByIsAvailableOnSpecialOffers($order = Criteria::ASC) Order by the is_available_on_special_offers column
|
||||
* @method ChildCouponQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column
|
||||
* @method ChildCouponQuery orderBySerializedConditions($order = Criteria::ASC) Order by the serialized_conditions column
|
||||
* @method ChildCouponQuery orderByPerCustomerUsageCount($order = Criteria::ASC) Order by the per_customer_usage_count column
|
||||
* @method ChildCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
* @method ChildCouponQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||
@@ -50,6 +51,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery groupByIsAvailableOnSpecialOffers() Group by the is_available_on_special_offers column
|
||||
* @method ChildCouponQuery groupByIsUsed() Group by the is_used column
|
||||
* @method ChildCouponQuery groupBySerializedConditions() Group by the serialized_conditions column
|
||||
* @method ChildCouponQuery groupByPerCustomerUsageCount() Group by the per_customer_usage_count column
|
||||
* @method ChildCouponQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCouponQuery groupByUpdatedAt() Group by the updated_at column
|
||||
* @method ChildCouponQuery groupByVersion() Group by the version column
|
||||
@@ -66,6 +68,10 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery rightJoinCouponModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponModule relation
|
||||
* @method ChildCouponQuery innerJoinCouponModule($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponModule relation
|
||||
*
|
||||
* @method ChildCouponQuery leftJoinCouponCustomerCount($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponCustomerCount relation
|
||||
* @method ChildCouponQuery rightJoinCouponCustomerCount($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponCustomerCount relation
|
||||
* @method ChildCouponQuery innerJoinCouponCustomerCount($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponCustomerCount relation
|
||||
*
|
||||
* @method ChildCouponQuery leftJoinCouponI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponI18n relation
|
||||
* @method ChildCouponQuery rightJoinCouponI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponI18n relation
|
||||
* @method ChildCouponQuery innerJoinCouponI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponI18n relation
|
||||
@@ -89,6 +95,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCoupon findOneByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return the first ChildCoupon filtered by the is_available_on_special_offers column
|
||||
* @method ChildCoupon findOneByIsUsed(boolean $is_used) Return the first ChildCoupon filtered by the is_used column
|
||||
* @method ChildCoupon findOneBySerializedConditions(string $serialized_conditions) Return the first ChildCoupon filtered by the serialized_conditions column
|
||||
* @method ChildCoupon findOneByPerCustomerUsageCount(boolean $per_customer_usage_count) Return the first ChildCoupon filtered by the per_customer_usage_count column
|
||||
* @method ChildCoupon findOneByCreatedAt(string $created_at) Return the first ChildCoupon filtered by the created_at column
|
||||
* @method ChildCoupon findOneByUpdatedAt(string $updated_at) Return the first ChildCoupon filtered by the updated_at column
|
||||
* @method ChildCoupon findOneByVersion(int $version) Return the first ChildCoupon filtered by the version column
|
||||
@@ -105,6 +112,7 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method array findByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return ChildCoupon objects filtered by the is_available_on_special_offers column
|
||||
* @method array findByIsUsed(boolean $is_used) Return ChildCoupon objects filtered by the is_used column
|
||||
* @method array findBySerializedConditions(string $serialized_conditions) Return ChildCoupon objects filtered by the serialized_conditions column
|
||||
* @method array findByPerCustomerUsageCount(boolean $per_customer_usage_count) Return ChildCoupon objects filtered by the per_customer_usage_count column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildCoupon objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildCoupon objects filtered by the updated_at column
|
||||
* @method array findByVersion(int $version) Return ChildCoupon objects filtered by the version column
|
||||
@@ -203,7 +211,7 @@ abstract class CouponQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$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';
|
||||
$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`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon` WHERE `ID` = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -668,6 +676,33 @@ abstract class CouponQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponTableMap::SERIALIZED_CONDITIONS, $serializedConditions, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the per_customer_usage_count column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPerCustomerUsageCount(true); // WHERE per_customer_usage_count = true
|
||||
* $query->filterByPerCustomerUsageCount('yes'); // WHERE per_customer_usage_count = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $perCustomerUsageCount The value to use as filter.
|
||||
* Non-boolean arguments are converted using the following rules:
|
||||
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
|
||||
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
|
||||
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPerCustomerUsageCount($perCustomerUsageCount = null, $comparison = null)
|
||||
{
|
||||
if (is_string($perCustomerUsageCount)) {
|
||||
$per_customer_usage_count = in_array(strtolower($perCustomerUsageCount), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponTableMap::PER_CUSTOMER_USAGE_COUNT, $perCustomerUsageCount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
@@ -941,6 +976,79 @@ abstract class CouponQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponModule', '\Thelia\Model\CouponModuleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponCustomerCount object
|
||||
*
|
||||
* @param \Thelia\Model\CouponCustomerCount|ObjectCollection $couponCustomerCount the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponCustomerCount($couponCustomerCount, $comparison = null)
|
||||
{
|
||||
if ($couponCustomerCount instanceof \Thelia\Model\CouponCustomerCount) {
|
||||
return $this
|
||||
->addUsingAlias(CouponTableMap::ID, $couponCustomerCount->getCouponId(), $comparison);
|
||||
} elseif ($couponCustomerCount instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useCouponCustomerCountQuery()
|
||||
->filterByPrimaryKeys($couponCustomerCount->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCouponCustomerCount() only accepts arguments of type \Thelia\Model\CouponCustomerCount or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CouponCustomerCount relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCouponCustomerCount($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CouponCustomerCount');
|
||||
|
||||
// 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, 'CouponCustomerCount');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CouponCustomerCount relation CouponCustomerCount 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\CouponCustomerCountQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponCustomerCountQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCouponCustomerCount($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponCustomerCount', '\Thelia\Model\CouponCustomerCountQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponI18n object
|
||||
*
|
||||
@@ -1121,6 +1229,23 @@ abstract class CouponQuery extends ModelCriteria
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Customer object
|
||||
* using the coupon_customer_count table as cross reference
|
||||
*
|
||||
* @param Customer $customer the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCustomer($customer, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useCouponCustomerCountQuery()
|
||||
->filterByCustomer($customer, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
@@ -127,6 +127,12 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
*/
|
||||
protected $serialized_conditions;
|
||||
|
||||
/**
|
||||
* The value for the per_customer_usage_count field.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $per_customer_usage_count;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -571,6 +577,17 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this->serialized_conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [per_customer_usage_count] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPerCustomerUsageCount()
|
||||
{
|
||||
|
||||
return $this->per_customer_usage_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -918,6 +935,35 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setSerializedConditions()
|
||||
|
||||
/**
|
||||
* Sets the value of the [per_customer_usage_count] column.
|
||||
* Non-boolean arguments are converted using the following rules:
|
||||
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
|
||||
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
|
||||
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
|
||||
*
|
||||
* @param boolean|integer|string $v The new value
|
||||
* @return \Thelia\Model\CouponVersion The current object (for fluent API support)
|
||||
*/
|
||||
public function setPerCustomerUsageCount($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
if (is_string($v)) {
|
||||
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
} else {
|
||||
$v = (boolean) $v;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->per_customer_usage_count !== $v) {
|
||||
$this->per_customer_usage_count = $v;
|
||||
$this->modifiedColumns[CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT] = true;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setPerCustomerUsageCount()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -1061,19 +1107,22 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponVersionTableMap::translateFieldName('SerializedConditions', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->serialized_conditions = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('PerCustomerUsageCount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->per_customer_usage_count = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::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 ? 13 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version = (null !== $col) ? (int) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
@@ -1083,7 +1132,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 15; // 15 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 16; // 16 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\CouponVersion object", 0, $e);
|
||||
@@ -1340,6 +1389,9 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_CONDITIONS)) {
|
||||
$modifiedColumns[':p' . $index++] = '`SERIALIZED_CONDITIONS`';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = '`PER_CUSTOMER_USAGE_COUNT`';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = '`CREATED_AT`';
|
||||
}
|
||||
@@ -1396,6 +1448,9 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
case '`SERIALIZED_CONDITIONS`':
|
||||
$stmt->bindValue($identifier, $this->serialized_conditions, PDO::PARAM_STR);
|
||||
break;
|
||||
case '`PER_CUSTOMER_USAGE_COUNT`':
|
||||
$stmt->bindValue($identifier, (int) $this->per_customer_usage_count, PDO::PARAM_INT);
|
||||
break;
|
||||
case '`CREATED_AT`':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1497,12 +1552,15 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this->getSerializedConditions();
|
||||
break;
|
||||
case 12:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getPerCustomerUsageCount();
|
||||
break;
|
||||
case 13:
|
||||
return $this->getUpdatedAt();
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 14:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
case 15:
|
||||
return $this->getVersion();
|
||||
break;
|
||||
default:
|
||||
@@ -1546,9 +1604,10 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$keys[9] => $this->getIsAvailableOnSpecialOffers(),
|
||||
$keys[10] => $this->getIsUsed(),
|
||||
$keys[11] => $this->getSerializedConditions(),
|
||||
$keys[12] => $this->getCreatedAt(),
|
||||
$keys[13] => $this->getUpdatedAt(),
|
||||
$keys[14] => $this->getVersion(),
|
||||
$keys[12] => $this->getPerCustomerUsageCount(),
|
||||
$keys[13] => $this->getCreatedAt(),
|
||||
$keys[14] => $this->getUpdatedAt(),
|
||||
$keys[15] => $this->getVersion(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1630,12 +1689,15 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->setSerializedConditions($value);
|
||||
break;
|
||||
case 12:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setPerCustomerUsageCount($value);
|
||||
break;
|
||||
case 13:
|
||||
$this->setUpdatedAt($value);
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 14:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
case 15:
|
||||
$this->setVersion($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1674,9 +1736,10 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[9], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setIsUsed($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setSerializedConditions($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setPerCustomerUsageCount($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setVersion($arr[$keys[15]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1700,6 +1763,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) $criteria->add(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $this->is_available_on_special_offers);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::IS_USED)) $criteria->add(CouponVersionTableMap::IS_USED, $this->is_used);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_CONDITIONS)) $criteria->add(CouponVersionTableMap::SERIALIZED_CONDITIONS, $this->serialized_conditions);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT)) $criteria->add(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT, $this->per_customer_usage_count);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) $criteria->add(CouponVersionTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::UPDATED_AT)) $criteria->add(CouponVersionTableMap::UPDATED_AT, $this->updated_at);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::VERSION)) $criteria->add(CouponVersionTableMap::VERSION, $this->version);
|
||||
@@ -1785,6 +1849,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$copyObj->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers());
|
||||
$copyObj->setIsUsed($this->getIsUsed());
|
||||
$copyObj->setSerializedConditions($this->getSerializedConditions());
|
||||
$copyObj->setPerCustomerUsageCount($this->getPerCustomerUsageCount());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
$copyObj->setVersion($this->getVersion());
|
||||
@@ -1883,6 +1948,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->is_available_on_special_offers = null;
|
||||
$this->is_used = null;
|
||||
$this->serialized_conditions = null;
|
||||
$this->per_customer_usage_count = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->version = null;
|
||||
|
||||
@@ -33,6 +33,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersionQuery orderByIsAvailableOnSpecialOffers($order = Criteria::ASC) Order by the is_available_on_special_offers column
|
||||
* @method ChildCouponVersionQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column
|
||||
* @method ChildCouponVersionQuery orderBySerializedConditions($order = Criteria::ASC) Order by the serialized_conditions column
|
||||
* @method ChildCouponVersionQuery orderByPerCustomerUsageCount($order = Criteria::ASC) Order by the per_customer_usage_count column
|
||||
* @method ChildCouponVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCouponVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
* @method ChildCouponVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||
@@ -49,6 +50,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersionQuery groupByIsAvailableOnSpecialOffers() Group by the is_available_on_special_offers column
|
||||
* @method ChildCouponVersionQuery groupByIsUsed() Group by the is_used column
|
||||
* @method ChildCouponVersionQuery groupBySerializedConditions() Group by the serialized_conditions column
|
||||
* @method ChildCouponVersionQuery groupByPerCustomerUsageCount() Group by the per_customer_usage_count column
|
||||
* @method ChildCouponVersionQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCouponVersionQuery groupByUpdatedAt() Group by the updated_at column
|
||||
* @method ChildCouponVersionQuery groupByVersion() Group by the version column
|
||||
@@ -76,6 +78,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersion findOneByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return the first ChildCouponVersion filtered by the is_available_on_special_offers column
|
||||
* @method ChildCouponVersion findOneByIsUsed(boolean $is_used) Return the first ChildCouponVersion filtered by the is_used column
|
||||
* @method ChildCouponVersion findOneBySerializedConditions(string $serialized_conditions) Return the first ChildCouponVersion filtered by the serialized_conditions column
|
||||
* @method ChildCouponVersion findOneByPerCustomerUsageCount(boolean $per_customer_usage_count) Return the first ChildCouponVersion filtered by the per_customer_usage_count column
|
||||
* @method ChildCouponVersion findOneByCreatedAt(string $created_at) Return the first ChildCouponVersion filtered by the created_at column
|
||||
* @method ChildCouponVersion findOneByUpdatedAt(string $updated_at) Return the first ChildCouponVersion filtered by the updated_at column
|
||||
* @method ChildCouponVersion findOneByVersion(int $version) Return the first ChildCouponVersion filtered by the version column
|
||||
@@ -92,6 +95,7 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method array findByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return ChildCouponVersion objects filtered by the is_available_on_special_offers column
|
||||
* @method array findByIsUsed(boolean $is_used) Return ChildCouponVersion objects filtered by the is_used column
|
||||
* @method array findBySerializedConditions(string $serialized_conditions) Return ChildCouponVersion objects filtered by the serialized_conditions column
|
||||
* @method array findByPerCustomerUsageCount(boolean $per_customer_usage_count) Return ChildCouponVersion objects filtered by the per_customer_usage_count column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildCouponVersion objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildCouponVersion objects filtered by the updated_at column
|
||||
* @method array findByVersion(int $version) Return ChildCouponVersion objects filtered by the version column
|
||||
@@ -183,7 +187,7 @@ abstract class CouponVersionQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$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';
|
||||
$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`, `PER_CUSTOMER_USAGE_COUNT`, `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);
|
||||
@@ -662,6 +666,33 @@ abstract class CouponVersionQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponVersionTableMap::SERIALIZED_CONDITIONS, $serializedConditions, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the per_customer_usage_count column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPerCustomerUsageCount(true); // WHERE per_customer_usage_count = true
|
||||
* $query->filterByPerCustomerUsageCount('yes'); // WHERE per_customer_usage_count = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $perCustomerUsageCount The value to use as filter.
|
||||
* Non-boolean arguments are converted using the following rules:
|
||||
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
|
||||
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
|
||||
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponVersionQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPerCustomerUsageCount($perCustomerUsageCount = null, $comparison = null)
|
||||
{
|
||||
if (is_string($perCustomerUsageCount)) {
|
||||
$per_customer_usage_count = in_array(strtolower($perCustomerUsageCount), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT, $perCustomerUsageCount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -21,6 +21,10 @@ use Thelia\Model\Address as ChildAddress;
|
||||
use Thelia\Model\AddressQuery as ChildAddressQuery;
|
||||
use Thelia\Model\Cart as ChildCart;
|
||||
use Thelia\Model\CartQuery as ChildCartQuery;
|
||||
use Thelia\Model\Coupon as ChildCoupon;
|
||||
use Thelia\Model\CouponCustomerCount as ChildCouponCustomerCount;
|
||||
use Thelia\Model\CouponCustomerCountQuery as ChildCouponCustomerCountQuery;
|
||||
use Thelia\Model\CouponQuery as ChildCouponQuery;
|
||||
use Thelia\Model\Customer as ChildCustomer;
|
||||
use Thelia\Model\CustomerQuery as ChildCustomerQuery;
|
||||
use Thelia\Model\CustomerTitle as ChildCustomerTitle;
|
||||
@@ -182,6 +186,17 @@ abstract class Customer implements ActiveRecordInterface
|
||||
protected $collCarts;
|
||||
protected $collCartsPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildCouponCustomerCount[] Collection to store aggregation of ChildCouponCustomerCount objects.
|
||||
*/
|
||||
protected $collCouponCustomerCounts;
|
||||
protected $collCouponCustomerCountsPartial;
|
||||
|
||||
/**
|
||||
* @var ChildCoupon[] Collection to store aggregation of ChildCoupon objects.
|
||||
*/
|
||||
protected $collCoupons;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
@@ -190,6 +205,12 @@ abstract class Customer implements ActiveRecordInterface
|
||||
*/
|
||||
protected $alreadyInSave = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $couponsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
@@ -208,6 +229,12 @@ abstract class Customer implements ActiveRecordInterface
|
||||
*/
|
||||
protected $cartsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $couponCustomerCountsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Initializes internal state of Thelia\Model\Base\Customer object.
|
||||
*/
|
||||
@@ -1169,6 +1196,9 @@ abstract class Customer implements ActiveRecordInterface
|
||||
|
||||
$this->collCarts = null;
|
||||
|
||||
$this->collCouponCustomerCounts = null;
|
||||
|
||||
$this->collCoupons = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -1314,6 +1344,33 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->couponsScheduledForDeletion !== null) {
|
||||
if (!$this->couponsScheduledForDeletion->isEmpty()) {
|
||||
$pks = array();
|
||||
$pk = $this->getPrimaryKey();
|
||||
foreach ($this->couponsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||
$pks[] = array($pk, $remotePk);
|
||||
}
|
||||
|
||||
CouponCustomerCountQuery::create()
|
||||
->filterByPrimaryKeys($pks)
|
||||
->delete($con);
|
||||
$this->couponsScheduledForDeletion = null;
|
||||
}
|
||||
|
||||
foreach ($this->getCoupons() as $coupon) {
|
||||
if ($coupon->isModified()) {
|
||||
$coupon->save($con);
|
||||
}
|
||||
}
|
||||
} elseif ($this->collCoupons) {
|
||||
foreach ($this->collCoupons as $coupon) {
|
||||
if ($coupon->isModified()) {
|
||||
$coupon->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->addressesScheduledForDeletion !== null) {
|
||||
if (!$this->addressesScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\AddressQuery::create()
|
||||
@@ -1365,6 +1422,23 @@ abstract class Customer implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->couponCustomerCountsScheduledForDeletion !== null) {
|
||||
if (!$this->couponCustomerCountsScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\CouponCustomerCountQuery::create()
|
||||
->filterByPrimaryKeys($this->couponCustomerCountsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->couponCustomerCountsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collCouponCustomerCounts !== null) {
|
||||
foreach ($this->collCouponCustomerCounts as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -1672,6 +1746,9 @@ abstract class Customer implements ActiveRecordInterface
|
||||
if (null !== $this->collCarts) {
|
||||
$result['Carts'] = $this->collCarts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collCouponCustomerCounts) {
|
||||
$result['CouponCustomerCounts'] = $this->collCouponCustomerCounts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -1923,6 +2000,12 @@ abstract class Customer implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getCouponCustomerCounts() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCouponCustomerCount($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
} // if ($deepCopy)
|
||||
|
||||
if ($makeNew) {
|
||||
@@ -2024,6 +2107,9 @@ abstract class Customer implements ActiveRecordInterface
|
||||
if ('Cart' == $relationName) {
|
||||
return $this->initCarts();
|
||||
}
|
||||
if ('CouponCustomerCount' == $relationName) {
|
||||
return $this->initCouponCustomerCounts();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2980,6 +3066,432 @@ abstract class Customer implements ActiveRecordInterface
|
||||
return $this->getCarts($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCouponCustomerCounts 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 addCouponCustomerCounts()
|
||||
*/
|
||||
public function clearCouponCustomerCounts()
|
||||
{
|
||||
$this->collCouponCustomerCounts = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collCouponCustomerCounts collection loaded partially.
|
||||
*/
|
||||
public function resetPartialCouponCustomerCounts($v = true)
|
||||
{
|
||||
$this->collCouponCustomerCountsPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCouponCustomerCounts collection.
|
||||
*
|
||||
* By default this just sets the collCouponCustomerCounts collection to an empty array (like clearcollCouponCustomerCounts());
|
||||
* 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.
|
||||
*
|
||||
* @param boolean $overrideExisting If set to true, the method call initializes
|
||||
* the collection even if it is not empty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initCouponCustomerCounts($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collCouponCustomerCounts && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collCouponCustomerCounts = new ObjectCollection();
|
||||
$this->collCouponCustomerCounts->setModel('\Thelia\Model\CouponCustomerCount');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildCouponCustomerCount 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.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildCustomer is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildCouponCustomerCount[] List of ChildCouponCustomerCount objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCouponCustomerCounts($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collCouponCustomerCountsPartial && !$this->isNew();
|
||||
if (null === $this->collCouponCustomerCounts || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCouponCustomerCounts) {
|
||||
// return empty collection
|
||||
$this->initCouponCustomerCounts();
|
||||
} else {
|
||||
$collCouponCustomerCounts = ChildCouponCustomerCountQuery::create(null, $criteria)
|
||||
->filterByCustomer($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collCouponCustomerCountsPartial && count($collCouponCustomerCounts)) {
|
||||
$this->initCouponCustomerCounts(false);
|
||||
|
||||
foreach ($collCouponCustomerCounts as $obj) {
|
||||
if (false == $this->collCouponCustomerCounts->contains($obj)) {
|
||||
$this->collCouponCustomerCounts->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCountsPartial = true;
|
||||
}
|
||||
|
||||
reset($collCouponCustomerCounts);
|
||||
|
||||
return $collCouponCustomerCounts;
|
||||
}
|
||||
|
||||
if ($partial && $this->collCouponCustomerCounts) {
|
||||
foreach ($this->collCouponCustomerCounts as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collCouponCustomerCounts[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCounts = $collCouponCustomerCounts;
|
||||
$this->collCouponCustomerCountsPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCouponCustomerCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of CouponCustomerCount 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 $couponCustomerCounts A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function setCouponCustomerCounts(Collection $couponCustomerCounts, ConnectionInterface $con = null)
|
||||
{
|
||||
$couponCustomerCountsToDelete = $this->getCouponCustomerCounts(new Criteria(), $con)->diff($couponCustomerCounts);
|
||||
|
||||
|
||||
$this->couponCustomerCountsScheduledForDeletion = $couponCustomerCountsToDelete;
|
||||
|
||||
foreach ($couponCustomerCountsToDelete as $couponCustomerCountRemoved) {
|
||||
$couponCustomerCountRemoved->setCustomer(null);
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCounts = null;
|
||||
foreach ($couponCustomerCounts as $couponCustomerCount) {
|
||||
$this->addCouponCustomerCount($couponCustomerCount);
|
||||
}
|
||||
|
||||
$this->collCouponCustomerCounts = $couponCustomerCounts;
|
||||
$this->collCouponCustomerCountsPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related CouponCustomerCount objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related CouponCustomerCount objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countCouponCustomerCounts(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collCouponCustomerCountsPartial && !$this->isNew();
|
||||
if (null === $this->collCouponCustomerCounts || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCouponCustomerCounts) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getCouponCustomerCounts());
|
||||
}
|
||||
|
||||
$query = ChildCouponCustomerCountQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByCustomer($this)
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collCouponCustomerCounts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildCouponCustomerCount object to this object
|
||||
* through the ChildCouponCustomerCount foreign key attribute.
|
||||
*
|
||||
* @param ChildCouponCustomerCount $l ChildCouponCustomerCount
|
||||
* @return \Thelia\Model\Customer The current object (for fluent API support)
|
||||
*/
|
||||
public function addCouponCustomerCount(ChildCouponCustomerCount $l)
|
||||
{
|
||||
if ($this->collCouponCustomerCounts === null) {
|
||||
$this->initCouponCustomerCounts();
|
||||
$this->collCouponCustomerCountsPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collCouponCustomerCounts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCouponCustomerCount($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CouponCustomerCount $couponCustomerCount The couponCustomerCount object to add.
|
||||
*/
|
||||
protected function doAddCouponCustomerCount($couponCustomerCount)
|
||||
{
|
||||
$this->collCouponCustomerCounts[]= $couponCustomerCount;
|
||||
$couponCustomerCount->setCustomer($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CouponCustomerCount $couponCustomerCount The couponCustomerCount object to remove.
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function removeCouponCustomerCount($couponCustomerCount)
|
||||
{
|
||||
if ($this->getCouponCustomerCounts()->contains($couponCustomerCount)) {
|
||||
$this->collCouponCustomerCounts->remove($this->collCouponCustomerCounts->search($couponCustomerCount));
|
||||
if (null === $this->couponCustomerCountsScheduledForDeletion) {
|
||||
$this->couponCustomerCountsScheduledForDeletion = clone $this->collCouponCustomerCounts;
|
||||
$this->couponCustomerCountsScheduledForDeletion->clear();
|
||||
}
|
||||
$this->couponCustomerCountsScheduledForDeletion[]= clone $couponCustomerCount;
|
||||
$couponCustomerCount->setCustomer(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Customer is new, it will return
|
||||
* an empty collection; or if this Customer has previously
|
||||
* been saved, it will retrieve related CouponCustomerCounts from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Customer.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildCouponCustomerCount[] List of ChildCouponCustomerCount objects
|
||||
*/
|
||||
public function getCouponCustomerCountsJoinCoupon($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildCouponCustomerCountQuery::create(null, $criteria);
|
||||
$query->joinWith('Coupon', $joinBehavior);
|
||||
|
||||
return $this->getCouponCustomerCounts($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCoupons 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 addCoupons()
|
||||
*/
|
||||
public function clearCoupons()
|
||||
{
|
||||
$this->collCoupons = null; // important to set this to NULL since that means it is uninitialized
|
||||
$this->collCouponsPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCoupons collection.
|
||||
*
|
||||
* By default this just sets the collCoupons collection to an empty collection (like clearCoupons());
|
||||
* 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.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initCoupons()
|
||||
{
|
||||
$this->collCoupons = new ObjectCollection();
|
||||
$this->collCoupons->setModel('\Thelia\Model\Coupon');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a collection of ChildCoupon objects related by a many-to-many relationship
|
||||
* to the current object by way of the coupon_customer_count cross-reference table.
|
||||
*
|
||||
* 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.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildCustomer is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return ObjectCollection|ChildCoupon[] List of ChildCoupon objects
|
||||
*/
|
||||
public function getCoupons($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCoupons || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCoupons) {
|
||||
// return empty collection
|
||||
$this->initCoupons();
|
||||
} else {
|
||||
$collCoupons = ChildCouponQuery::create(null, $criteria)
|
||||
->filterByCustomer($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCoupons;
|
||||
}
|
||||
$this->collCoupons = $collCoupons;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCoupons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Coupon objects related by a many-to-many relationship
|
||||
* to the current object by way of the coupon_customer_count cross-reference table.
|
||||
* 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 $coupons A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function setCoupons(Collection $coupons, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->clearCoupons();
|
||||
$currentCoupons = $this->getCoupons();
|
||||
|
||||
$this->couponsScheduledForDeletion = $currentCoupons->diff($coupons);
|
||||
|
||||
foreach ($coupons as $coupon) {
|
||||
if (!$currentCoupons->contains($coupon)) {
|
||||
$this->doAddCoupon($coupon);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCoupons = $coupons;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of ChildCoupon objects related by a many-to-many relationship
|
||||
* to the current object by way of the coupon_customer_count cross-reference table.
|
||||
*
|
||||
* @param Criteria $criteria Optional query object to filter the query
|
||||
* @param boolean $distinct Set to true to force count distinct
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
*
|
||||
* @return int the number of related ChildCoupon objects
|
||||
*/
|
||||
public function countCoupons($criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
if (null === $this->collCoupons || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCoupons) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = ChildCouponQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByCustomer($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collCoupons);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a ChildCoupon object to this object
|
||||
* through the coupon_customer_count cross reference table.
|
||||
*
|
||||
* @param ChildCoupon $coupon The ChildCouponCustomerCount object to relate
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function addCoupon(ChildCoupon $coupon)
|
||||
{
|
||||
if ($this->collCoupons === null) {
|
||||
$this->initCoupons();
|
||||
}
|
||||
|
||||
if (!$this->collCoupons->contains($coupon)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCoupon($coupon);
|
||||
$this->collCoupons[] = $coupon;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Coupon $coupon The coupon object to add.
|
||||
*/
|
||||
protected function doAddCoupon($coupon)
|
||||
{
|
||||
$couponCustomerCount = new ChildCouponCustomerCount();
|
||||
$couponCustomerCount->setCoupon($coupon);
|
||||
$this->addCouponCustomerCount($couponCustomerCount);
|
||||
// set the back reference to this object directly as using provided method either results
|
||||
// in endless loop or in multiple relations
|
||||
if (!$coupon->getCustomers()->contains($this)) {
|
||||
$foreignCollection = $coupon->getCustomers();
|
||||
$foreignCollection[] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a ChildCoupon object to this object
|
||||
* through the coupon_customer_count cross reference table.
|
||||
*
|
||||
* @param ChildCoupon $coupon The ChildCouponCustomerCount object to relate
|
||||
* @return ChildCustomer The current object (for fluent API support)
|
||||
*/
|
||||
public function removeCoupon(ChildCoupon $coupon)
|
||||
{
|
||||
if ($this->getCoupons()->contains($coupon)) {
|
||||
$this->collCoupons->remove($this->collCoupons->search($coupon));
|
||||
|
||||
if (null === $this->couponsScheduledForDeletion) {
|
||||
$this->couponsScheduledForDeletion = clone $this->collCoupons;
|
||||
$this->couponsScheduledForDeletion->clear();
|
||||
}
|
||||
|
||||
$this->couponsScheduledForDeletion[] = $coupon;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -3035,11 +3547,23 @@ abstract class Customer implements ActiveRecordInterface
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCouponCustomerCounts) {
|
||||
foreach ($this->collCouponCustomerCounts as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCoupons) {
|
||||
foreach ($this->collCoupons as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
$this->collAddresses = null;
|
||||
$this->collOrders = null;
|
||||
$this->collCarts = null;
|
||||
$this->collCouponCustomerCounts = null;
|
||||
$this->collCoupons = null;
|
||||
$this->aCustomerTitle = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,10 @@ use Thelia\Model\Map\CustomerTableMap;
|
||||
* @method ChildCustomerQuery rightJoinCart($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Cart relation
|
||||
* @method ChildCustomerQuery innerJoinCart($relationAlias = null) Adds a INNER JOIN clause to the query using the Cart relation
|
||||
*
|
||||
* @method ChildCustomerQuery leftJoinCouponCustomerCount($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponCustomerCount relation
|
||||
* @method ChildCustomerQuery rightJoinCouponCustomerCount($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponCustomerCount relation
|
||||
* @method ChildCustomerQuery innerJoinCouponCustomerCount($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponCustomerCount relation
|
||||
*
|
||||
* @method ChildCustomer findOne(ConnectionInterface $con = null) Return the first ChildCustomer matching the query
|
||||
* @method ChildCustomer findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCustomer matching the query, or a new ChildCustomer object populated from the query conditions when no match is found
|
||||
*
|
||||
@@ -1124,6 +1128,96 @@ abstract class CustomerQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'Cart', '\Thelia\Model\CartQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponCustomerCount object
|
||||
*
|
||||
* @param \Thelia\Model\CouponCustomerCount|ObjectCollection $couponCustomerCount the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCustomerQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponCustomerCount($couponCustomerCount, $comparison = null)
|
||||
{
|
||||
if ($couponCustomerCount instanceof \Thelia\Model\CouponCustomerCount) {
|
||||
return $this
|
||||
->addUsingAlias(CustomerTableMap::ID, $couponCustomerCount->getCustomerId(), $comparison);
|
||||
} elseif ($couponCustomerCount instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useCouponCustomerCountQuery()
|
||||
->filterByPrimaryKeys($couponCustomerCount->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCouponCustomerCount() only accepts arguments of type \Thelia\Model\CouponCustomerCount or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CouponCustomerCount relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCustomerQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCouponCustomerCount($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CouponCustomerCount');
|
||||
|
||||
// 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, 'CouponCustomerCount');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CouponCustomerCount relation CouponCustomerCount 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\CouponCustomerCountQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponCustomerCountQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCouponCustomerCount($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponCustomerCount', '\Thelia\Model\CouponCustomerCountQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Coupon object
|
||||
* using the coupon_customer_count table as cross reference
|
||||
*
|
||||
* @param Coupon $coupon the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCustomerQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCoupon($coupon, $comparison = Criteria::EQUAL)
|
||||
{
|
||||
return $this
|
||||
->useCouponCustomerCountQuery()
|
||||
->filterByCoupon($coupon, $comparison)
|
||||
->endUse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
@@ -143,6 +143,12 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
*/
|
||||
protected $serialized_conditions;
|
||||
|
||||
/**
|
||||
* The value for the per_customer_usage_count field.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $per_customer_usage_count;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
@@ -624,6 +630,17 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
return $this->serialized_conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [per_customer_usage_count] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPerCustomerUsageCount()
|
||||
{
|
||||
|
||||
return $this->per_customer_usage_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -965,6 +982,35 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setSerializedConditions()
|
||||
|
||||
/**
|
||||
* Sets the value of the [per_customer_usage_count] column.
|
||||
* Non-boolean arguments are converted using the following rules:
|
||||
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
|
||||
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
|
||||
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
|
||||
*
|
||||
* @param boolean|integer|string $v The new value
|
||||
* @return \Thelia\Model\OrderCoupon The current object (for fluent API support)
|
||||
*/
|
||||
public function setPerCustomerUsageCount($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
if (is_string($v)) {
|
||||
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
} else {
|
||||
$v = (boolean) $v;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->per_customer_usage_count !== $v) {
|
||||
$this->per_customer_usage_count = $v;
|
||||
$this->modifiedColumns[OrderCouponTableMap::PER_CUSTOMER_USAGE_COUNT] = true;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setPerCustomerUsageCount()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -1086,13 +1132,16 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : OrderCouponTableMap::translateFieldName('SerializedConditions', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->serialized_conditions = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderCouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : OrderCouponTableMap::translateFieldName('PerCustomerUsageCount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->per_customer_usage_count = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderCouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : OrderCouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : OrderCouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -1105,7 +1154,7 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 15; // 15 = OrderCouponTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 16; // 16 = OrderCouponTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\OrderCoupon object", 0, $e);
|
||||
@@ -1474,6 +1523,9 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(OrderCouponTableMap::SERIALIZED_CONDITIONS)) {
|
||||
$modifiedColumns[':p' . $index++] = '`SERIALIZED_CONDITIONS`';
|
||||
}
|
||||
if ($this->isColumnModified(OrderCouponTableMap::PER_CUSTOMER_USAGE_COUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = '`PER_CUSTOMER_USAGE_COUNT`';
|
||||
}
|
||||
if ($this->isColumnModified(OrderCouponTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = '`CREATED_AT`';
|
||||
}
|
||||
@@ -1530,6 +1582,9 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
case '`SERIALIZED_CONDITIONS`':
|
||||
$stmt->bindValue($identifier, $this->serialized_conditions, PDO::PARAM_STR);
|
||||
break;
|
||||
case '`PER_CUSTOMER_USAGE_COUNT`':
|
||||
$stmt->bindValue($identifier, (int) $this->per_customer_usage_count, PDO::PARAM_INT);
|
||||
break;
|
||||
case '`CREATED_AT`':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1638,9 +1693,12 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
return $this->getSerializedConditions();
|
||||
break;
|
||||
case 13:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getPerCustomerUsageCount();
|
||||
break;
|
||||
case 14:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 15:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1685,8 +1743,9 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
$keys[10] => $this->getIsRemovingPostage(),
|
||||
$keys[11] => $this->getIsAvailableOnSpecialOffers(),
|
||||
$keys[12] => $this->getSerializedConditions(),
|
||||
$keys[13] => $this->getCreatedAt(),
|
||||
$keys[14] => $this->getUpdatedAt(),
|
||||
$keys[13] => $this->getPerCustomerUsageCount(),
|
||||
$keys[14] => $this->getCreatedAt(),
|
||||
$keys[15] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1777,9 +1836,12 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
$this->setSerializedConditions($value);
|
||||
break;
|
||||
case 13:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setPerCustomerUsageCount($value);
|
||||
break;
|
||||
case 14:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 15:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1819,8 +1881,9 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[10], $arr)) $this->setIsRemovingPostage($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setSerializedConditions($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setPerCustomerUsageCount($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setCreatedAt($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setUpdatedAt($arr[$keys[15]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1845,6 +1908,7 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(OrderCouponTableMap::IS_REMOVING_POSTAGE)) $criteria->add(OrderCouponTableMap::IS_REMOVING_POSTAGE, $this->is_removing_postage);
|
||||
if ($this->isColumnModified(OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) $criteria->add(OrderCouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $this->is_available_on_special_offers);
|
||||
if ($this->isColumnModified(OrderCouponTableMap::SERIALIZED_CONDITIONS)) $criteria->add(OrderCouponTableMap::SERIALIZED_CONDITIONS, $this->serialized_conditions);
|
||||
if ($this->isColumnModified(OrderCouponTableMap::PER_CUSTOMER_USAGE_COUNT)) $criteria->add(OrderCouponTableMap::PER_CUSTOMER_USAGE_COUNT, $this->per_customer_usage_count);
|
||||
if ($this->isColumnModified(OrderCouponTableMap::CREATED_AT)) $criteria->add(OrderCouponTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(OrderCouponTableMap::UPDATED_AT)) $criteria->add(OrderCouponTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1922,6 +1986,7 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
$copyObj->setIsRemovingPostage($this->getIsRemovingPostage());
|
||||
$copyObj->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers());
|
||||
$copyObj->setSerializedConditions($this->getSerializedConditions());
|
||||
$copyObj->setPerCustomerUsageCount($this->getPerCustomerUsageCount());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
|
||||
@@ -2918,6 +2983,7 @@ abstract class OrderCoupon implements ActiveRecordInterface
|
||||
$this->is_removing_postage = null;
|
||||
$this->is_available_on_special_offers = null;
|
||||
$this->serialized_conditions = null;
|
||||
$this->per_customer_usage_count = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
@@ -34,6 +34,7 @@ use Thelia\Model\Map\OrderCouponTableMap;
|
||||
* @method ChildOrderCouponQuery orderByIsRemovingPostage($order = Criteria::ASC) Order by the is_removing_postage column
|
||||
* @method ChildOrderCouponQuery orderByIsAvailableOnSpecialOffers($order = Criteria::ASC) Order by the is_available_on_special_offers column
|
||||
* @method ChildOrderCouponQuery orderBySerializedConditions($order = Criteria::ASC) Order by the serialized_conditions column
|
||||
* @method ChildOrderCouponQuery orderByPerCustomerUsageCount($order = Criteria::ASC) Order by the per_customer_usage_count column
|
||||
* @method ChildOrderCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildOrderCouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
@@ -50,6 +51,7 @@ use Thelia\Model\Map\OrderCouponTableMap;
|
||||
* @method ChildOrderCouponQuery groupByIsRemovingPostage() Group by the is_removing_postage column
|
||||
* @method ChildOrderCouponQuery groupByIsAvailableOnSpecialOffers() Group by the is_available_on_special_offers column
|
||||
* @method ChildOrderCouponQuery groupBySerializedConditions() Group by the serialized_conditions column
|
||||
* @method ChildOrderCouponQuery groupByPerCustomerUsageCount() Group by the per_customer_usage_count column
|
||||
* @method ChildOrderCouponQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildOrderCouponQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -85,6 +87,7 @@ use Thelia\Model\Map\OrderCouponTableMap;
|
||||
* @method ChildOrderCoupon findOneByIsRemovingPostage(boolean $is_removing_postage) Return the first ChildOrderCoupon filtered by the is_removing_postage column
|
||||
* @method ChildOrderCoupon findOneByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return the first ChildOrderCoupon filtered by the is_available_on_special_offers column
|
||||
* @method ChildOrderCoupon findOneBySerializedConditions(string $serialized_conditions) Return the first ChildOrderCoupon filtered by the serialized_conditions column
|
||||
* @method ChildOrderCoupon findOneByPerCustomerUsageCount(boolean $per_customer_usage_count) Return the first ChildOrderCoupon filtered by the per_customer_usage_count column
|
||||
* @method ChildOrderCoupon findOneByCreatedAt(string $created_at) Return the first ChildOrderCoupon filtered by the created_at column
|
||||
* @method ChildOrderCoupon findOneByUpdatedAt(string $updated_at) Return the first ChildOrderCoupon filtered by the updated_at column
|
||||
*
|
||||
@@ -101,6 +104,7 @@ use Thelia\Model\Map\OrderCouponTableMap;
|
||||
* @method array findByIsRemovingPostage(boolean $is_removing_postage) Return ChildOrderCoupon objects filtered by the is_removing_postage column
|
||||
* @method array findByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return ChildOrderCoupon objects filtered by the is_available_on_special_offers column
|
||||
* @method array findBySerializedConditions(string $serialized_conditions) Return ChildOrderCoupon objects filtered by the serialized_conditions column
|
||||
* @method array findByPerCustomerUsageCount(boolean $per_customer_usage_count) Return ChildOrderCoupon objects filtered by the per_customer_usage_count column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildOrderCoupon objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildOrderCoupon objects filtered by the updated_at column
|
||||
*
|
||||
@@ -191,7 +195,7 @@ abstract class OrderCouponQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT `ID`, `ORDER_ID`, `CODE`, `TYPE`, `AMOUNT`, `TITLE`, `SHORT_DESCRIPTION`, `DESCRIPTION`, `EXPIRATION_DATE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `SERIALIZED_CONDITIONS`, `CREATED_AT`, `UPDATED_AT` FROM `order_coupon` WHERE `ID` = :p0';
|
||||
$sql = 'SELECT `ID`, `ORDER_ID`, `CODE`, `TYPE`, `AMOUNT`, `TITLE`, `SHORT_DESCRIPTION`, `DESCRIPTION`, `EXPIRATION_DATE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT` FROM `order_coupon` WHERE `ID` = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -703,6 +707,33 @@ abstract class OrderCouponQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(OrderCouponTableMap::SERIALIZED_CONDITIONS, $serializedConditions, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the per_customer_usage_count column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPerCustomerUsageCount(true); // WHERE per_customer_usage_count = true
|
||||
* $query->filterByPerCustomerUsageCount('yes'); // WHERE per_customer_usage_count = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $perCustomerUsageCount The value to use as filter.
|
||||
* Non-boolean arguments are converted using the following rules:
|
||||
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
|
||||
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
|
||||
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPerCustomerUsageCount($perCustomerUsageCount = null, $comparison = null)
|
||||
{
|
||||
if (is_string($perCustomerUsageCount)) {
|
||||
$per_customer_usage_count = in_array(strtolower($perCustomerUsageCount), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderCouponTableMap::PER_CUSTOMER_USAGE_COUNT, $perCustomerUsageCount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user