Added coupon_country and coupon_module tables
This commit is contained in:
@@ -25,6 +25,10 @@ use Thelia\Model\Country as ChildCountry;
|
|||||||
use Thelia\Model\CountryI18n as ChildCountryI18n;
|
use Thelia\Model\CountryI18n as ChildCountryI18n;
|
||||||
use Thelia\Model\CountryI18nQuery as ChildCountryI18nQuery;
|
use Thelia\Model\CountryI18nQuery as ChildCountryI18nQuery;
|
||||||
use Thelia\Model\CountryQuery as ChildCountryQuery;
|
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\CouponQuery as ChildCouponQuery;
|
||||||
use Thelia\Model\TaxRuleCountry as ChildTaxRuleCountry;
|
use Thelia\Model\TaxRuleCountry as ChildTaxRuleCountry;
|
||||||
use Thelia\Model\TaxRuleCountryQuery as ChildTaxRuleCountryQuery;
|
use Thelia\Model\TaxRuleCountryQuery as ChildTaxRuleCountryQuery;
|
||||||
use Thelia\Model\Map\CountryTableMap;
|
use Thelia\Model\Map\CountryTableMap;
|
||||||
@@ -136,12 +140,23 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
protected $collAddresses;
|
protected $collAddresses;
|
||||||
protected $collAddressesPartial;
|
protected $collAddressesPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ObjectCollection|ChildCouponCountry[] Collection to store aggregation of ChildCouponCountry objects.
|
||||||
|
*/
|
||||||
|
protected $collCouponCountries;
|
||||||
|
protected $collCouponCountriesPartial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ObjectCollection|ChildCountryI18n[] Collection to store aggregation of ChildCountryI18n objects.
|
* @var ObjectCollection|ChildCountryI18n[] Collection to store aggregation of ChildCountryI18n objects.
|
||||||
*/
|
*/
|
||||||
protected $collCountryI18ns;
|
protected $collCountryI18ns;
|
||||||
protected $collCountryI18nsPartial;
|
protected $collCountryI18nsPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ChildCoupon[] Collection to store aggregation of ChildCoupon objects.
|
||||||
|
*/
|
||||||
|
protected $collCoupons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
* by another object which falls in this transaction.
|
* by another object which falls in this transaction.
|
||||||
@@ -164,6 +179,12 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $currentTranslations;
|
protected $currentTranslations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var ObjectCollection
|
||||||
|
*/
|
||||||
|
protected $couponsScheduledForDeletion = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var ObjectCollection
|
* @var ObjectCollection
|
||||||
@@ -176,6 +197,12 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $addressesScheduledForDeletion = null;
|
protected $addressesScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var ObjectCollection
|
||||||
|
*/
|
||||||
|
protected $couponCountriesScheduledForDeletion = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var ObjectCollection
|
* @var ObjectCollection
|
||||||
@@ -926,8 +953,11 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
|
|
||||||
$this->collAddresses = null;
|
$this->collAddresses = null;
|
||||||
|
|
||||||
|
$this->collCouponCountries = null;
|
||||||
|
|
||||||
$this->collCountryI18ns = null;
|
$this->collCountryI18ns = null;
|
||||||
|
|
||||||
|
$this->collCoupons = null;
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1073,6 +1103,33 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
$this->resetModified();
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
|
CouponCountryQuery::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->taxRuleCountriesScheduledForDeletion !== null) {
|
if ($this->taxRuleCountriesScheduledForDeletion !== null) {
|
||||||
if (!$this->taxRuleCountriesScheduledForDeletion->isEmpty()) {
|
if (!$this->taxRuleCountriesScheduledForDeletion->isEmpty()) {
|
||||||
\Thelia\Model\TaxRuleCountryQuery::create()
|
\Thelia\Model\TaxRuleCountryQuery::create()
|
||||||
@@ -1107,6 +1164,23 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->couponCountriesScheduledForDeletion !== null) {
|
||||||
|
if (!$this->couponCountriesScheduledForDeletion->isEmpty()) {
|
||||||
|
\Thelia\Model\CouponCountryQuery::create()
|
||||||
|
->filterByPrimaryKeys($this->couponCountriesScheduledForDeletion->getPrimaryKeys(false))
|
||||||
|
->delete($con);
|
||||||
|
$this->couponCountriesScheduledForDeletion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collCouponCountries !== null) {
|
||||||
|
foreach ($this->collCouponCountries as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->countryI18nsScheduledForDeletion !== null) {
|
if ($this->countryI18nsScheduledForDeletion !== null) {
|
||||||
if (!$this->countryI18nsScheduledForDeletion->isEmpty()) {
|
if (!$this->countryI18nsScheduledForDeletion->isEmpty()) {
|
||||||
\Thelia\Model\CountryI18nQuery::create()
|
\Thelia\Model\CountryI18nQuery::create()
|
||||||
@@ -1358,6 +1432,9 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
if (null !== $this->collAddresses) {
|
if (null !== $this->collAddresses) {
|
||||||
$result['Addresses'] = $this->collAddresses->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['Addresses'] = $this->collAddresses->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->collCouponCountries) {
|
||||||
|
$result['CouponCountries'] = $this->collCouponCountries->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
|
}
|
||||||
if (null !== $this->collCountryI18ns) {
|
if (null !== $this->collCountryI18ns) {
|
||||||
$result['CountryI18ns'] = $this->collCountryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['CountryI18ns'] = $this->collCountryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
@@ -1564,6 +1641,12 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->getCouponCountries() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addCouponCountry($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->getCountryI18ns() as $relObj) {
|
foreach ($this->getCountryI18ns() as $relObj) {
|
||||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
$copyObj->addCountryI18n($relObj->copy($deepCopy));
|
$copyObj->addCountryI18n($relObj->copy($deepCopy));
|
||||||
@@ -1668,6 +1751,9 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
if ('Address' == $relationName) {
|
if ('Address' == $relationName) {
|
||||||
return $this->initAddresses();
|
return $this->initAddresses();
|
||||||
}
|
}
|
||||||
|
if ('CouponCountry' == $relationName) {
|
||||||
|
return $this->initCouponCountries();
|
||||||
|
}
|
||||||
if ('CountryI18n' == $relationName) {
|
if ('CountryI18n' == $relationName) {
|
||||||
return $this->initCountryI18ns();
|
return $this->initCountryI18ns();
|
||||||
}
|
}
|
||||||
@@ -2212,6 +2298,252 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
return $this->getAddresses($query, $con);
|
return $this->getAddresses($query, $con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collCouponCountries 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 addCouponCountries()
|
||||||
|
*/
|
||||||
|
public function clearCouponCountries()
|
||||||
|
{
|
||||||
|
$this->collCouponCountries = null; // important to set this to NULL since that means it is uninitialized
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset is the collCouponCountries collection loaded partially.
|
||||||
|
*/
|
||||||
|
public function resetPartialCouponCountries($v = true)
|
||||||
|
{
|
||||||
|
$this->collCouponCountriesPartial = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collCouponCountries collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collCouponCountries collection to an empty array (like clearcollCouponCountries());
|
||||||
|
* 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 initCouponCountries($overrideExisting = true)
|
||||||
|
{
|
||||||
|
if (null !== $this->collCouponCountries && !$overrideExisting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->collCouponCountries = new ObjectCollection();
|
||||||
|
$this->collCouponCountries->setModel('\Thelia\Model\CouponCountry');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of ChildCouponCountry 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 ChildCountry 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|ChildCouponCountry[] List of ChildCouponCountry objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getCouponCountries($criteria = null, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collCouponCountriesPartial && !$this->isNew();
|
||||||
|
if (null === $this->collCouponCountries || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collCouponCountries) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initCouponCountries();
|
||||||
|
} else {
|
||||||
|
$collCouponCountries = ChildCouponCountryQuery::create(null, $criteria)
|
||||||
|
->filterByCountry($this)
|
||||||
|
->find($con);
|
||||||
|
|
||||||
|
if (null !== $criteria) {
|
||||||
|
if (false !== $this->collCouponCountriesPartial && count($collCouponCountries)) {
|
||||||
|
$this->initCouponCountries(false);
|
||||||
|
|
||||||
|
foreach ($collCouponCountries as $obj) {
|
||||||
|
if (false == $this->collCouponCountries->contains($obj)) {
|
||||||
|
$this->collCouponCountries->append($obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCouponCountriesPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset($collCouponCountries);
|
||||||
|
|
||||||
|
return $collCouponCountries;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($partial && $this->collCouponCountries) {
|
||||||
|
foreach ($this->collCouponCountries as $obj) {
|
||||||
|
if ($obj->isNew()) {
|
||||||
|
$collCouponCountries[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCouponCountries = $collCouponCountries;
|
||||||
|
$this->collCouponCountriesPartial = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->collCouponCountries;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a collection of CouponCountry 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 $couponCountries A Propel collection.
|
||||||
|
* @param ConnectionInterface $con Optional connection object
|
||||||
|
* @return ChildCountry The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setCouponCountries(Collection $couponCountries, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$couponCountriesToDelete = $this->getCouponCountries(new Criteria(), $con)->diff($couponCountries);
|
||||||
|
|
||||||
|
|
||||||
|
//since at least one column in the foreign key is at the same time a PK
|
||||||
|
//we can not just set a PK to NULL in the lines below. We have to store
|
||||||
|
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
|
||||||
|
$this->couponCountriesScheduledForDeletion = clone $couponCountriesToDelete;
|
||||||
|
|
||||||
|
foreach ($couponCountriesToDelete as $couponCountryRemoved) {
|
||||||
|
$couponCountryRemoved->setCountry(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCouponCountries = null;
|
||||||
|
foreach ($couponCountries as $couponCountry) {
|
||||||
|
$this->addCouponCountry($couponCountry);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCouponCountries = $couponCountries;
|
||||||
|
$this->collCouponCountriesPartial = false;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related CouponCountry objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param ConnectionInterface $con
|
||||||
|
* @return int Count of related CouponCountry objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countCouponCountries(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collCouponCountriesPartial && !$this->isNew();
|
||||||
|
if (null === $this->collCouponCountries || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collCouponCountries) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($partial && !$criteria) {
|
||||||
|
return count($this->getCouponCountries());
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = ChildCouponCountryQuery::create(null, $criteria);
|
||||||
|
if ($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->filterByCountry($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
return count($this->collCouponCountries);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a ChildCouponCountry object to this object
|
||||||
|
* through the ChildCouponCountry foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param ChildCouponCountry $l ChildCouponCountry
|
||||||
|
* @return \Thelia\Model\Country The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function addCouponCountry(ChildCouponCountry $l)
|
||||||
|
{
|
||||||
|
if ($this->collCouponCountries === null) {
|
||||||
|
$this->initCouponCountries();
|
||||||
|
$this->collCouponCountriesPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!in_array($l, $this->collCouponCountries->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->doAddCouponCountry($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CouponCountry $couponCountry The couponCountry object to add.
|
||||||
|
*/
|
||||||
|
protected function doAddCouponCountry($couponCountry)
|
||||||
|
{
|
||||||
|
$this->collCouponCountries[]= $couponCountry;
|
||||||
|
$couponCountry->setCountry($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CouponCountry $couponCountry The couponCountry object to remove.
|
||||||
|
* @return ChildCountry The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function removeCouponCountry($couponCountry)
|
||||||
|
{
|
||||||
|
if ($this->getCouponCountries()->contains($couponCountry)) {
|
||||||
|
$this->collCouponCountries->remove($this->collCouponCountries->search($couponCountry));
|
||||||
|
if (null === $this->couponCountriesScheduledForDeletion) {
|
||||||
|
$this->couponCountriesScheduledForDeletion = clone $this->collCouponCountries;
|
||||||
|
$this->couponCountriesScheduledForDeletion->clear();
|
||||||
|
}
|
||||||
|
$this->couponCountriesScheduledForDeletion[]= clone $couponCountry;
|
||||||
|
$couponCountry->setCountry(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this collection has already been initialized with
|
||||||
|
* an identical criteria, it returns the collection.
|
||||||
|
* Otherwise if this Country is new, it will return
|
||||||
|
* an empty collection; or if this Country has previously
|
||||||
|
* been saved, it will retrieve related CouponCountries 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 Country.
|
||||||
|
*
|
||||||
|
* @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|ChildCouponCountry[] List of ChildCouponCountry objects
|
||||||
|
*/
|
||||||
|
public function getCouponCountriesJoinCoupon($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$query = ChildCouponCountryQuery::create(null, $criteria);
|
||||||
|
$query->joinWith('Coupon', $joinBehavior);
|
||||||
|
|
||||||
|
return $this->getCouponCountries($query, $con);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the collCountryI18ns collection
|
* Clears out the collCountryI18ns collection
|
||||||
*
|
*
|
||||||
@@ -2437,6 +2769,189 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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_country 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 ChildCountry 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)
|
||||||
|
->filterByCountry($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_country 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 ChildCountry 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_country 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
|
||||||
|
->filterByCountry($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return count($this->collCoupons);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associate a ChildCoupon object to this object
|
||||||
|
* through the coupon_country cross reference table.
|
||||||
|
*
|
||||||
|
* @param ChildCoupon $coupon The ChildCouponCountry object to relate
|
||||||
|
* @return ChildCountry 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)
|
||||||
|
{
|
||||||
|
$couponCountry = new ChildCouponCountry();
|
||||||
|
$couponCountry->setCoupon($coupon);
|
||||||
|
$this->addCouponCountry($couponCountry);
|
||||||
|
// set the back reference to this object directly as using provided method either results
|
||||||
|
// in endless loop or in multiple relations
|
||||||
|
if (!$coupon->getCountries()->contains($this)) {
|
||||||
|
$foreignCollection = $coupon->getCountries();
|
||||||
|
$foreignCollection[] = $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a ChildCoupon object to this object
|
||||||
|
* through the coupon_country cross reference table.
|
||||||
|
*
|
||||||
|
* @param ChildCoupon $coupon The ChildCouponCountry object to relate
|
||||||
|
* @return ChildCountry 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
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
@@ -2481,11 +2996,21 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collCouponCountries) {
|
||||||
|
foreach ($this->collCouponCountries as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->collCountryI18ns) {
|
if ($this->collCountryI18ns) {
|
||||||
foreach ($this->collCountryI18ns as $o) {
|
foreach ($this->collCountryI18ns as $o) {
|
||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collCoupons) {
|
||||||
|
foreach ($this->collCoupons as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // if ($deep)
|
} // if ($deep)
|
||||||
|
|
||||||
// i18n behavior
|
// i18n behavior
|
||||||
@@ -2494,7 +3019,9 @@ abstract class Country implements ActiveRecordInterface
|
|||||||
|
|
||||||
$this->collTaxRuleCountries = null;
|
$this->collTaxRuleCountries = null;
|
||||||
$this->collAddresses = null;
|
$this->collAddresses = null;
|
||||||
|
$this->collCouponCountries = null;
|
||||||
$this->collCountryI18ns = null;
|
$this->collCountryI18ns = null;
|
||||||
|
$this->collCoupons = null;
|
||||||
$this->aArea = null;
|
$this->aArea = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ use Thelia\Model\Map\CountryTableMap;
|
|||||||
* @method ChildCountryQuery rightJoinAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Address relation
|
* @method ChildCountryQuery rightJoinAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Address relation
|
||||||
* @method ChildCountryQuery innerJoinAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the Address relation
|
* @method ChildCountryQuery innerJoinAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the Address relation
|
||||||
*
|
*
|
||||||
|
* @method ChildCountryQuery leftJoinCouponCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponCountry relation
|
||||||
|
* @method ChildCountryQuery rightJoinCouponCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponCountry relation
|
||||||
|
* @method ChildCountryQuery innerJoinCouponCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponCountry relation
|
||||||
|
*
|
||||||
* @method ChildCountryQuery leftJoinCountryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CountryI18n relation
|
* @method ChildCountryQuery leftJoinCountryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CountryI18n relation
|
||||||
* @method ChildCountryQuery rightJoinCountryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CountryI18n relation
|
* @method ChildCountryQuery rightJoinCountryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CountryI18n relation
|
||||||
* @method ChildCountryQuery innerJoinCountryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CountryI18n relation
|
* @method ChildCountryQuery innerJoinCountryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CountryI18n relation
|
||||||
@@ -807,6 +811,79 @@ abstract class CountryQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'Address', '\Thelia\Model\AddressQuery');
|
->useQuery($relationAlias ? $relationAlias : 'Address', '\Thelia\Model\AddressQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\CouponCountry object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CouponCountry|ObjectCollection $couponCountry the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCouponCountry($couponCountry, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($couponCountry instanceof \Thelia\Model\CouponCountry) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CountryTableMap::ID, $couponCountry->getCountryId(), $comparison);
|
||||||
|
} elseif ($couponCountry instanceof ObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useCouponCountryQuery()
|
||||||
|
->filterByPrimaryKeys($couponCountry->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCouponCountry() only accepts arguments of type \Thelia\Model\CouponCountry or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CouponCountry relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCouponCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CouponCountry');
|
||||||
|
|
||||||
|
// 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, 'CouponCountry');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CouponCountry relation CouponCountry 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\CouponCountryQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCouponCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCouponCountry($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CouponCountry', '\Thelia\Model\CouponCountryQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related \Thelia\Model\CountryI18n object
|
* Filter the query by a related \Thelia\Model\CountryI18n object
|
||||||
*
|
*
|
||||||
@@ -880,6 +957,23 @@ abstract class CountryQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'CountryI18n', '\Thelia\Model\CountryI18nQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CountryI18n', '\Thelia\Model\CountryI18nQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related Coupon object
|
||||||
|
* using the coupon_country 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 ChildCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCoupon($coupon, $comparison = Criteria::EQUAL)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->useCouponCountryQuery()
|
||||||
|
->filterByCoupon($coupon, $comparison)
|
||||||
|
->endUse();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
1268
core/lib/Thelia/Model/Base/CouponCountry.php
Normal file
1268
core/lib/Thelia/Model/Base/CouponCountry.php
Normal file
File diff suppressed because it is too large
Load Diff
568
core/lib/Thelia/Model/Base/CouponCountryQuery.php
Normal file
568
core/lib/Thelia/Model/Base/CouponCountryQuery.php
Normal file
@@ -0,0 +1,568 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\Base;
|
||||||
|
|
||||||
|
use \Exception;
|
||||||
|
use \PDO;
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||||
|
use Propel\Runtime\Collection\Collection;
|
||||||
|
use Propel\Runtime\Collection\ObjectCollection;
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Thelia\Model\CouponCountry as ChildCouponCountry;
|
||||||
|
use Thelia\Model\CouponCountryQuery as ChildCouponCountryQuery;
|
||||||
|
use Thelia\Model\Map\CouponCountryTableMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'coupon_country' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method ChildCouponCountryQuery orderByCouponId($order = Criteria::ASC) Order by the coupon_id column
|
||||||
|
* @method ChildCouponCountryQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
|
||||||
|
*
|
||||||
|
* @method ChildCouponCountryQuery groupByCouponId() Group by the coupon_id column
|
||||||
|
* @method ChildCouponCountryQuery groupByCountryId() Group by the country_id column
|
||||||
|
*
|
||||||
|
* @method ChildCouponCountryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method ChildCouponCountryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method ChildCouponCountryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method ChildCouponCountryQuery leftJoinCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the Country relation
|
||||||
|
* @method ChildCouponCountryQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
|
||||||
|
* @method ChildCouponCountryQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
|
||||||
|
*
|
||||||
|
* @method ChildCouponCountryQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
|
||||||
|
* @method ChildCouponCountryQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
|
||||||
|
* @method ChildCouponCountryQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
|
||||||
|
*
|
||||||
|
* @method ChildCouponCountry findOne(ConnectionInterface $con = null) Return the first ChildCouponCountry matching the query
|
||||||
|
* @method ChildCouponCountry findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponCountry matching the query, or a new ChildCouponCountry object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method ChildCouponCountry findOneByCouponId(int $coupon_id) Return the first ChildCouponCountry filtered by the coupon_id column
|
||||||
|
* @method ChildCouponCountry findOneByCountryId(int $country_id) Return the first ChildCouponCountry filtered by the country_id column
|
||||||
|
*
|
||||||
|
* @method array findByCouponId(int $coupon_id) Return ChildCouponCountry objects filtered by the coupon_id column
|
||||||
|
* @method array findByCountryId(int $country_id) Return ChildCouponCountry objects filtered by the country_id column
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
abstract class CouponCountryQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of \Thelia\Model\Base\CouponCountryQuery 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\\CouponCountry', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new ChildCouponCountryQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return ChildCouponCountryQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof \Thelia\Model\CouponCountryQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new \Thelia\Model\CouponCountryQuery();
|
||||||
|
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(array(12, 34), $con);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array[$coupon_id, $country_id] $key Primary key to use for the query
|
||||||
|
* @param ConnectionInterface $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return ChildCouponCountry|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((null !== ($obj = CouponCountryTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||||
|
// the object is already in the instance pool
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getServiceContainer()->getReadConnection(CouponCountryTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||||
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||||
|
|| $this->map || $this->having || $this->joins) {
|
||||||
|
return $this->findPkComplex($key, $con);
|
||||||
|
} else {
|
||||||
|
return $this->findPkSimple($key, $con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key using raw SQL to go fast.
|
||||||
|
* Bypass doSelect() and the object formatter by using generated code.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param ConnectionInterface $con A connection object
|
||||||
|
*
|
||||||
|
* @return ChildCouponCountry A model object, or null if the key is not found
|
||||||
|
*/
|
||||||
|
protected function findPkSimple($key, $con)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT `COUPON_ID`, `COUNTRY_ID` FROM `coupon_country` WHERE `COUPON_ID` = :p0 AND `COUNTRY_ID` = :p1';
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||||
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||||
|
$obj = new ChildCouponCountry();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
CouponCountryTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param ConnectionInterface $con A connection object
|
||||||
|
*
|
||||||
|
* @return ChildCouponCountry|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
protected function findPkComplex($key, $con)
|
||||||
|
{
|
||||||
|
// As the query uses a PK condition, no limit(1) is necessary.
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$dataFetcher = $criteria
|
||||||
|
->filterByPrimaryKey($key)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find objects by primary key
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(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)
|
||||||
|
{
|
||||||
|
if (null === $con) {
|
||||||
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$dataFetcher = $criteria
|
||||||
|
->filterByPrimaryKeys($keys)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by primary key
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->addUsingAlias(CouponCountryTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||||
|
$this->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
if (empty($keys)) {
|
||||||
|
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||||
|
}
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$cton0 = $this->getNewCriterion(CouponCountryTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||||
|
$cton1 = $this->getNewCriterion(CouponCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL);
|
||||||
|
$cton0->addAnd($cton1);
|
||||||
|
$this->addOr($cton0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 ChildCouponCountryQuery 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(CouponCountryTableMap::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($couponId['max'])) {
|
||||||
|
$this->addUsingAlias(CouponCountryTableMap::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CouponCountryTableMap::COUPON_ID, $couponId, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the country_id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByCountryId(1234); // WHERE country_id = 1234
|
||||||
|
* $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
|
||||||
|
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByCountry()
|
||||||
|
*
|
||||||
|
* @param mixed $countryId 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 ChildCouponCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCountryId($countryId = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($countryId)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($countryId['min'])) {
|
||||||
|
$this->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($countryId['max'])) {
|
||||||
|
$this->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $countryId, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\Country object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\Country|ObjectCollection $country The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCountry($country, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($country instanceof \Thelia\Model\Country) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $country->getId(), $comparison);
|
||||||
|
} elseif ($country instanceof ObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponCountryTableMap::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCountry() only accepts arguments of type \Thelia\Model\Country or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Country relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Country');
|
||||||
|
|
||||||
|
// 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, 'Country');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Country relation Country 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\CountryQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCountry($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Country', '\Thelia\Model\CountryQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 ChildCouponCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCoupon($coupon, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($coupon instanceof \Thelia\Model\Coupon) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponCountryTableMap::COUPON_ID, $coupon->getId(), $comparison);
|
||||||
|
} elseif ($coupon instanceof ObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponCountryTableMap::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 ChildCouponCountryQuery 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 ChildCouponCountry $couponCountry Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return ChildCouponCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($couponCountry = null)
|
||||||
|
{
|
||||||
|
if ($couponCountry) {
|
||||||
|
$this->addCond('pruneCond0', $this->getAliasedColName(CouponCountryTableMap::COUPON_ID), $couponCountry->getCouponId(), Criteria::NOT_EQUAL);
|
||||||
|
$this->addCond('pruneCond1', $this->getAliasedColName(CouponCountryTableMap::COUNTRY_ID), $couponCountry->getCountryId(), Criteria::NOT_EQUAL);
|
||||||
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the coupon_country 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(CouponCountryTableMap::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).
|
||||||
|
CouponCountryTableMap::clearInstancePool();
|
||||||
|
CouponCountryTableMap::clearRelatedInstancePool();
|
||||||
|
|
||||||
|
$con->commit();
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a ChildCouponCountry or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or ChildCouponCountry 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(CouponCountryTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = $this;
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(CouponCountryTableMap::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();
|
||||||
|
|
||||||
|
|
||||||
|
CouponCountryTableMap::removeInstanceFromPool($criteria);
|
||||||
|
|
||||||
|
$affectedRows += ModelCriteria::delete($con);
|
||||||
|
CouponCountryTableMap::clearRelatedInstancePool();
|
||||||
|
$con->commit();
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // CouponCountryQuery
|
||||||
1268
core/lib/Thelia/Model/Base/CouponModule.php
Normal file
1268
core/lib/Thelia/Model/Base/CouponModule.php
Normal file
File diff suppressed because it is too large
Load Diff
568
core/lib/Thelia/Model/Base/CouponModuleQuery.php
Normal file
568
core/lib/Thelia/Model/Base/CouponModuleQuery.php
Normal file
@@ -0,0 +1,568 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\Base;
|
||||||
|
|
||||||
|
use \Exception;
|
||||||
|
use \PDO;
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||||
|
use Propel\Runtime\Collection\Collection;
|
||||||
|
use Propel\Runtime\Collection\ObjectCollection;
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Thelia\Model\CouponModule as ChildCouponModule;
|
||||||
|
use Thelia\Model\CouponModuleQuery as ChildCouponModuleQuery;
|
||||||
|
use Thelia\Model\Map\CouponModuleTableMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'coupon_module' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method ChildCouponModuleQuery orderByCouponId($order = Criteria::ASC) Order by the coupon_id column
|
||||||
|
* @method ChildCouponModuleQuery orderByModuleId($order = Criteria::ASC) Order by the module_id column
|
||||||
|
*
|
||||||
|
* @method ChildCouponModuleQuery groupByCouponId() Group by the coupon_id column
|
||||||
|
* @method ChildCouponModuleQuery groupByModuleId() Group by the module_id column
|
||||||
|
*
|
||||||
|
* @method ChildCouponModuleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method ChildCouponModuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method ChildCouponModuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method ChildCouponModuleQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
|
||||||
|
* @method ChildCouponModuleQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
|
||||||
|
* @method ChildCouponModuleQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
|
||||||
|
*
|
||||||
|
* @method ChildCouponModuleQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
|
||||||
|
* @method ChildCouponModuleQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
|
||||||
|
* @method ChildCouponModuleQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
|
||||||
|
*
|
||||||
|
* @method ChildCouponModule findOne(ConnectionInterface $con = null) Return the first ChildCouponModule matching the query
|
||||||
|
* @method ChildCouponModule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponModule matching the query, or a new ChildCouponModule object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method ChildCouponModule findOneByCouponId(int $coupon_id) Return the first ChildCouponModule filtered by the coupon_id column
|
||||||
|
* @method ChildCouponModule findOneByModuleId(int $module_id) Return the first ChildCouponModule filtered by the module_id column
|
||||||
|
*
|
||||||
|
* @method array findByCouponId(int $coupon_id) Return ChildCouponModule objects filtered by the coupon_id column
|
||||||
|
* @method array findByModuleId(int $module_id) Return ChildCouponModule objects filtered by the module_id column
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
abstract class CouponModuleQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of \Thelia\Model\Base\CouponModuleQuery 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\\CouponModule', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new ChildCouponModuleQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return ChildCouponModuleQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof \Thelia\Model\CouponModuleQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new \Thelia\Model\CouponModuleQuery();
|
||||||
|
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(array(12, 34), $con);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array[$coupon_id, $module_id] $key Primary key to use for the query
|
||||||
|
* @param ConnectionInterface $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return ChildCouponModule|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((null !== ($obj = CouponModuleTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||||
|
// the object is already in the instance pool
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getServiceContainer()->getReadConnection(CouponModuleTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||||
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||||
|
|| $this->map || $this->having || $this->joins) {
|
||||||
|
return $this->findPkComplex($key, $con);
|
||||||
|
} else {
|
||||||
|
return $this->findPkSimple($key, $con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key using raw SQL to go fast.
|
||||||
|
* Bypass doSelect() and the object formatter by using generated code.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param ConnectionInterface $con A connection object
|
||||||
|
*
|
||||||
|
* @return ChildCouponModule A model object, or null if the key is not found
|
||||||
|
*/
|
||||||
|
protected function findPkSimple($key, $con)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT `COUPON_ID`, `MODULE_ID` FROM `coupon_module` WHERE `COUPON_ID` = :p0 AND `MODULE_ID` = :p1';
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||||
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||||
|
$obj = new ChildCouponModule();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
CouponModuleTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param ConnectionInterface $con A connection object
|
||||||
|
*
|
||||||
|
* @return ChildCouponModule|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
protected function findPkComplex($key, $con)
|
||||||
|
{
|
||||||
|
// As the query uses a PK condition, no limit(1) is necessary.
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$dataFetcher = $criteria
|
||||||
|
->filterByPrimaryKey($key)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find objects by primary key
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(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)
|
||||||
|
{
|
||||||
|
if (null === $con) {
|
||||||
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$dataFetcher = $criteria
|
||||||
|
->filterByPrimaryKeys($keys)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by primary key
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->addUsingAlias(CouponModuleTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||||
|
$this->addUsingAlias(CouponModuleTableMap::MODULE_ID, $key[1], Criteria::EQUAL);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
if (empty($keys)) {
|
||||||
|
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||||
|
}
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$cton0 = $this->getNewCriterion(CouponModuleTableMap::COUPON_ID, $key[0], Criteria::EQUAL);
|
||||||
|
$cton1 = $this->getNewCriterion(CouponModuleTableMap::MODULE_ID, $key[1], Criteria::EQUAL);
|
||||||
|
$cton0->addAnd($cton1);
|
||||||
|
$this->addOr($cton0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 ChildCouponModuleQuery 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(CouponModuleTableMap::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($couponId['max'])) {
|
||||||
|
$this->addUsingAlias(CouponModuleTableMap::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CouponModuleTableMap::COUPON_ID, $couponId, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the module_id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByModuleId(1234); // WHERE module_id = 1234
|
||||||
|
* $query->filterByModuleId(array(12, 34)); // WHERE module_id IN (12, 34)
|
||||||
|
* $query->filterByModuleId(array('min' => 12)); // WHERE module_id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByModule()
|
||||||
|
*
|
||||||
|
* @param mixed $moduleId 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 ChildCouponModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByModuleId($moduleId = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($moduleId)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($moduleId['min'])) {
|
||||||
|
$this->addUsingAlias(CouponModuleTableMap::MODULE_ID, $moduleId['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($moduleId['max'])) {
|
||||||
|
$this->addUsingAlias(CouponModuleTableMap::MODULE_ID, $moduleId['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CouponModuleTableMap::MODULE_ID, $moduleId, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 ChildCouponModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCoupon($coupon, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($coupon instanceof \Thelia\Model\Coupon) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponModuleTableMap::COUPON_ID, $coupon->getId(), $comparison);
|
||||||
|
} elseif ($coupon instanceof ObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponModuleTableMap::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 ChildCouponModuleQuery 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');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\Module object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByModule($module, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($module instanceof \Thelia\Model\Module) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponModuleTableMap::MODULE_ID, $module->getId(), $comparison);
|
||||||
|
} elseif ($module instanceof ObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponModuleTableMap::MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Module relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Module');
|
||||||
|
|
||||||
|
// 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, 'Module');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Module relation Module 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\ModuleQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinModule($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param ChildCouponModule $couponModule Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return ChildCouponModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($couponModule = null)
|
||||||
|
{
|
||||||
|
if ($couponModule) {
|
||||||
|
$this->addCond('pruneCond0', $this->getAliasedColName(CouponModuleTableMap::COUPON_ID), $couponModule->getCouponId(), Criteria::NOT_EQUAL);
|
||||||
|
$this->addCond('pruneCond1', $this->getAliasedColName(CouponModuleTableMap::MODULE_ID), $couponModule->getModuleId(), Criteria::NOT_EQUAL);
|
||||||
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the coupon_module 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(CouponModuleTableMap::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).
|
||||||
|
CouponModuleTableMap::clearInstancePool();
|
||||||
|
CouponModuleTableMap::clearRelatedInstancePool();
|
||||||
|
|
||||||
|
$con->commit();
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a ChildCouponModule or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or ChildCouponModule 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(CouponModuleTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = $this;
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(CouponModuleTableMap::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();
|
||||||
|
|
||||||
|
|
||||||
|
CouponModuleTableMap::removeInstanceFromPool($criteria);
|
||||||
|
|
||||||
|
$affectedRows += ModelCriteria::delete($con);
|
||||||
|
CouponModuleTableMap::clearRelatedInstancePool();
|
||||||
|
$con->commit();
|
||||||
|
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // CouponModuleQuery
|
||||||
@@ -58,6 +58,14 @@ use Thelia\Model\Map\CouponTableMap;
|
|||||||
* @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
* @method ChildCouponQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
* @method ChildCouponQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
*
|
*
|
||||||
|
* @method ChildCouponQuery leftJoinCouponCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponCountry relation
|
||||||
|
* @method ChildCouponQuery rightJoinCouponCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponCountry relation
|
||||||
|
* @method ChildCouponQuery innerJoinCouponCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponCountry relation
|
||||||
|
*
|
||||||
|
* @method ChildCouponQuery leftJoinCouponModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponModule relation
|
||||||
|
* @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 leftJoinCouponI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponI18n 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 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
|
* @method ChildCouponQuery innerJoinCouponI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponI18n relation
|
||||||
@@ -787,6 +795,152 @@ abstract class CouponQuery extends ModelCriteria
|
|||||||
return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison);
|
return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\CouponCountry object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CouponCountry|ObjectCollection $couponCountry 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 filterByCouponCountry($couponCountry, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($couponCountry instanceof \Thelia\Model\CouponCountry) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponTableMap::ID, $couponCountry->getCouponId(), $comparison);
|
||||||
|
} elseif ($couponCountry instanceof ObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useCouponCountryQuery()
|
||||||
|
->filterByPrimaryKeys($couponCountry->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCouponCountry() only accepts arguments of type \Thelia\Model\CouponCountry or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CouponCountry 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 joinCouponCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CouponCountry');
|
||||||
|
|
||||||
|
// 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, 'CouponCountry');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CouponCountry relation CouponCountry 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\CouponCountryQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCouponCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCouponCountry($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CouponCountry', '\Thelia\Model\CouponCountryQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\CouponModule object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CouponModule|ObjectCollection $couponModule 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 filterByCouponModule($couponModule, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($couponModule instanceof \Thelia\Model\CouponModule) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CouponTableMap::ID, $couponModule->getCouponId(), $comparison);
|
||||||
|
} elseif ($couponModule instanceof ObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useCouponModuleQuery()
|
||||||
|
->filterByPrimaryKeys($couponModule->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCouponModule() only accepts arguments of type \Thelia\Model\CouponModule or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CouponModule 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 joinCouponModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CouponModule');
|
||||||
|
|
||||||
|
// 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, 'CouponModule');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CouponModule relation CouponModule 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\CouponModuleQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCouponModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCouponModule($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CouponModule', '\Thelia\Model\CouponModuleQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related \Thelia\Model\CouponI18n object
|
* Filter the query by a related \Thelia\Model\CouponI18n object
|
||||||
*
|
*
|
||||||
@@ -933,6 +1087,40 @@ abstract class CouponQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'CouponVersion', '\Thelia\Model\CouponVersionQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CouponVersion', '\Thelia\Model\CouponVersionQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related Country object
|
||||||
|
* using the coupon_country table as cross reference
|
||||||
|
*
|
||||||
|
* @param Country $country 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 filterByCountry($country, $comparison = Criteria::EQUAL)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->useCouponCountryQuery()
|
||||||
|
->filterByCountry($country, $comparison)
|
||||||
|
->endUse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related Module object
|
||||||
|
* using the coupon_module table as cross reference
|
||||||
|
*
|
||||||
|
* @param Module $module 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 filterByModule($module, $comparison = Criteria::EQUAL)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->useCouponModuleQuery()
|
||||||
|
->filterByModule($module, $comparison)
|
||||||
|
->endUse();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ use Propel\Runtime\Parser\AbstractParser;
|
|||||||
use Propel\Runtime\Util\PropelDateTime;
|
use Propel\Runtime\Util\PropelDateTime;
|
||||||
use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
|
use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
|
||||||
use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
|
use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
|
||||||
|
use Thelia\Model\Coupon as ChildCoupon;
|
||||||
|
use Thelia\Model\CouponModule as ChildCouponModule;
|
||||||
|
use Thelia\Model\CouponModuleQuery as ChildCouponModuleQuery;
|
||||||
|
use Thelia\Model\CouponQuery as ChildCouponQuery;
|
||||||
use Thelia\Model\Module as ChildModule;
|
use Thelia\Model\Module as ChildModule;
|
||||||
use Thelia\Model\ModuleI18n as ChildModuleI18n;
|
use Thelia\Model\ModuleI18n as ChildModuleI18n;
|
||||||
use Thelia\Model\ModuleI18nQuery as ChildModuleI18nQuery;
|
use Thelia\Model\ModuleI18nQuery as ChildModuleI18nQuery;
|
||||||
@@ -143,12 +147,23 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
protected $collModuleImages;
|
protected $collModuleImages;
|
||||||
protected $collModuleImagesPartial;
|
protected $collModuleImagesPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ObjectCollection|ChildCouponModule[] Collection to store aggregation of ChildCouponModule objects.
|
||||||
|
*/
|
||||||
|
protected $collCouponModules;
|
||||||
|
protected $collCouponModulesPartial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ObjectCollection|ChildModuleI18n[] Collection to store aggregation of ChildModuleI18n objects.
|
* @var ObjectCollection|ChildModuleI18n[] Collection to store aggregation of ChildModuleI18n objects.
|
||||||
*/
|
*/
|
||||||
protected $collModuleI18ns;
|
protected $collModuleI18ns;
|
||||||
protected $collModuleI18nsPartial;
|
protected $collModuleI18nsPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ChildCoupon[] Collection to store aggregation of ChildCoupon objects.
|
||||||
|
*/
|
||||||
|
protected $collCoupons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
* by another object which falls in this transaction.
|
* by another object which falls in this transaction.
|
||||||
@@ -171,6 +186,12 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $currentTranslations;
|
protected $currentTranslations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var ObjectCollection
|
||||||
|
*/
|
||||||
|
protected $couponsScheduledForDeletion = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var ObjectCollection
|
* @var ObjectCollection
|
||||||
@@ -201,6 +222,12 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $moduleImagesScheduledForDeletion = null;
|
protected $moduleImagesScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var ObjectCollection
|
||||||
|
*/
|
||||||
|
protected $couponModulesScheduledForDeletion = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var ObjectCollection
|
* @var ObjectCollection
|
||||||
@@ -884,8 +911,11 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
|
|
||||||
$this->collModuleImages = null;
|
$this->collModuleImages = null;
|
||||||
|
|
||||||
|
$this->collCouponModules = null;
|
||||||
|
|
||||||
$this->collModuleI18ns = null;
|
$this->collModuleI18ns = null;
|
||||||
|
|
||||||
|
$this->collCoupons = null;
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1019,6 +1049,33 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->couponsScheduledForDeletion !== null) {
|
||||||
|
if (!$this->couponsScheduledForDeletion->isEmpty()) {
|
||||||
|
$pks = array();
|
||||||
|
$pk = $this->getPrimaryKey();
|
||||||
|
foreach ($this->couponsScheduledForDeletion->getPrimaryKeys(false) as $remotePk) {
|
||||||
|
$pks[] = array($remotePk, $pk);
|
||||||
|
}
|
||||||
|
|
||||||
|
CouponModuleQuery::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->ordersRelatedByPaymentModuleIdScheduledForDeletion !== null) {
|
if ($this->ordersRelatedByPaymentModuleIdScheduledForDeletion !== null) {
|
||||||
if (!$this->ordersRelatedByPaymentModuleIdScheduledForDeletion->isEmpty()) {
|
if (!$this->ordersRelatedByPaymentModuleIdScheduledForDeletion->isEmpty()) {
|
||||||
\Thelia\Model\OrderQuery::create()
|
\Thelia\Model\OrderQuery::create()
|
||||||
@@ -1104,6 +1161,23 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->couponModulesScheduledForDeletion !== null) {
|
||||||
|
if (!$this->couponModulesScheduledForDeletion->isEmpty()) {
|
||||||
|
\Thelia\Model\CouponModuleQuery::create()
|
||||||
|
->filterByPrimaryKeys($this->couponModulesScheduledForDeletion->getPrimaryKeys(false))
|
||||||
|
->delete($con);
|
||||||
|
$this->couponModulesScheduledForDeletion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collCouponModules !== null) {
|
||||||
|
foreach ($this->collCouponModules as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->moduleI18nsScheduledForDeletion !== null) {
|
if ($this->moduleI18nsScheduledForDeletion !== null) {
|
||||||
if (!$this->moduleI18nsScheduledForDeletion->isEmpty()) {
|
if (!$this->moduleI18nsScheduledForDeletion->isEmpty()) {
|
||||||
\Thelia\Model\ModuleI18nQuery::create()
|
\Thelia\Model\ModuleI18nQuery::create()
|
||||||
@@ -1351,6 +1425,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
if (null !== $this->collModuleImages) {
|
if (null !== $this->collModuleImages) {
|
||||||
$result['ModuleImages'] = $this->collModuleImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['ModuleImages'] = $this->collModuleImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->collCouponModules) {
|
||||||
|
$result['CouponModules'] = $this->collCouponModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
|
}
|
||||||
if (null !== $this->collModuleI18ns) {
|
if (null !== $this->collModuleI18ns) {
|
||||||
$result['ModuleI18ns'] = $this->collModuleI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['ModuleI18ns'] = $this->collModuleI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
@@ -1569,6 +1646,12 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->getCouponModules() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addCouponModule($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->getModuleI18ns() as $relObj) {
|
foreach ($this->getModuleI18ns() as $relObj) {
|
||||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
$copyObj->addModuleI18n($relObj->copy($deepCopy));
|
$copyObj->addModuleI18n($relObj->copy($deepCopy));
|
||||||
@@ -1631,6 +1714,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
if ('ModuleImage' == $relationName) {
|
if ('ModuleImage' == $relationName) {
|
||||||
return $this->initModuleImages();
|
return $this->initModuleImages();
|
||||||
}
|
}
|
||||||
|
if ('CouponModule' == $relationName) {
|
||||||
|
return $this->initCouponModules();
|
||||||
|
}
|
||||||
if ('ModuleI18n' == $relationName) {
|
if ('ModuleI18n' == $relationName) {
|
||||||
return $this->initModuleI18ns();
|
return $this->initModuleI18ns();
|
||||||
}
|
}
|
||||||
@@ -3079,6 +3165,252 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collCouponModules 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 addCouponModules()
|
||||||
|
*/
|
||||||
|
public function clearCouponModules()
|
||||||
|
{
|
||||||
|
$this->collCouponModules = null; // important to set this to NULL since that means it is uninitialized
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset is the collCouponModules collection loaded partially.
|
||||||
|
*/
|
||||||
|
public function resetPartialCouponModules($v = true)
|
||||||
|
{
|
||||||
|
$this->collCouponModulesPartial = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collCouponModules collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collCouponModules collection to an empty array (like clearcollCouponModules());
|
||||||
|
* 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 initCouponModules($overrideExisting = true)
|
||||||
|
{
|
||||||
|
if (null !== $this->collCouponModules && !$overrideExisting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->collCouponModules = new ObjectCollection();
|
||||||
|
$this->collCouponModules->setModel('\Thelia\Model\CouponModule');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of ChildCouponModule 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 ChildModule 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|ChildCouponModule[] List of ChildCouponModule objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getCouponModules($criteria = null, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collCouponModulesPartial && !$this->isNew();
|
||||||
|
if (null === $this->collCouponModules || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collCouponModules) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initCouponModules();
|
||||||
|
} else {
|
||||||
|
$collCouponModules = ChildCouponModuleQuery::create(null, $criteria)
|
||||||
|
->filterByModule($this)
|
||||||
|
->find($con);
|
||||||
|
|
||||||
|
if (null !== $criteria) {
|
||||||
|
if (false !== $this->collCouponModulesPartial && count($collCouponModules)) {
|
||||||
|
$this->initCouponModules(false);
|
||||||
|
|
||||||
|
foreach ($collCouponModules as $obj) {
|
||||||
|
if (false == $this->collCouponModules->contains($obj)) {
|
||||||
|
$this->collCouponModules->append($obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCouponModulesPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset($collCouponModules);
|
||||||
|
|
||||||
|
return $collCouponModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($partial && $this->collCouponModules) {
|
||||||
|
foreach ($this->collCouponModules as $obj) {
|
||||||
|
if ($obj->isNew()) {
|
||||||
|
$collCouponModules[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCouponModules = $collCouponModules;
|
||||||
|
$this->collCouponModulesPartial = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->collCouponModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a collection of CouponModule 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 $couponModules A Propel collection.
|
||||||
|
* @param ConnectionInterface $con Optional connection object
|
||||||
|
* @return ChildModule The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setCouponModules(Collection $couponModules, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$couponModulesToDelete = $this->getCouponModules(new Criteria(), $con)->diff($couponModules);
|
||||||
|
|
||||||
|
|
||||||
|
//since at least one column in the foreign key is at the same time a PK
|
||||||
|
//we can not just set a PK to NULL in the lines below. We have to store
|
||||||
|
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
|
||||||
|
$this->couponModulesScheduledForDeletion = clone $couponModulesToDelete;
|
||||||
|
|
||||||
|
foreach ($couponModulesToDelete as $couponModuleRemoved) {
|
||||||
|
$couponModuleRemoved->setModule(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCouponModules = null;
|
||||||
|
foreach ($couponModules as $couponModule) {
|
||||||
|
$this->addCouponModule($couponModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCouponModules = $couponModules;
|
||||||
|
$this->collCouponModulesPartial = false;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related CouponModule objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param ConnectionInterface $con
|
||||||
|
* @return int Count of related CouponModule objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countCouponModules(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collCouponModulesPartial && !$this->isNew();
|
||||||
|
if (null === $this->collCouponModules || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collCouponModules) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($partial && !$criteria) {
|
||||||
|
return count($this->getCouponModules());
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = ChildCouponModuleQuery::create(null, $criteria);
|
||||||
|
if ($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->filterByModule($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
return count($this->collCouponModules);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a ChildCouponModule object to this object
|
||||||
|
* through the ChildCouponModule foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param ChildCouponModule $l ChildCouponModule
|
||||||
|
* @return \Thelia\Model\Module The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function addCouponModule(ChildCouponModule $l)
|
||||||
|
{
|
||||||
|
if ($this->collCouponModules === null) {
|
||||||
|
$this->initCouponModules();
|
||||||
|
$this->collCouponModulesPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!in_array($l, $this->collCouponModules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->doAddCouponModule($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CouponModule $couponModule The couponModule object to add.
|
||||||
|
*/
|
||||||
|
protected function doAddCouponModule($couponModule)
|
||||||
|
{
|
||||||
|
$this->collCouponModules[]= $couponModule;
|
||||||
|
$couponModule->setModule($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CouponModule $couponModule The couponModule object to remove.
|
||||||
|
* @return ChildModule The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function removeCouponModule($couponModule)
|
||||||
|
{
|
||||||
|
if ($this->getCouponModules()->contains($couponModule)) {
|
||||||
|
$this->collCouponModules->remove($this->collCouponModules->search($couponModule));
|
||||||
|
if (null === $this->couponModulesScheduledForDeletion) {
|
||||||
|
$this->couponModulesScheduledForDeletion = clone $this->collCouponModules;
|
||||||
|
$this->couponModulesScheduledForDeletion->clear();
|
||||||
|
}
|
||||||
|
$this->couponModulesScheduledForDeletion[]= clone $couponModule;
|
||||||
|
$couponModule->setModule(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this collection has already been initialized with
|
||||||
|
* an identical criteria, it returns the collection.
|
||||||
|
* Otherwise if this Module is new, it will return
|
||||||
|
* an empty collection; or if this Module has previously
|
||||||
|
* been saved, it will retrieve related CouponModules 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 Module.
|
||||||
|
*
|
||||||
|
* @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|ChildCouponModule[] List of ChildCouponModule objects
|
||||||
|
*/
|
||||||
|
public function getCouponModulesJoinCoupon($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$query = ChildCouponModuleQuery::create(null, $criteria);
|
||||||
|
$query->joinWith('Coupon', $joinBehavior);
|
||||||
|
|
||||||
|
return $this->getCouponModules($query, $con);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the collModuleI18ns collection
|
* Clears out the collModuleI18ns collection
|
||||||
*
|
*
|
||||||
@@ -3304,6 +3636,189 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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_module 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 ChildModule 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)
|
||||||
|
->filterByModule($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_module 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 ChildModule 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_module 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
|
||||||
|
->filterByModule($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return count($this->collCoupons);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associate a ChildCoupon object to this object
|
||||||
|
* through the coupon_module cross reference table.
|
||||||
|
*
|
||||||
|
* @param ChildCoupon $coupon The ChildCouponModule object to relate
|
||||||
|
* @return ChildModule 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)
|
||||||
|
{
|
||||||
|
$couponModule = new ChildCouponModule();
|
||||||
|
$couponModule->setCoupon($coupon);
|
||||||
|
$this->addCouponModule($couponModule);
|
||||||
|
// set the back reference to this object directly as using provided method either results
|
||||||
|
// in endless loop or in multiple relations
|
||||||
|
if (!$coupon->getModules()->contains($this)) {
|
||||||
|
$foreignCollection = $coupon->getModules();
|
||||||
|
$foreignCollection[] = $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a ChildCoupon object to this object
|
||||||
|
* through the coupon_module cross reference table.
|
||||||
|
*
|
||||||
|
* @param ChildCoupon $coupon The ChildCouponModule object to relate
|
||||||
|
* @return ChildModule 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
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
@@ -3361,11 +3876,21 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collCouponModules) {
|
||||||
|
foreach ($this->collCouponModules as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->collModuleI18ns) {
|
if ($this->collModuleI18ns) {
|
||||||
foreach ($this->collModuleI18ns as $o) {
|
foreach ($this->collModuleI18ns as $o) {
|
||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collCoupons) {
|
||||||
|
foreach ($this->collCoupons as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // if ($deep)
|
} // if ($deep)
|
||||||
|
|
||||||
// i18n behavior
|
// i18n behavior
|
||||||
@@ -3377,7 +3902,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$this->collAreaDeliveryModules = null;
|
$this->collAreaDeliveryModules = null;
|
||||||
$this->collProfileModules = null;
|
$this->collProfileModules = null;
|
||||||
$this->collModuleImages = null;
|
$this->collModuleImages = null;
|
||||||
|
$this->collCouponModules = null;
|
||||||
$this->collModuleI18ns = null;
|
$this->collModuleI18ns = null;
|
||||||
|
$this->collCoupons = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ use Thelia\Model\Map\ModuleTableMap;
|
|||||||
* @method ChildModuleQuery rightJoinModuleImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleImage relation
|
* @method ChildModuleQuery rightJoinModuleImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleImage relation
|
||||||
* @method ChildModuleQuery innerJoinModuleImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleImage relation
|
* @method ChildModuleQuery innerJoinModuleImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleImage relation
|
||||||
*
|
*
|
||||||
|
* @method ChildModuleQuery leftJoinCouponModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponModule relation
|
||||||
|
* @method ChildModuleQuery rightJoinCouponModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponModule relation
|
||||||
|
* @method ChildModuleQuery innerJoinCouponModule($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponModule relation
|
||||||
|
*
|
||||||
* @method ChildModuleQuery leftJoinModuleI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleI18n relation
|
* @method ChildModuleQuery leftJoinModuleI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleI18n relation
|
||||||
* @method ChildModuleQuery rightJoinModuleI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleI18n relation
|
* @method ChildModuleQuery rightJoinModuleI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleI18n relation
|
||||||
* @method ChildModuleQuery innerJoinModuleI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleI18n relation
|
* @method ChildModuleQuery innerJoinModuleI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleI18n relation
|
||||||
@@ -938,6 +942,79 @@ abstract class ModuleQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'ModuleImage', '\Thelia\Model\ModuleImageQuery');
|
->useQuery($relationAlias ? $relationAlias : 'ModuleImage', '\Thelia\Model\ModuleImageQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related \Thelia\Model\CouponModule object
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CouponModule|ObjectCollection $couponModule the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCouponModule($couponModule, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($couponModule instanceof \Thelia\Model\CouponModule) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ModuleTableMap::ID, $couponModule->getModuleId(), $comparison);
|
||||||
|
} elseif ($couponModule instanceof ObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useCouponModuleQuery()
|
||||||
|
->filterByPrimaryKeys($couponModule->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCouponModule() only accepts arguments of type \Thelia\Model\CouponModule or Collection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CouponModule relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ChildModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCouponModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CouponModule');
|
||||||
|
|
||||||
|
// 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, 'CouponModule');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CouponModule relation CouponModule 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\CouponModuleQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCouponModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCouponModule($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CouponModule', '\Thelia\Model\CouponModuleQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related \Thelia\Model\ModuleI18n object
|
* Filter the query by a related \Thelia\Model\ModuleI18n object
|
||||||
*
|
*
|
||||||
@@ -1011,6 +1088,23 @@ abstract class ModuleQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'ModuleI18n', '\Thelia\Model\ModuleI18nQuery');
|
->useQuery($relationAlias ? $relationAlias : 'ModuleI18n', '\Thelia\Model\ModuleI18nQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related Coupon object
|
||||||
|
* using the coupon_module 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 ChildModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCoupon($coupon, $comparison = Criteria::EQUAL)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->useCouponModuleQuery()
|
||||||
|
->filterByCoupon($coupon, $comparison)
|
||||||
|
->endUse();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -23,8 +23,11 @@
|
|||||||
|
|
||||||
namespace Thelia\Model;
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
use Thelia\Model\Base\Coupon as BaseCoupon;
|
use Thelia\Model\Base\Coupon as BaseCoupon;
|
||||||
use Thelia\Model\Exception\InvalidArgumentException;
|
use Thelia\Model\Exception\InvalidArgumentException;
|
||||||
|
use Thelia\Model\Map\CouponTableMap;
|
||||||
|
use Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to provide an effect (mostly a discount)
|
* Used to provide an effect (mostly a discount)
|
||||||
@@ -38,7 +41,7 @@ use Thelia\Model\Exception\InvalidArgumentException;
|
|||||||
class Coupon extends BaseCoupon
|
class Coupon extends BaseCoupon
|
||||||
{
|
{
|
||||||
|
|
||||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
use ModelEventDispatcherTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create or Update this Coupon
|
* Create or Update this Coupon
|
||||||
@@ -57,32 +60,79 @@ class Coupon extends BaseCoupon
|
|||||||
* @param int $maxUsage Coupon quantity
|
* @param int $maxUsage Coupon quantity
|
||||||
* @param string $defaultSerializedRule Serialized default rule added if none found
|
* @param string $defaultSerializedRule Serialized default rule added if none found
|
||||||
* @param string $locale Coupon Language code ISO (ex: fr_FR)
|
* @param string $locale Coupon Language code ISO (ex: fr_FR)
|
||||||
|
* @param array $freeShippingForCountries ID of Countries to which shipping is free
|
||||||
|
* @param array $freeShippingForMethods ID of Shipping modules for which shipping is free
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function createOrUpdate($code, $title, array $effects, $type, $isRemovingPostage, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule, $locale = null)
|
public function createOrUpdate(
|
||||||
|
$code, $title, array $effects, $type, $isRemovingPostage, $shortDescription, $description,
|
||||||
|
$isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $defaultSerializedRule,
|
||||||
|
$locale, $freeShippingForCountries, $freeShippingForMethods)
|
||||||
{
|
{
|
||||||
$this
|
$con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME);
|
||||||
->setCode($code)
|
|
||||||
->setType($type)
|
|
||||||
->setEffects($effects)
|
|
||||||
->setIsRemovingPostage($isRemovingPostage)
|
|
||||||
->setIsEnabled($isEnabled)
|
|
||||||
->setExpirationDate($expirationDate)
|
|
||||||
->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers)
|
|
||||||
->setIsCumulative($isCumulative)
|
|
||||||
->setMaxUsage($maxUsage)
|
|
||||||
->setLocale($locale)
|
|
||||||
->setTitle($title)
|
|
||||||
->setShortDescription($shortDescription)
|
|
||||||
->setDescription($description);
|
|
||||||
|
|
||||||
// If no rule given, set default rule
|
$con->beginTransaction();
|
||||||
if (null === $this->getSerializedConditions()) {
|
|
||||||
$this->setSerializedConditions($defaultSerializedRule);
|
try {
|
||||||
|
$this
|
||||||
|
->setCode($code)
|
||||||
|
->setType($type)
|
||||||
|
->setEffects($effects)
|
||||||
|
->setIsRemovingPostage($isRemovingPostage)
|
||||||
|
->setIsEnabled($isEnabled)
|
||||||
|
->setExpirationDate($expirationDate)
|
||||||
|
->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers)
|
||||||
|
->setIsCumulative($isCumulative)
|
||||||
|
->setMaxUsage($maxUsage)
|
||||||
|
->setLocale($locale)
|
||||||
|
->setTitle($title)
|
||||||
|
->setShortDescription($shortDescription)
|
||||||
|
->setDescription($description);
|
||||||
|
|
||||||
|
// If no rule given, set default rule
|
||||||
|
if (null === $this->getSerializedConditions()) {
|
||||||
|
$this->setSerializedConditions($defaultSerializedRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->save();
|
||||||
|
|
||||||
|
// Update countries and modules relation for free shipping
|
||||||
|
CouponCountryQuery::create()->filterByCouponId($this->id)->delete();
|
||||||
|
CouponModuleQuery::create()->filterByCouponId($this->id)->delete();
|
||||||
|
|
||||||
|
foreach($freeShippingForCountries as $countryId) {
|
||||||
|
|
||||||
|
if ($countryId <= 0) continue;
|
||||||
|
|
||||||
|
$couponCountry = new CouponCountry();
|
||||||
|
|
||||||
|
$couponCountry
|
||||||
|
->setCouponId($this->getId())
|
||||||
|
->setCountryId($countryId)
|
||||||
|
->save();
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($freeShippingForMethods as $moduleId) {
|
||||||
|
|
||||||
|
if ($moduleId <= 0) continue;
|
||||||
|
|
||||||
|
$couponModule = new CouponModule();
|
||||||
|
|
||||||
|
$couponModule
|
||||||
|
->setCouponId($this->getId())
|
||||||
|
->setModuleId($moduleId)
|
||||||
|
->save()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
|
||||||
|
$con->rollback();
|
||||||
|
|
||||||
|
throw $ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -198,4 +248,4 @@ class Coupon extends BaseCoupon
|
|||||||
|
|
||||||
return $effects;
|
return $effects;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
10
core/lib/Thelia/Model/CouponCountry.php
Normal file
10
core/lib/Thelia/Model/CouponCountry.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CouponCountry as BaseCouponCountry;
|
||||||
|
|
||||||
|
class CouponCountry extends BaseCouponCountry
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/CouponCountryQuery.php
Normal file
21
core/lib/Thelia/Model/CouponCountryQuery.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CouponCountryQuery as BaseCouponCountryQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'coupon_country' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class CouponCountryQuery extends BaseCouponCountryQuery
|
||||||
|
{
|
||||||
|
|
||||||
|
} // CouponCountryQuery
|
||||||
10
core/lib/Thelia/Model/CouponModule.php
Normal file
10
core/lib/Thelia/Model/CouponModule.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CouponModule as BaseCouponModule;
|
||||||
|
|
||||||
|
class CouponModule extends BaseCouponModule
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/CouponModuleQuery.php
Normal file
21
core/lib/Thelia/Model/CouponModuleQuery.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\CouponModuleQuery as BaseCouponModuleQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'coupon_module' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class CouponModuleQuery extends BaseCouponModuleQuery
|
||||||
|
{
|
||||||
|
|
||||||
|
} // CouponModuleQuery
|
||||||
@@ -194,7 +194,9 @@ class CountryTableMap extends TableMap
|
|||||||
$this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
$this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||||
$this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountries');
|
$this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountries');
|
||||||
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'RESTRICT', 'RESTRICT', 'Addresses');
|
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'RESTRICT', 'RESTRICT', 'Addresses');
|
||||||
|
$this->addRelation('CouponCountry', '\\Thelia\\Model\\CouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', null, 'CouponCountries');
|
||||||
$this->addRelation('CountryI18n', '\\Thelia\\Model\\CountryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CountryI18ns');
|
$this->addRelation('CountryI18n', '\\Thelia\\Model\\CountryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CountryI18ns');
|
||||||
|
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Coupons');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,6 +220,7 @@ class CountryTableMap extends TableMap
|
|||||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
TaxRuleCountryTableMap::clearInstancePool();
|
TaxRuleCountryTableMap::clearInstancePool();
|
||||||
|
CouponCountryTableMap::clearInstancePool();
|
||||||
CountryI18nTableMap::clearInstancePool();
|
CountryI18nTableMap::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
468
core/lib/Thelia/Model/Map/CouponCountryTableMap.php
Normal file
468
core/lib/Thelia/Model/Map/CouponCountryTableMap.php
Normal file
@@ -0,0 +1,468 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\Map;
|
||||||
|
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||||
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Propel\Runtime\Map\RelationMap;
|
||||||
|
use Propel\Runtime\Map\TableMap;
|
||||||
|
use Propel\Runtime\Map\TableMapTrait;
|
||||||
|
use Thelia\Model\CouponCountry;
|
||||||
|
use Thelia\Model\CouponCountryQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'coupon_country' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class CouponCountryTableMap extends TableMap
|
||||||
|
{
|
||||||
|
use InstancePoolTrait;
|
||||||
|
use TableMapTrait;
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.Map.CouponCountryTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database name for this class
|
||||||
|
*/
|
||||||
|
const DATABASE_NAME = 'thelia';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table name for this class
|
||||||
|
*/
|
||||||
|
const TABLE_NAME = 'coupon_country';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The related Propel class for this table
|
||||||
|
*/
|
||||||
|
const OM_CLASS = '\\Thelia\\Model\\CouponCountry';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class that can be returned by this tableMap
|
||||||
|
*/
|
||||||
|
const CLASS_DEFAULT = 'Thelia.Model.CouponCountry';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total number of columns
|
||||||
|
*/
|
||||||
|
const NUM_COLUMNS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of lazy-loaded columns
|
||||||
|
*/
|
||||||
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||||
|
*/
|
||||||
|
const NUM_HYDRATE_COLUMNS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the COUPON_ID field
|
||||||
|
*/
|
||||||
|
const COUPON_ID = 'coupon_country.COUPON_ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the COUNTRY_ID field
|
||||||
|
*/
|
||||||
|
const COUNTRY_ID = 'coupon_country.COUNTRY_ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default string format for model objects of the related table
|
||||||
|
*/
|
||||||
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of fieldnames
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
|
*/
|
||||||
|
protected static $fieldNames = array (
|
||||||
|
self::TYPE_PHPNAME => array('CouponId', 'CountryId', ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('couponId', 'countryId', ),
|
||||||
|
self::TYPE_COLNAME => array(CouponCountryTableMap::COUPON_ID, CouponCountryTableMap::COUNTRY_ID, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('COUPON_ID', 'COUNTRY_ID', ),
|
||||||
|
self::TYPE_FIELDNAME => array('coupon_id', 'country_id', ),
|
||||||
|
self::TYPE_NUM => array(0, 1, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of keys for quick access to the fieldnames array
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||||
|
*/
|
||||||
|
protected static $fieldKeys = array (
|
||||||
|
self::TYPE_PHPNAME => array('CouponId' => 0, 'CountryId' => 1, ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('couponId' => 0, 'countryId' => 1, ),
|
||||||
|
self::TYPE_COLNAME => array(CouponCountryTableMap::COUPON_ID => 0, CouponCountryTableMap::COUNTRY_ID => 1, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('COUPON_ID' => 0, 'COUNTRY_ID' => 1, ),
|
||||||
|
self::TYPE_FIELDNAME => array('coupon_id' => 0, 'country_id' => 1, ),
|
||||||
|
self::TYPE_NUM => array(0, 1, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes and columns
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('coupon_country');
|
||||||
|
$this->setPhpName('CouponCountry');
|
||||||
|
$this->setClassName('\\Thelia\\Model\\CouponCountry');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
$this->setIsCrossRef(true);
|
||||||
|
// columns
|
||||||
|
$this->addForeignPrimaryKey('COUPON_ID', 'CouponId', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||||
|
$this->addForeignPrimaryKey('COUNTRY_ID', 'CountryId', 'INTEGER' , 'country', 'ID', true, null, null);
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'CASCADE', null);
|
||||||
|
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an object to the instance pool.
|
||||||
|
*
|
||||||
|
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||||
|
* from the database. In some cases you may need to explicitly add objects
|
||||||
|
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||||
|
* and findPk*() calls.
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CouponCountry $obj A \Thelia\Model\CouponCountry object.
|
||||||
|
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||||
|
*/
|
||||||
|
public static function addInstanceToPool($obj, $key = null)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled()) {
|
||||||
|
if (null === $key) {
|
||||||
|
$key = serialize(array((string) $obj->getCouponId(), (string) $obj->getCountryId()));
|
||||||
|
} // if key === null
|
||||||
|
self::$instances[$key] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an object from the instance pool.
|
||||||
|
*
|
||||||
|
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||||
|
* from the database. In some cases -- especially when you override doDelete
|
||||||
|
* methods in your stub classes -- you may need to explicitly remove objects
|
||||||
|
* from the cache in order to prevent returning objects that no longer exist.
|
||||||
|
*
|
||||||
|
* @param mixed $value A \Thelia\Model\CouponCountry object or a primary key value.
|
||||||
|
*/
|
||||||
|
public static function removeInstanceFromPool($value)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||||
|
if (is_object($value) && $value instanceof \Thelia\Model\CouponCountry) {
|
||||||
|
$key = serialize(array((string) $value->getCouponId(), (string) $value->getCountryId()));
|
||||||
|
|
||||||
|
} elseif (is_array($value) && count($value) === 2) {
|
||||||
|
// assume we've been passed a primary key";
|
||||||
|
$key = serialize(array((string) $value[0], (string) $value[1]));
|
||||||
|
} elseif ($value instanceof Criteria) {
|
||||||
|
self::$instances = [];
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\CouponCountry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset(self::$instances[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||||
|
*
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
// If the PK cannot be derived from the row, return NULL.
|
||||||
|
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the primary key from the DB resultset row
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*
|
||||||
|
* @return mixed The primary key of the row
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $pks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class that the tableMap will make instances of.
|
||||||
|
*
|
||||||
|
* If $withPrefix is true, the returned path
|
||||||
|
* uses a dot-path notation which is translated into a path
|
||||||
|
* relative to a location on the PHP include_path.
|
||||||
|
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||||
|
*
|
||||||
|
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||||
|
* @return string path.to.ClassName
|
||||||
|
*/
|
||||||
|
public static function getOMClass($withPrefix = true)
|
||||||
|
{
|
||||||
|
return $withPrefix ? CouponCountryTableMap::CLASS_DEFAULT : CouponCountryTableMap::OM_CLASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populates an object of the default type or an object that inherit from the default.
|
||||||
|
*
|
||||||
|
* @param array $row row returned by DataFetcher->fetch().
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||||
|
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||||
|
*
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
* @return array (CouponCountry object, last column rank)
|
||||||
|
*/
|
||||||
|
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
$key = CouponCountryTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||||
|
if (null !== ($obj = CouponCountryTableMap::getInstanceFromPool($key))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||||
|
$col = $offset + CouponCountryTableMap::NUM_HYDRATE_COLUMNS;
|
||||||
|
} else {
|
||||||
|
$cls = CouponCountryTableMap::OM_CLASS;
|
||||||
|
$obj = new $cls();
|
||||||
|
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||||
|
CouponCountryTableMap::addInstanceToPool($obj, $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array($obj, $col);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The returned array will contain objects of the default type or
|
||||||
|
* objects that inherit from the default.
|
||||||
|
*
|
||||||
|
* @param DataFetcherInterface $dataFetcher
|
||||||
|
* @return array
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||||
|
{
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
// set the class once to avoid overhead in the loop
|
||||||
|
$cls = static::getOMClass(false);
|
||||||
|
// populate the object(s)
|
||||||
|
while ($row = $dataFetcher->fetch()) {
|
||||||
|
$key = CouponCountryTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||||
|
if (null !== ($obj = CouponCountryTableMap::getInstanceFromPool($key))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj->hydrate($row, 0, true); // rehydrate
|
||||||
|
$results[] = $obj;
|
||||||
|
} else {
|
||||||
|
$obj = new $cls();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
$results[] = $obj;
|
||||||
|
CouponCountryTableMap::addInstanceToPool($obj, $key);
|
||||||
|
} // if key exists
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Add all the columns needed to create a new object.
|
||||||
|
*
|
||||||
|
* Note: any columns that were marked with lazyLoad="true" in the
|
||||||
|
* XML schema will not be added to the select list and only loaded
|
||||||
|
* on demand.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria object containing the columns to add.
|
||||||
|
* @param string $alias optional table alias
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||||
|
{
|
||||||
|
if (null === $alias) {
|
||||||
|
$criteria->addSelectColumn(CouponCountryTableMap::COUPON_ID);
|
||||||
|
$criteria->addSelectColumn(CouponCountryTableMap::COUNTRY_ID);
|
||||||
|
} else {
|
||||||
|
$criteria->addSelectColumn($alias . '.COUPON_ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.COUNTRY_ID');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the TableMap related to this object.
|
||||||
|
* This method is not needed for general use but a specific application could have a need.
|
||||||
|
* @return TableMap
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function getTableMap()
|
||||||
|
{
|
||||||
|
return Propel::getServiceContainer()->getDatabaseMap(CouponCountryTableMap::DATABASE_NAME)->getTable(CouponCountryTableMap::TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a TableMap instance to the database for this tableMap class.
|
||||||
|
*/
|
||||||
|
public static function buildTableMap()
|
||||||
|
{
|
||||||
|
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponCountryTableMap::DATABASE_NAME);
|
||||||
|
if (!$dbMap->hasTable(CouponCountryTableMap::TABLE_NAME)) {
|
||||||
|
$dbMap->addTableObject(new CouponCountryTableMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a CouponCountry or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CouponCountry 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 static function doDelete($values, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
if (null === $con) {
|
||||||
|
$con = Propel::getServiceContainer()->getWriteConnection(CouponCountryTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
// rename for clarity
|
||||||
|
$criteria = $values;
|
||||||
|
} elseif ($values instanceof \Thelia\Model\CouponCountry) { // it's a model object
|
||||||
|
// create criteria based on pk values
|
||||||
|
$criteria = $values->buildPkeyCriteria();
|
||||||
|
} else { // it's a primary key, or an array of pks
|
||||||
|
$criteria = new Criteria(CouponCountryTableMap::DATABASE_NAME);
|
||||||
|
// primary key is composite; we therefore, expect
|
||||||
|
// the primary key passed to be an array of pkey values
|
||||||
|
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||||
|
// array is not multi-dimensional
|
||||||
|
$values = array($values);
|
||||||
|
}
|
||||||
|
foreach ($values as $value) {
|
||||||
|
$criterion = $criteria->getNewCriterion(CouponCountryTableMap::COUPON_ID, $value[0]);
|
||||||
|
$criterion->addAnd($criteria->getNewCriterion(CouponCountryTableMap::COUNTRY_ID, $value[1]));
|
||||||
|
$criteria->addOr($criterion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = CouponCountryQuery::create()->mergeWith($criteria);
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) { CouponCountryTableMap::clearInstancePool();
|
||||||
|
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||||
|
foreach ((array) $values as $singleval) { CouponCountryTableMap::removeInstanceFromPool($singleval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->delete($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the coupon_country table.
|
||||||
|
*
|
||||||
|
* @param ConnectionInterface $con the connection to use
|
||||||
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
|
*/
|
||||||
|
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
return CouponCountryQuery::create()->doDeleteAll($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an INSERT on the database, given a CouponCountry or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $criteria Criteria or CouponCountry object containing data that is used to create the INSERT statement.
|
||||||
|
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||||
|
* @return mixed The new primary key.
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
if (null === $con) {
|
||||||
|
$con = Propel::getServiceContainer()->getWriteConnection(CouponCountryTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$criteria = clone $criteria; // rename for clarity
|
||||||
|
} else {
|
||||||
|
$criteria = $criteria->buildCriteria(); // build Criteria from CouponCountry object
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$query = CouponCountryQuery::create()->mergeWith($criteria);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// use transaction because $criteria could contain info
|
||||||
|
// for more than one table (I guess, conceivably)
|
||||||
|
$con->beginTransaction();
|
||||||
|
$pk = $query->doInsert($con);
|
||||||
|
$con->commit();
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pk;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // CouponCountryTableMap
|
||||||
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
//
|
||||||
|
CouponCountryTableMap::buildTableMap();
|
||||||
468
core/lib/Thelia/Model/Map/CouponModuleTableMap.php
Normal file
468
core/lib/Thelia/Model/Map/CouponModuleTableMap.php
Normal file
@@ -0,0 +1,468 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\Map;
|
||||||
|
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
||||||
|
use Propel\Runtime\Exception\PropelException;
|
||||||
|
use Propel\Runtime\Map\RelationMap;
|
||||||
|
use Propel\Runtime\Map\TableMap;
|
||||||
|
use Propel\Runtime\Map\TableMapTrait;
|
||||||
|
use Thelia\Model\CouponModule;
|
||||||
|
use Thelia\Model\CouponModuleQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'coupon_module' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class CouponModuleTableMap extends TableMap
|
||||||
|
{
|
||||||
|
use InstancePoolTrait;
|
||||||
|
use TableMapTrait;
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.Map.CouponModuleTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database name for this class
|
||||||
|
*/
|
||||||
|
const DATABASE_NAME = 'thelia';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table name for this class
|
||||||
|
*/
|
||||||
|
const TABLE_NAME = 'coupon_module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The related Propel class for this table
|
||||||
|
*/
|
||||||
|
const OM_CLASS = '\\Thelia\\Model\\CouponModule';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class that can be returned by this tableMap
|
||||||
|
*/
|
||||||
|
const CLASS_DEFAULT = 'Thelia.Model.CouponModule';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total number of columns
|
||||||
|
*/
|
||||||
|
const NUM_COLUMNS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of lazy-loaded columns
|
||||||
|
*/
|
||||||
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||||
|
*/
|
||||||
|
const NUM_HYDRATE_COLUMNS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the COUPON_ID field
|
||||||
|
*/
|
||||||
|
const COUPON_ID = 'coupon_module.COUPON_ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the MODULE_ID field
|
||||||
|
*/
|
||||||
|
const MODULE_ID = 'coupon_module.MODULE_ID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default string format for model objects of the related table
|
||||||
|
*/
|
||||||
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of fieldnames
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
|
*/
|
||||||
|
protected static $fieldNames = array (
|
||||||
|
self::TYPE_PHPNAME => array('CouponId', 'ModuleId', ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('couponId', 'moduleId', ),
|
||||||
|
self::TYPE_COLNAME => array(CouponModuleTableMap::COUPON_ID, CouponModuleTableMap::MODULE_ID, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('COUPON_ID', 'MODULE_ID', ),
|
||||||
|
self::TYPE_FIELDNAME => array('coupon_id', 'module_id', ),
|
||||||
|
self::TYPE_NUM => array(0, 1, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of keys for quick access to the fieldnames array
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||||
|
*/
|
||||||
|
protected static $fieldKeys = array (
|
||||||
|
self::TYPE_PHPNAME => array('CouponId' => 0, 'ModuleId' => 1, ),
|
||||||
|
self::TYPE_STUDLYPHPNAME => array('couponId' => 0, 'moduleId' => 1, ),
|
||||||
|
self::TYPE_COLNAME => array(CouponModuleTableMap::COUPON_ID => 0, CouponModuleTableMap::MODULE_ID => 1, ),
|
||||||
|
self::TYPE_RAW_COLNAME => array('COUPON_ID' => 0, 'MODULE_ID' => 1, ),
|
||||||
|
self::TYPE_FIELDNAME => array('coupon_id' => 0, 'module_id' => 1, ),
|
||||||
|
self::TYPE_NUM => array(0, 1, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes and columns
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('coupon_module');
|
||||||
|
$this->setPhpName('CouponModule');
|
||||||
|
$this->setClassName('\\Thelia\\Model\\CouponModule');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
$this->setIsCrossRef(true);
|
||||||
|
// columns
|
||||||
|
$this->addForeignPrimaryKey('COUPON_ID', 'CouponId', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||||
|
$this->addForeignPrimaryKey('MODULE_ID', 'ModuleId', 'INTEGER' , 'module', 'ID', true, null, null);
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', null);
|
||||||
|
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('module_id' => 'id', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an object to the instance pool.
|
||||||
|
*
|
||||||
|
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||||
|
* from the database. In some cases you may need to explicitly add objects
|
||||||
|
* to the cache in order to ensure that the same objects are always returned by find*()
|
||||||
|
* and findPk*() calls.
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\CouponModule $obj A \Thelia\Model\CouponModule object.
|
||||||
|
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||||
|
*/
|
||||||
|
public static function addInstanceToPool($obj, $key = null)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled()) {
|
||||||
|
if (null === $key) {
|
||||||
|
$key = serialize(array((string) $obj->getCouponId(), (string) $obj->getModuleId()));
|
||||||
|
} // if key === null
|
||||||
|
self::$instances[$key] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an object from the instance pool.
|
||||||
|
*
|
||||||
|
* Propel keeps cached copies of objects in an instance pool when they are retrieved
|
||||||
|
* from the database. In some cases -- especially when you override doDelete
|
||||||
|
* methods in your stub classes -- you may need to explicitly remove objects
|
||||||
|
* from the cache in order to prevent returning objects that no longer exist.
|
||||||
|
*
|
||||||
|
* @param mixed $value A \Thelia\Model\CouponModule object or a primary key value.
|
||||||
|
*/
|
||||||
|
public static function removeInstanceFromPool($value)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled() && null !== $value) {
|
||||||
|
if (is_object($value) && $value instanceof \Thelia\Model\CouponModule) {
|
||||||
|
$key = serialize(array((string) $value->getCouponId(), (string) $value->getModuleId()));
|
||||||
|
|
||||||
|
} elseif (is_array($value) && count($value) === 2) {
|
||||||
|
// assume we've been passed a primary key";
|
||||||
|
$key = serialize(array((string) $value[0], (string) $value[1]));
|
||||||
|
} elseif ($value instanceof Criteria) {
|
||||||
|
self::$instances = [];
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\CouponModule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset(self::$instances[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||||
|
*
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
// If the PK cannot be derived from the row, return NULL.
|
||||||
|
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ModuleId', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the primary key from the DB resultset row
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row resultset row.
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
||||||
|
*
|
||||||
|
* @return mixed The primary key of the row
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $pks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class that the tableMap will make instances of.
|
||||||
|
*
|
||||||
|
* If $withPrefix is true, the returned path
|
||||||
|
* uses a dot-path notation which is translated into a path
|
||||||
|
* relative to a location on the PHP include_path.
|
||||||
|
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||||
|
*
|
||||||
|
* @param boolean $withPrefix Whether or not to return the path with the class name
|
||||||
|
* @return string path.to.ClassName
|
||||||
|
*/
|
||||||
|
public static function getOMClass($withPrefix = true)
|
||||||
|
{
|
||||||
|
return $withPrefix ? CouponModuleTableMap::CLASS_DEFAULT : CouponModuleTableMap::OM_CLASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populates an object of the default type or an object that inherit from the default.
|
||||||
|
*
|
||||||
|
* @param array $row row returned by DataFetcher->fetch().
|
||||||
|
* @param int $offset The 0-based offset for reading from the resultset row.
|
||||||
|
* @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
|
||||||
|
One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
||||||
|
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
|
||||||
|
*
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
* @return array (CouponModule object, last column rank)
|
||||||
|
*/
|
||||||
|
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||||
|
{
|
||||||
|
$key = CouponModuleTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||||
|
if (null !== ($obj = CouponModuleTableMap::getInstanceFromPool($key))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj->hydrate($row, $offset, true); // rehydrate
|
||||||
|
$col = $offset + CouponModuleTableMap::NUM_HYDRATE_COLUMNS;
|
||||||
|
} else {
|
||||||
|
$cls = CouponModuleTableMap::OM_CLASS;
|
||||||
|
$obj = new $cls();
|
||||||
|
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||||
|
CouponModuleTableMap::addInstanceToPool($obj, $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array($obj, $col);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The returned array will contain objects of the default type or
|
||||||
|
* objects that inherit from the default.
|
||||||
|
*
|
||||||
|
* @param DataFetcherInterface $dataFetcher
|
||||||
|
* @return array
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function populateObjects(DataFetcherInterface $dataFetcher)
|
||||||
|
{
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
// set the class once to avoid overhead in the loop
|
||||||
|
$cls = static::getOMClass(false);
|
||||||
|
// populate the object(s)
|
||||||
|
while ($row = $dataFetcher->fetch()) {
|
||||||
|
$key = CouponModuleTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||||
|
if (null !== ($obj = CouponModuleTableMap::getInstanceFromPool($key))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj->hydrate($row, 0, true); // rehydrate
|
||||||
|
$results[] = $obj;
|
||||||
|
} else {
|
||||||
|
$obj = new $cls();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
$results[] = $obj;
|
||||||
|
CouponModuleTableMap::addInstanceToPool($obj, $key);
|
||||||
|
} // if key exists
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Add all the columns needed to create a new object.
|
||||||
|
*
|
||||||
|
* Note: any columns that were marked with lazyLoad="true" in the
|
||||||
|
* XML schema will not be added to the select list and only loaded
|
||||||
|
* on demand.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria object containing the columns to add.
|
||||||
|
* @param string $alias optional table alias
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function addSelectColumns(Criteria $criteria, $alias = null)
|
||||||
|
{
|
||||||
|
if (null === $alias) {
|
||||||
|
$criteria->addSelectColumn(CouponModuleTableMap::COUPON_ID);
|
||||||
|
$criteria->addSelectColumn(CouponModuleTableMap::MODULE_ID);
|
||||||
|
} else {
|
||||||
|
$criteria->addSelectColumn($alias . '.COUPON_ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.MODULE_ID');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the TableMap related to this object.
|
||||||
|
* This method is not needed for general use but a specific application could have a need.
|
||||||
|
* @return TableMap
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function getTableMap()
|
||||||
|
{
|
||||||
|
return Propel::getServiceContainer()->getDatabaseMap(CouponModuleTableMap::DATABASE_NAME)->getTable(CouponModuleTableMap::TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a TableMap instance to the database for this tableMap class.
|
||||||
|
*/
|
||||||
|
public static function buildTableMap()
|
||||||
|
{
|
||||||
|
$dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponModuleTableMap::DATABASE_NAME);
|
||||||
|
if (!$dbMap->hasTable(CouponModuleTableMap::TABLE_NAME)) {
|
||||||
|
$dbMap->addTableObject(new CouponModuleTableMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a DELETE on the database, given a CouponModule or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CouponModule 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 static function doDelete($values, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
if (null === $con) {
|
||||||
|
$con = Propel::getServiceContainer()->getWriteConnection(CouponModuleTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
// rename for clarity
|
||||||
|
$criteria = $values;
|
||||||
|
} elseif ($values instanceof \Thelia\Model\CouponModule) { // it's a model object
|
||||||
|
// create criteria based on pk values
|
||||||
|
$criteria = $values->buildPkeyCriteria();
|
||||||
|
} else { // it's a primary key, or an array of pks
|
||||||
|
$criteria = new Criteria(CouponModuleTableMap::DATABASE_NAME);
|
||||||
|
// primary key is composite; we therefore, expect
|
||||||
|
// the primary key passed to be an array of pkey values
|
||||||
|
if (count($values) == count($values, COUNT_RECURSIVE)) {
|
||||||
|
// array is not multi-dimensional
|
||||||
|
$values = array($values);
|
||||||
|
}
|
||||||
|
foreach ($values as $value) {
|
||||||
|
$criterion = $criteria->getNewCriterion(CouponModuleTableMap::COUPON_ID, $value[0]);
|
||||||
|
$criterion->addAnd($criteria->getNewCriterion(CouponModuleTableMap::MODULE_ID, $value[1]));
|
||||||
|
$criteria->addOr($criterion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = CouponModuleQuery::create()->mergeWith($criteria);
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) { CouponModuleTableMap::clearInstancePool();
|
||||||
|
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||||
|
foreach ((array) $values as $singleval) { CouponModuleTableMap::removeInstanceFromPool($singleval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->delete($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all rows from the coupon_module table.
|
||||||
|
*
|
||||||
|
* @param ConnectionInterface $con the connection to use
|
||||||
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
|
*/
|
||||||
|
public static function doDeleteAll(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
return CouponModuleQuery::create()->doDeleteAll($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an INSERT on the database, given a CouponModule or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $criteria Criteria or CouponModule object containing data that is used to create the INSERT statement.
|
||||||
|
* @param ConnectionInterface $con the ConnectionInterface connection to use
|
||||||
|
* @return mixed The new primary key.
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function doInsert($criteria, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
if (null === $con) {
|
||||||
|
$con = Propel::getServiceContainer()->getWriteConnection(CouponModuleTableMap::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$criteria = clone $criteria; // rename for clarity
|
||||||
|
} else {
|
||||||
|
$criteria = $criteria->buildCriteria(); // build Criteria from CouponModule object
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$query = CouponModuleQuery::create()->mergeWith($criteria);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// use transaction because $criteria could contain info
|
||||||
|
// for more than one table (I guess, conceivably)
|
||||||
|
$con->beginTransaction();
|
||||||
|
$pk = $query->doInsert($con);
|
||||||
|
$con->commit();
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pk;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // CouponModuleTableMap
|
||||||
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
//
|
||||||
|
CouponModuleTableMap::buildTableMap();
|
||||||
@@ -227,8 +227,12 @@ class CouponTableMap extends TableMap
|
|||||||
*/
|
*/
|
||||||
public function buildRelations()
|
public function buildRelations()
|
||||||
{
|
{
|
||||||
|
$this->addRelation('CouponCountry', '\\Thelia\\Model\\CouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponCountries');
|
||||||
|
$this->addRelation('CouponModule', '\\Thelia\\Model\\CouponModule', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponModules');
|
||||||
$this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns');
|
$this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns');
|
||||||
$this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions');
|
$this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions');
|
||||||
|
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Countries');
|
||||||
|
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Modules');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,6 +256,8 @@ class CouponTableMap extends TableMap
|
|||||||
{
|
{
|
||||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
CouponCountryTableMap::clearInstancePool();
|
||||||
|
CouponModuleTableMap::clearInstancePool();
|
||||||
CouponI18nTableMap::clearInstancePool();
|
CouponI18nTableMap::clearInstancePool();
|
||||||
CouponVersionTableMap::clearInstancePool();
|
CouponVersionTableMap::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,7 +190,9 @@ class ModuleTableMap extends TableMap
|
|||||||
$this->addRelation('AreaDeliveryModule', '\\Thelia\\Model\\AreaDeliveryModule', RelationMap::ONE_TO_MANY, array('id' => 'delivery_module_id', ), 'CASCADE', 'RESTRICT', 'AreaDeliveryModules');
|
$this->addRelation('AreaDeliveryModule', '\\Thelia\\Model\\AreaDeliveryModule', RelationMap::ONE_TO_MANY, array('id' => 'delivery_module_id', ), 'CASCADE', 'RESTRICT', 'AreaDeliveryModules');
|
||||||
$this->addRelation('ProfileModule', '\\Thelia\\Model\\ProfileModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'ProfileModules');
|
$this->addRelation('ProfileModule', '\\Thelia\\Model\\ProfileModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'ProfileModules');
|
||||||
$this->addRelation('ModuleImage', '\\Thelia\\Model\\ModuleImage', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'ModuleImages');
|
$this->addRelation('ModuleImage', '\\Thelia\\Model\\ModuleImage', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'ModuleImages');
|
||||||
|
$this->addRelation('CouponModule', '\\Thelia\\Model\\CouponModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', null, 'CouponModules');
|
||||||
$this->addRelation('ModuleI18n', '\\Thelia\\Model\\ModuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ModuleI18ns');
|
$this->addRelation('ModuleI18n', '\\Thelia\\Model\\ModuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ModuleI18ns');
|
||||||
|
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Coupons');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -216,6 +218,7 @@ class ModuleTableMap extends TableMap
|
|||||||
AreaDeliveryModuleTableMap::clearInstancePool();
|
AreaDeliveryModuleTableMap::clearInstancePool();
|
||||||
ProfileModuleTableMap::clearInstancePool();
|
ProfileModuleTableMap::clearInstancePool();
|
||||||
ModuleImageTableMap::clearInstancePool();
|
ModuleImageTableMap::clearInstancePool();
|
||||||
|
CouponModuleTableMap::clearInstancePool();
|
||||||
ModuleI18nTableMap::clearInstancePool();
|
ModuleI18nTableMap::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,112 +1,112 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Thelia\Model;
|
namespace Thelia\Model;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\ActiveQuery\Join;
|
use Propel\Runtime\ActiveQuery\Join;
|
||||||
use Thelia\Model\Base\RewritingUrlQuery as BaseRewritingUrlQuery;
|
use Thelia\Model\Base\RewritingUrlQuery as BaseRewritingUrlQuery;
|
||||||
use Thelia\Model\Map\RewritingUrlTableMap;
|
use Thelia\Model\Map\RewritingUrlTableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for performing query and update operations on the 'rewriting_url' table.
|
* Skeleton subclass for performing query and update operations on the 'rewriting_url' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* You should add additional methods to this class to meet the
|
* You should add additional methods to this class to meet the
|
||||||
* application requirements. This class will only be generated as
|
* application requirements. This class will only be generated as
|
||||||
* long as it does not already exist in the output directory.
|
* long as it does not already exist in the output directory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class RewritingUrlQuery extends BaseRewritingUrlQuery
|
class RewritingUrlQuery extends BaseRewritingUrlQuery
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param $rewrittenUrl
|
* @param $rewrittenUrl
|
||||||
*
|
*
|
||||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||||
*/
|
*/
|
||||||
public function getResolverSearch($rewrittenUrl)
|
public function getResolverSearch($rewrittenUrl)
|
||||||
{
|
{
|
||||||
$redirectedJoin = new Join();
|
$redirectedJoin = new Join();
|
||||||
$redirectedJoin->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'REDIRECTED', 'ru', RewritingUrlTableMap::TABLE_NAME, 'ID', 'is_redirected');
|
$redirectedJoin->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'REDIRECTED', 'ru', RewritingUrlTableMap::TABLE_NAME, 'ID', 'is_redirected');
|
||||||
$redirectedJoin->setJoinType(Criteria::LEFT_JOIN);
|
$redirectedJoin->setJoinType(Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
$search = RewritingArgumentQuery::create()
|
$search = RewritingArgumentQuery::create()
|
||||||
->joinRewritingUrl('ru', Criteria::RIGHT_JOIN)
|
->joinRewritingUrl('ru', Criteria::RIGHT_JOIN)
|
||||||
->addJoinObject($redirectedJoin)
|
->addJoinObject($redirectedJoin)
|
||||||
->where('`ru`.URL = ?', $rewrittenUrl, \PDO::PARAM_STR)
|
->where('`ru`.URL = ?', $rewrittenUrl, \PDO::PARAM_STR)
|
||||||
->withColumn('`ru`.URL', 'ru_url')
|
->withColumn('`ru`.URL', 'ru_url')
|
||||||
->withColumn('`ru`.VIEW', 'ru_view')
|
->withColumn('`ru`.VIEW', 'ru_view')
|
||||||
->withColumn('`ru`.VIEW_LOCALE', 'ru_locale')
|
->withColumn('`ru`.VIEW_LOCALE', 'ru_locale')
|
||||||
->withColumn('`ru`.VIEW_ID', 'ru_viewId')
|
->withColumn('`ru`.VIEW_ID', 'ru_viewId')
|
||||||
->withColumn('`is_redirected`.URL', 'ru_redirected_to_url')
|
->withColumn('`is_redirected`.URL', 'ru_redirected_to_url')
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
return $search;
|
return $search;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $view
|
* @param $view
|
||||||
* @param $viewId
|
* @param $viewId
|
||||||
* @param $viewLocale
|
* @param $viewLocale
|
||||||
*
|
*
|
||||||
* @return null|RewritingUrl
|
* @return null|RewritingUrl
|
||||||
*/
|
*/
|
||||||
public function getViewUrlQuery($view, $viewLocale, $viewId)
|
public function getViewUrlQuery($view, $viewLocale, $viewId)
|
||||||
{
|
{
|
||||||
return RewritingUrlQuery::create()
|
return RewritingUrlQuery::create()
|
||||||
->joinRewritingArgument('ra', Criteria::LEFT_JOIN)
|
->joinRewritingArgument('ra', Criteria::LEFT_JOIN)
|
||||||
->where('ISNULL(`ra`.REWRITING_URL_ID)')
|
->where('ISNULL(`ra`.REWRITING_URL_ID)')
|
||||||
->filterByView($view)
|
->filterByView($view)
|
||||||
->filterByViewLocale($viewLocale)
|
->filterByViewLocale($viewLocale)
|
||||||
->filterByViewId($viewId)
|
->filterByViewId($viewId)
|
||||||
->filterByRedirected(null)
|
->filterByRedirected(null)
|
||||||
->orderByUpdatedAt(Criteria::DESC)
|
->orderById(Criteria::DESC)
|
||||||
->findOne();
|
->findOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $view
|
* @param $view
|
||||||
* @param $viewLocale
|
* @param $viewLocale
|
||||||
* @param $viewId
|
* @param $viewId
|
||||||
* @param $viewOtherParameters
|
* @param $viewOtherParameters
|
||||||
*
|
*
|
||||||
* @return null|RewritingUrl
|
* @return null|RewritingUrl
|
||||||
*/
|
*/
|
||||||
public function getSpecificUrlQuery($view, $viewLocale, $viewId, $viewOtherParameters)
|
public function getSpecificUrlQuery($view, $viewLocale, $viewId, $viewOtherParameters)
|
||||||
{
|
{
|
||||||
$urlQuery = RewritingUrlQuery::create()
|
$urlQuery = RewritingUrlQuery::create()
|
||||||
->joinRewritingArgument('ra', Criteria::LEFT_JOIN)
|
->joinRewritingArgument('ra', Criteria::LEFT_JOIN)
|
||||||
->withColumn('`ra`.REWRITING_URL_ID', 'ra_REWRITING_URL_ID')
|
->withColumn('`ra`.REWRITING_URL_ID', 'ra_REWRITING_URL_ID')
|
||||||
->filterByView($view)
|
->filterByView($view)
|
||||||
->filterByViewLocale($viewLocale)
|
->filterByViewLocale($viewLocale)
|
||||||
->filterByViewId($viewId)
|
->filterByViewId($viewId)
|
||||||
->filterByRedirected(null)
|
->filterByRedirected(null)
|
||||||
->orderByUpdatedAt(Criteria::DESC);
|
->orderById(Criteria::DESC);
|
||||||
|
|
||||||
$otherParametersCount = count($viewOtherParameters);
|
$otherParametersCount = count($viewOtherParameters);
|
||||||
if ($otherParametersCount > 0) {
|
if ($otherParametersCount > 0) {
|
||||||
$parameterConditions = array();
|
$parameterConditions = array();
|
||||||
|
|
||||||
foreach ($viewOtherParameters as $parameter => $value) {
|
foreach ($viewOtherParameters as $parameter => $value) {
|
||||||
$conditionName = 'other_parameter_condition_' . count($parameterConditions);
|
$conditionName = 'other_parameter_condition_' . count($parameterConditions);
|
||||||
$urlQuery->condition('parameter_condition', '`ra`.PARAMETER= ?', $parameter, \PDO::PARAM_STR)
|
$urlQuery->condition('parameter_condition', '`ra`.PARAMETER= ?', $parameter, \PDO::PARAM_STR)
|
||||||
->condition('value_condition', '`ra`.VALUE = ?', $value, \PDO::PARAM_STR)
|
->condition('value_condition', '`ra`.VALUE = ?', $value, \PDO::PARAM_STR)
|
||||||
->combine(array('parameter_condition', 'value_condition'), Criteria::LOGICAL_AND, $conditionName);
|
->combine(array('parameter_condition', 'value_condition'), Criteria::LOGICAL_AND, $conditionName);
|
||||||
$parameterConditions[] = $conditionName;
|
$parameterConditions[] = $conditionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$urlQuery->where($parameterConditions, Criteria::LOGICAL_OR);
|
$urlQuery->where($parameterConditions, Criteria::LOGICAL_OR);
|
||||||
|
|
||||||
$urlQuery->groupBy(RewritingUrlTableMap::ID);
|
$urlQuery->groupBy(RewritingUrlTableMap::ID);
|
||||||
|
|
||||||
$urlQuery->condition('count_condition_1', 'COUNT(' . RewritingUrlTableMap::ID . ') = ?', $otherParametersCount, \PDO::PARAM_INT) // ensure we got all the asked parameters (provided by the query)
|
$urlQuery->condition('count_condition_1', 'COUNT(' . RewritingUrlTableMap::ID . ') = ?', $otherParametersCount, \PDO::PARAM_INT) // ensure we got all the asked parameters (provided by the query)
|
||||||
->condition('count_condition_2', 'COUNT(' . RewritingUrlTableMap::ID . ') = (SELECT COUNT(*) FROM rewriting_argument WHERE rewriting_argument.REWRITING_URL_ID = ra_REWRITING_URL_ID)'); // ensure we don't miss any parameters (needed to match the rewritten url)
|
->condition('count_condition_2', 'COUNT(' . RewritingUrlTableMap::ID . ') = (SELECT COUNT(*) FROM rewriting_argument WHERE rewriting_argument.REWRITING_URL_ID = ra_REWRITING_URL_ID)'); // ensure we don't miss any parameters (needed to match the rewritten url)
|
||||||
|
|
||||||
$urlQuery->having(array('count_condition_1', 'count_condition_2'), Criteria::LOGICAL_AND);
|
$urlQuery->having(array('count_condition_1', 'count_condition_2'), Criteria::LOGICAL_AND);
|
||||||
} else {
|
} else {
|
||||||
$urlQuery->where('ISNULL(`ra`.REWRITING_URL_ID)');
|
$urlQuery->where('ISNULL(`ra`.REWRITING_URL_ID)');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $urlQuery->findOne();
|
return $urlQuery->findOne();
|
||||||
}
|
}
|
||||||
} // RewritingUrlQuery
|
} // RewritingUrlQuery
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<vendor type="mysql">
|
|
||||||
<parameter name="Engine" value="InnoDB"/>
|
|
||||||
<parameter name="Charset" value="utf8"/>
|
|
||||||
</vendor>
|
|
||||||
<database defaultIdMethod="native" name="thelia">
|
<database defaultIdMethod="native" name="thelia">
|
||||||
<table name="category" namespace="Thelia\Model">
|
<table name="category" namespace="Thelia\Model">
|
||||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
@@ -37,7 +33,7 @@
|
|||||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
<column name="tax_rule_id" type="INTEGER" />
|
<column name="tax_rule_id" type="INTEGER" />
|
||||||
<column name="ref" required="true" size="255" type="VARCHAR" />
|
<column name="ref" required="true" size="255" type="VARCHAR" />
|
||||||
<column name="position" required="true" defaultValue="0" type="INTEGER" />
|
<column defaultValue="0" name="visible" required="true" type="TINYINT" />
|
||||||
<column defaultValue="0" name="position" required="true" type="INTEGER" />
|
<column defaultValue="0" name="position" required="true" type="INTEGER" />
|
||||||
<column name="title" size="255" type="VARCHAR" />
|
<column name="title" size="255" type="VARCHAR" />
|
||||||
<column name="description" type="CLOB" />
|
<column name="description" type="CLOB" />
|
||||||
@@ -110,7 +106,7 @@
|
|||||||
<index name="idx_country_area_id">
|
<index name="idx_country_area_id">
|
||||||
<index-column name="area_id" />
|
<index-column name="area_id" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="by_default" />
|
<index name="idx_country_by_default">
|
||||||
<index-column name="by_default" />
|
<index-column name="by_default" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -162,9 +158,9 @@
|
|||||||
<index name="idx_tax_rule_country_country_id">
|
<index name="idx_tax_rule_country_country_id">
|
||||||
<index-column name="country_id" />
|
<index-column name="country_id" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="tax_rule_id"/>
|
<index name="idx_tax_rule_country_tax_rule_id_country_id_position">
|
||||||
<index-column name="country_id"/>
|
<index-column name="tax_rule_id" />
|
||||||
<index-column name="position"/>
|
<index-column name="country_id" />
|
||||||
<index-column name="position" />
|
<index-column name="position" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -226,9 +222,9 @@
|
|||||||
<index name="idx_feature_prod_feature_av_id">
|
<index name="idx_feature_prod_feature_av_id">
|
||||||
<index-column name="feature_av_id" />
|
<index-column name="feature_av_id" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="product_id"/>
|
<index name="idx_feature_product_product_id_feature_id_position">
|
||||||
<index-column name="feature_id"/>
|
<index-column name="product_id" />
|
||||||
<index-column name="position"/>
|
<index-column name="feature_id" />
|
||||||
<index-column name="position" />
|
<index-column name="position" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -250,8 +246,8 @@
|
|||||||
<index name="fk_feature_template_idx">
|
<index name="fk_feature_template_idx">
|
||||||
<index-column name="template_id" />
|
<index-column name="template_id" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="template_id"/>
|
<index name="idx_feature_template_template_id_position">
|
||||||
<index-column name="position"/>
|
<index-column name="template_id" />
|
||||||
<index-column name="position" />
|
<index-column name="position" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -326,14 +322,14 @@
|
|||||||
</foreign-key>
|
</foreign-key>
|
||||||
<index name="idx_product_sale_element_product_id">
|
<index name="idx_product_sale_element_product_id">
|
||||||
<index-column name="product_id" />
|
<index-column name="product_id" />
|
||||||
<index name="idx_product_elements_product_id_promo_is_default">
|
|
||||||
<index-column name="product_id"/>
|
|
||||||
<index-column name="promo"/>
|
|
||||||
<index-column name="is_default"/>
|
|
||||||
</index>
|
|
||||||
</index>
|
</index>
|
||||||
<index name="ref">
|
<index name="ref">
|
||||||
<index-column name="ref" />
|
<index-column name="ref" />
|
||||||
|
</index>
|
||||||
|
<index name="idx_product_elements_product_id_promo_is_default">
|
||||||
|
<index-column name="product_id" />
|
||||||
|
<index-column name="promo" />
|
||||||
|
<index-column name="is_default" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
</table>
|
</table>
|
||||||
@@ -391,12 +387,12 @@
|
|||||||
<column name="remember_me_serial" size="255" type="VARCHAR" />
|
<column name="remember_me_serial" size="255" type="VARCHAR" />
|
||||||
<foreign-key foreignTable="customer_title" name="fk_customer_customer_title_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
<foreign-key foreignTable="customer_title" name="fk_customer_customer_title_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||||
<reference foreign="id" local="title_id" />
|
<reference foreign="id" local="title_id" />
|
||||||
<unique name="ref_UNIQUE">
|
|
||||||
<unique-column name="ref" />
|
|
||||||
</unique>
|
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
<index name="idx_customer_customer_title_id">
|
<index name="idx_customer_customer_title_id">
|
||||||
<index-column name="title_id" />
|
<index-column name="title_id" />
|
||||||
|
</index>
|
||||||
|
<unique name="ref_UNIQUE">
|
||||||
|
<unique-column name="ref" />
|
||||||
</unique>
|
</unique>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
</table>
|
</table>
|
||||||
@@ -462,7 +458,7 @@
|
|||||||
<column name="decimals" size="45" type="VARCHAR" />
|
<column name="decimals" size="45" type="VARCHAR" />
|
||||||
<column name="by_default" type="TINYINT" />
|
<column name="by_default" type="TINYINT" />
|
||||||
<column name="position" type="INTEGER" />
|
<column name="position" type="INTEGER" />
|
||||||
<index-column name="by_default"/>
|
<index name="idx_lang_by_default">
|
||||||
<index-column name="by_default" />
|
<index-column name="by_default" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -523,8 +519,8 @@
|
|||||||
<index name="idx_product_image_product_id">
|
<index name="idx_product_image_product_id">
|
||||||
<index-column name="product_id" />
|
<index-column name="product_id" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="product_id"/>
|
<index name="idx_product_image_product_id_position">
|
||||||
<index-column name="position"/>
|
<index-column name="product_id" />
|
||||||
<index-column name="position" />
|
<index-column name="position" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -631,10 +627,10 @@
|
|||||||
<column name="rate" type="FLOAT" />
|
<column name="rate" type="FLOAT" />
|
||||||
<column name="position" type="INTEGER" />
|
<column name="position" type="INTEGER" />
|
||||||
<column name="by_default" type="TINYINT" />
|
<column name="by_default" type="TINYINT" />
|
||||||
<index-column name="by_default"/>
|
<index name="idx_currency_by_default">
|
||||||
<index-column name="by_default" />
|
<index-column name="by_default" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="code"/>
|
<index name="idx_currency_code">
|
||||||
<index-column name="code" />
|
<index-column name="code" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -728,12 +724,12 @@
|
|||||||
<column name="description" type="CLOB" />
|
<column name="description" type="CLOB" />
|
||||||
<column name="chapo" type="LONGVARCHAR" />
|
<column name="chapo" type="LONGVARCHAR" />
|
||||||
<column name="postscriptum" type="LONGVARCHAR" />
|
<column name="postscriptum" type="LONGVARCHAR" />
|
||||||
<index name="idx_module_activate">
|
|
||||||
<index-column name="activate" />
|
|
||||||
</index>
|
|
||||||
<column name="full_namespace" size="255" type="VARCHAR" />
|
<column name="full_namespace" size="255" type="VARCHAR" />
|
||||||
<unique name="code_UNIQUE">
|
<unique name="code_UNIQUE">
|
||||||
<unique-column name="code" />
|
<unique-column name="code" />
|
||||||
|
</unique>
|
||||||
|
<index name="idx_module_activate">
|
||||||
|
<index-column name="activate" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
<behavior name="i18n">
|
<behavior name="i18n">
|
||||||
@@ -1083,8 +1079,8 @@
|
|||||||
<index name="idx_category_image_category_id">
|
<index name="idx_category_image_category_id">
|
||||||
<index-column name="category_id" />
|
<index-column name="category_id" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="category_id"/>
|
<index name="idx_category_image_category_id_position">
|
||||||
<index-column name="position"/>
|
<index-column name="category_id" />
|
||||||
<index-column name="position" />
|
<index-column name="position" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -1107,8 +1103,8 @@
|
|||||||
<index name="idx_folder_image_folder_id">
|
<index name="idx_folder_image_folder_id">
|
||||||
<index-column name="folder_id" />
|
<index-column name="folder_id" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="folder_id"/>
|
<index name="idx_folder_image_folder_id_position">
|
||||||
<index-column name="position"/>
|
<index-column name="folder_id" />
|
||||||
<index-column name="position" />
|
<index-column name="position" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -1131,8 +1127,8 @@
|
|||||||
<index name="idx_content_image_content_id">
|
<index name="idx_content_image_content_id">
|
||||||
<index-column name="content_id" />
|
<index-column name="content_id" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="content_id"/>
|
<index name="idx_content_image_content_id_position">
|
||||||
<index-column name="position"/>
|
<index-column name="content_id" />
|
||||||
<index-column name="position" />
|
<index-column name="position" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -1253,16 +1249,6 @@
|
|||||||
</unique>
|
</unique>
|
||||||
<index name="idx_rewriting_url_redirected">
|
<index name="idx_rewriting_url_redirected">
|
||||||
<index-column name="redirected" />
|
<index-column name="redirected" />
|
||||||
<index name="idx_rewriting_url_view_updated_at">
|
|
||||||
<index-column name="view"/>
|
|
||||||
<index-column name="updated_at"/>
|
|
||||||
</index>
|
|
||||||
<index name="idx_rewriting_url_view_id_view_view_locale_updated_at">
|
|
||||||
<index-column name="view_id"/>
|
|
||||||
<index-column name="view"/>
|
|
||||||
<index-column name="view_locale"/>
|
|
||||||
<index-column name="updated_at"/>
|
|
||||||
</index>
|
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
</table>
|
</table>
|
||||||
@@ -1301,8 +1287,8 @@
|
|||||||
<index name="idx_module_image_module_id">
|
<index name="idx_module_image_module_id">
|
||||||
<index-column name="module_id" />
|
<index-column name="module_id" />
|
||||||
</index>
|
</index>
|
||||||
<index-column name="module_id"/>
|
<index name="idx_module_image_module_id_position">
|
||||||
<index-column name="position"/>
|
<index-column name="module_id" />
|
||||||
<index-column name="position" />
|
<index-column name="position" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
@@ -1357,4 +1343,30 @@
|
|||||||
<index-column name="order_id" />
|
<index-column name="order_id" />
|
||||||
</index>
|
</index>
|
||||||
<behavior name="timestampable" />
|
<behavior name="timestampable" />
|
||||||
|
</table>
|
||||||
|
<table isCrossRef="true" name="coupon_country" namespace="Thelia\Model">
|
||||||
|
<column name="coupon_id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
|
<column name="country_id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
|
<foreign-key foreignTable="country" name="fk_coupon_country_country_id" onDelete="CASCADE">
|
||||||
|
<reference foreign="id" local="country_id" />
|
||||||
|
</foreign-key>
|
||||||
|
<foreign-key foreignTable="coupon" name="fk_coupon_country_coupon_id" onDelete="CASCADE">
|
||||||
|
<reference foreign="id" local="coupon_id" />
|
||||||
|
</foreign-key>
|
||||||
|
<index name="fk_country_id_idx">
|
||||||
|
<index-column name="country_id" />
|
||||||
|
</index>
|
||||||
|
</table>
|
||||||
|
<table isCrossRef="true" name="coupon_module" namespace="Thelia\Model">
|
||||||
|
<column name="coupon_id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
|
<column name="module_id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
|
<foreign-key foreignTable="coupon" name="fk_coupon_module_coupon_id" onDelete="CASCADE">
|
||||||
|
<reference foreign="id" local="coupon_id" />
|
||||||
|
</foreign-key>
|
||||||
|
<foreign-key foreignTable="module" name="fk_coupon_module_module_id" onDelete="CASCADE">
|
||||||
|
<reference foreign="id" local="module_id" />
|
||||||
|
</foreign-key>
|
||||||
|
<index name="fk_module_id_idx">
|
||||||
|
<index-column name="module_id" />
|
||||||
|
</index>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
244
setup/thelia.sql
244
setup/thelia.sql
@@ -23,7 +23,7 @@ CREATE TABLE `category`
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
INDEX `idx_parent` (`parent`),
|
INDEX `idx_parent` (`parent`),
|
||||||
INDEX `idx_parent_position` (`parent`, `position`)
|
INDEX `idx_parent_position` (`parent`, `position`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product
|
-- product
|
||||||
@@ -56,7 +56,7 @@ CREATE TABLE `product`
|
|||||||
CONSTRAINT `fk_product_template`
|
CONSTRAINT `fk_product_template`
|
||||||
FOREIGN KEY (`template_id`)
|
FOREIGN KEY (`template_id`)
|
||||||
REFERENCES `template` (`id`)
|
REFERENCES `template` (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_category
|
-- product_category
|
||||||
@@ -85,7 +85,7 @@ CREATE TABLE `product_category`
|
|||||||
REFERENCES `category` (`id`)
|
REFERENCES `category` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- country
|
-- country
|
||||||
@@ -112,7 +112,7 @@ CREATE TABLE `country`
|
|||||||
REFERENCES `area` (`id`)
|
REFERENCES `area` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE SET NULL
|
ON DELETE SET NULL
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- tax
|
-- tax
|
||||||
@@ -128,7 +128,7 @@ CREATE TABLE `tax`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- tax_rule
|
-- tax_rule
|
||||||
@@ -143,7 +143,7 @@ CREATE TABLE `tax_rule`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- tax_rule_country
|
-- tax_rule_country
|
||||||
@@ -179,7 +179,7 @@ CREATE TABLE `tax_rule_country`
|
|||||||
REFERENCES `country` (`id`)
|
REFERENCES `country` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- feature
|
-- feature
|
||||||
@@ -195,7 +195,7 @@ CREATE TABLE `feature`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- feature_av
|
-- feature_av
|
||||||
@@ -217,7 +217,7 @@ CREATE TABLE `feature_av`
|
|||||||
REFERENCES `feature` (`id`)
|
REFERENCES `feature` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- feature_product
|
-- feature_product
|
||||||
@@ -255,7 +255,7 @@ CREATE TABLE `feature_product`
|
|||||||
REFERENCES `feature_av` (`id`)
|
REFERENCES `feature_av` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- feature_template
|
-- feature_template
|
||||||
@@ -283,7 +283,7 @@ CREATE TABLE `feature_template`
|
|||||||
CONSTRAINT `fk_feature_template`
|
CONSTRAINT `fk_feature_template`
|
||||||
FOREIGN KEY (`template_id`)
|
FOREIGN KEY (`template_id`)
|
||||||
REFERENCES `template` (`id`)
|
REFERENCES `template` (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- attribute
|
-- attribute
|
||||||
@@ -298,7 +298,7 @@ CREATE TABLE `attribute`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- attribute_av
|
-- attribute_av
|
||||||
@@ -320,7 +320,7 @@ CREATE TABLE `attribute_av`
|
|||||||
REFERENCES `attribute` (`id`)
|
REFERENCES `attribute` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- attribute_combination
|
-- attribute_combination
|
||||||
@@ -354,7 +354,7 @@ CREATE TABLE `attribute_combination`
|
|||||||
REFERENCES `product_sale_elements` (`id`)
|
REFERENCES `product_sale_elements` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_sale_elements
|
-- product_sale_elements
|
||||||
@@ -377,14 +377,14 @@ CREATE TABLE `product_sale_elements`
|
|||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
INDEX `idx_product_sale_element_product_id` (`product_id`),
|
INDEX `idx_product_sale_element_product_id` (`product_id`),
|
||||||
INDEX `idx_product_elements_product_id_promo_is_default` (`product_id`, `promo`, `is_default`),
|
|
||||||
INDEX `ref` (`ref`),
|
INDEX `ref` (`ref`),
|
||||||
|
INDEX `idx_product_elements_product_id_promo_is_default` (`product_id`, `promo`, `is_default`),
|
||||||
CONSTRAINT `fk_product_sale_element_product_id`
|
CONSTRAINT `fk_product_sale_element_product_id`
|
||||||
FOREIGN KEY (`product_id`)
|
FOREIGN KEY (`product_id`)
|
||||||
REFERENCES `product` (`id`)
|
REFERENCES `product` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- attribute_template
|
-- attribute_template
|
||||||
@@ -411,7 +411,7 @@ CREATE TABLE `attribute_template`
|
|||||||
CONSTRAINT `fk_attribute_template`
|
CONSTRAINT `fk_attribute_template`
|
||||||
FOREIGN KEY (`template_id`)
|
FOREIGN KEY (`template_id`)
|
||||||
REFERENCES `template` (`id`)
|
REFERENCES `template` (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- config
|
-- config
|
||||||
@@ -430,7 +430,7 @@ CREATE TABLE `config`
|
|||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `name_UNIQUE` (`name`)
|
UNIQUE INDEX `name_UNIQUE` (`name`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- customer
|
-- customer
|
||||||
@@ -464,7 +464,7 @@ CREATE TABLE `customer`
|
|||||||
REFERENCES `customer_title` (`id`)
|
REFERENCES `customer_title` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE RESTRICT
|
ON DELETE RESTRICT
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- address
|
-- address
|
||||||
@@ -511,7 +511,7 @@ CREATE TABLE `address`
|
|||||||
REFERENCES `country` (`id`)
|
REFERENCES `country` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE RESTRICT
|
ON DELETE RESTRICT
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- customer_title
|
-- customer_title
|
||||||
@@ -527,7 +527,7 @@ CREATE TABLE `customer_title`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- lang
|
-- lang
|
||||||
@@ -554,7 +554,7 @@ CREATE TABLE `lang`
|
|||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
INDEX `idx_lang_by_default` (`by_default`)
|
INDEX `idx_lang_by_default` (`by_default`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- folder
|
-- folder
|
||||||
@@ -574,7 +574,7 @@ CREATE TABLE `folder`
|
|||||||
`version_created_at` DATETIME,
|
`version_created_at` DATETIME,
|
||||||
`version_created_by` VARCHAR(100),
|
`version_created_by` VARCHAR(100),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- content
|
-- content
|
||||||
@@ -593,7 +593,7 @@ CREATE TABLE `content`
|
|||||||
`version_created_at` DATETIME,
|
`version_created_at` DATETIME,
|
||||||
`version_created_by` VARCHAR(100),
|
`version_created_by` VARCHAR(100),
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_image
|
-- product_image
|
||||||
@@ -617,7 +617,7 @@ CREATE TABLE `product_image`
|
|||||||
REFERENCES `product` (`id`)
|
REFERENCES `product` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_document
|
-- product_document
|
||||||
@@ -640,7 +640,7 @@ CREATE TABLE `product_document`
|
|||||||
REFERENCES `product` (`id`)
|
REFERENCES `product` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- order
|
-- order
|
||||||
@@ -719,7 +719,7 @@ CREATE TABLE `order`
|
|||||||
REFERENCES `lang` (`id`)
|
REFERENCES `lang` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE RESTRICT
|
ON DELETE RESTRICT
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- currency
|
-- currency
|
||||||
@@ -740,7 +740,7 @@ CREATE TABLE `currency`
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
INDEX `idx_currency_by_default` (`by_default`),
|
INDEX `idx_currency_by_default` (`by_default`),
|
||||||
INDEX `idx_currency_code` (`code`)
|
INDEX `idx_currency_code` (`code`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- order_address
|
-- order_address
|
||||||
@@ -765,7 +765,7 @@ CREATE TABLE `order_address`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- order_product
|
-- order_product
|
||||||
@@ -802,7 +802,7 @@ CREATE TABLE `order_product`
|
|||||||
REFERENCES `order` (`id`)
|
REFERENCES `order` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- order_status
|
-- order_status
|
||||||
@@ -818,7 +818,7 @@ CREATE TABLE `order_status`
|
|||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `code_UNIQUE` (`code`)
|
UNIQUE INDEX `code_UNIQUE` (`code`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- order_product_attribute_combination
|
-- order_product_attribute_combination
|
||||||
@@ -847,7 +847,7 @@ CREATE TABLE `order_product_attribute_combination`
|
|||||||
REFERENCES `order_product` (`id`)
|
REFERENCES `order_product` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- module
|
-- module
|
||||||
@@ -868,7 +868,7 @@ CREATE TABLE `module`
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `code_UNIQUE` (`code`),
|
UNIQUE INDEX `code_UNIQUE` (`code`),
|
||||||
INDEX `idx_module_activate` (`activate`)
|
INDEX `idx_module_activate` (`activate`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- accessory
|
-- accessory
|
||||||
@@ -897,7 +897,7 @@ CREATE TABLE `accessory`
|
|||||||
REFERENCES `product` (`id`)
|
REFERENCES `product` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- area
|
-- area
|
||||||
@@ -913,7 +913,7 @@ CREATE TABLE `area`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- area_delivery_module
|
-- area_delivery_module
|
||||||
@@ -942,7 +942,7 @@ CREATE TABLE `area_delivery_module`
|
|||||||
REFERENCES `module` (`id`)
|
REFERENCES `module` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- profile
|
-- profile
|
||||||
@@ -958,7 +958,7 @@ CREATE TABLE `profile`
|
|||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `code_UNIQUE` (`code`)
|
UNIQUE INDEX `code_UNIQUE` (`code`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- resource
|
-- resource
|
||||||
@@ -974,7 +974,7 @@ CREATE TABLE `resource`
|
|||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `code_UNIQUE` (`code`)
|
UNIQUE INDEX `code_UNIQUE` (`code`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- admin
|
-- admin
|
||||||
@@ -1005,7 +1005,7 @@ CREATE TABLE `admin`
|
|||||||
REFERENCES `profile` (`id`)
|
REFERENCES `profile` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE RESTRICT
|
ON DELETE RESTRICT
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- profile_resource
|
-- profile_resource
|
||||||
@@ -1033,7 +1033,7 @@ CREATE TABLE `profile_resource`
|
|||||||
REFERENCES `resource` (`id`)
|
REFERENCES `resource` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- profile_module
|
-- profile_module
|
||||||
@@ -1061,7 +1061,7 @@ CREATE TABLE `profile_module`
|
|||||||
REFERENCES `module` (`id`)
|
REFERENCES `module` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- message
|
-- message
|
||||||
@@ -1085,7 +1085,7 @@ CREATE TABLE `message`
|
|||||||
`version_created_by` VARCHAR(100),
|
`version_created_by` VARCHAR(100),
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `name_UNIQUE` (`name`)
|
UNIQUE INDEX `name_UNIQUE` (`name`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- coupon
|
-- coupon
|
||||||
@@ -1120,7 +1120,7 @@ CREATE TABLE `coupon`
|
|||||||
INDEX `idx_is_removing_postage` (`is_removing_postage`),
|
INDEX `idx_is_removing_postage` (`is_removing_postage`),
|
||||||
INDEX `idx_max_usage` (`max_usage`),
|
INDEX `idx_max_usage` (`max_usage`),
|
||||||
INDEX `idx_is_available_on_special_offers` (`is_available_on_special_offers`)
|
INDEX `idx_is_available_on_special_offers` (`is_available_on_special_offers`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- admin_log
|
-- admin_log
|
||||||
@@ -1141,7 +1141,7 @@ CREATE TABLE `admin_log`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- content_folder
|
-- content_folder
|
||||||
@@ -1170,7 +1170,7 @@ CREATE TABLE `content_folder`
|
|||||||
REFERENCES `folder` (`id`)
|
REFERENCES `folder` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- cart
|
-- cart
|
||||||
@@ -1215,7 +1215,7 @@ CREATE TABLE `cart`
|
|||||||
REFERENCES `currency` (`id`)
|
REFERENCES `currency` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- cart_item
|
-- cart_item
|
||||||
@@ -1255,7 +1255,7 @@ CREATE TABLE `cart_item`
|
|||||||
REFERENCES `product_sale_elements` (`id`)
|
REFERENCES `product_sale_elements` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_price
|
-- product_price
|
||||||
@@ -1283,7 +1283,7 @@ CREATE TABLE `product_price`
|
|||||||
FOREIGN KEY (`currency_id`)
|
FOREIGN KEY (`currency_id`)
|
||||||
REFERENCES `currency` (`id`)
|
REFERENCES `currency` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- category_image
|
-- category_image
|
||||||
@@ -1307,7 +1307,7 @@ CREATE TABLE `category_image`
|
|||||||
REFERENCES `category` (`id`)
|
REFERENCES `category` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- folder_image
|
-- folder_image
|
||||||
@@ -1331,7 +1331,7 @@ CREATE TABLE `folder_image`
|
|||||||
REFERENCES `folder` (`id`)
|
REFERENCES `folder` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- content_image
|
-- content_image
|
||||||
@@ -1355,7 +1355,7 @@ CREATE TABLE `content_image`
|
|||||||
REFERENCES `content` (`id`)
|
REFERENCES `content` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- category_document
|
-- category_document
|
||||||
@@ -1378,7 +1378,7 @@ CREATE TABLE `category_document`
|
|||||||
REFERENCES `category` (`id`)
|
REFERENCES `category` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- content_document
|
-- content_document
|
||||||
@@ -1401,7 +1401,7 @@ CREATE TABLE `content_document`
|
|||||||
REFERENCES `content` (`id`)
|
REFERENCES `content` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- folder_document
|
-- folder_document
|
||||||
@@ -1424,7 +1424,7 @@ CREATE TABLE `folder_document`
|
|||||||
REFERENCES `folder` (`id`)
|
REFERENCES `folder` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_associated_content
|
-- product_associated_content
|
||||||
@@ -1453,7 +1453,7 @@ CREATE TABLE `product_associated_content`
|
|||||||
REFERENCES `content` (`id`)
|
REFERENCES `content` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- category_associated_content
|
-- category_associated_content
|
||||||
@@ -1482,7 +1482,7 @@ CREATE TABLE `category_associated_content`
|
|||||||
REFERENCES `content` (`id`)
|
REFERENCES `content` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- rewriting_url
|
-- rewriting_url
|
||||||
@@ -1503,14 +1503,12 @@ CREATE TABLE `rewriting_url`
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `url_UNIQUE` (`url`),
|
UNIQUE INDEX `url_UNIQUE` (`url`),
|
||||||
INDEX `idx_rewriting_url_redirected` (`redirected`),
|
INDEX `idx_rewriting_url_redirected` (`redirected`),
|
||||||
INDEX `idx_rewriting_url_view_updated_at` (`view`, `updated_at`),
|
|
||||||
INDEX `idx_rewriting_url_view_id_view_view_locale_updated_at` (`view_id`, `view`, `view_locale`, `updated_at`),
|
|
||||||
CONSTRAINT `fk_rewriting_url_redirected`
|
CONSTRAINT `fk_rewriting_url_redirected`
|
||||||
FOREIGN KEY (`redirected`)
|
FOREIGN KEY (`redirected`)
|
||||||
REFERENCES `rewriting_url` (`id`)
|
REFERENCES `rewriting_url` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE RESTRICT
|
ON DELETE RESTRICT
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- rewriting_argument
|
-- rewriting_argument
|
||||||
@@ -1532,7 +1530,7 @@ CREATE TABLE `rewriting_argument`
|
|||||||
REFERENCES `rewriting_url` (`id`)
|
REFERENCES `rewriting_url` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- template
|
-- template
|
||||||
@@ -1546,7 +1544,7 @@ CREATE TABLE `template`
|
|||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- module_image
|
-- module_image
|
||||||
@@ -1570,7 +1568,7 @@ CREATE TABLE `module_image`
|
|||||||
REFERENCES `module` (`id`)
|
REFERENCES `module` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- order_product_tax
|
-- order_product_tax
|
||||||
@@ -1595,7 +1593,7 @@ CREATE TABLE `order_product_tax`
|
|||||||
REFERENCES `order_product` (`id`)
|
REFERENCES `order_product` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- newsletter
|
-- newsletter
|
||||||
@@ -1614,7 +1612,7 @@ CREATE TABLE `newsletter`
|
|||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE INDEX `email_UNIQUE` (`email`)
|
UNIQUE INDEX `email_UNIQUE` (`email`)
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- order_coupon
|
-- order_coupon
|
||||||
@@ -1646,7 +1644,51 @@ CREATE TABLE `order_coupon`
|
|||||||
REFERENCES `order` (`id`)
|
REFERENCES `order` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- coupon_country
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `coupon_country`;
|
||||||
|
|
||||||
|
CREATE TABLE `coupon_country`
|
||||||
|
(
|
||||||
|
`coupon_id` INTEGER NOT NULL,
|
||||||
|
`country_id` INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (`coupon_id`,`country_id`),
|
||||||
|
INDEX `fk_country_id_idx` (`country_id`),
|
||||||
|
CONSTRAINT `fk_coupon_country_country_id`
|
||||||
|
FOREIGN KEY (`country_id`)
|
||||||
|
REFERENCES `country` (`id`)
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
CONSTRAINT `fk_coupon_country_coupon_id`
|
||||||
|
FOREIGN KEY (`coupon_id`)
|
||||||
|
REFERENCES `coupon` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- coupon_module
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `coupon_module`;
|
||||||
|
|
||||||
|
CREATE TABLE `coupon_module`
|
||||||
|
(
|
||||||
|
`coupon_id` INTEGER NOT NULL,
|
||||||
|
`module_id` INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (`coupon_id`,`module_id`),
|
||||||
|
INDEX `fk_module_id_idx` (`module_id`),
|
||||||
|
CONSTRAINT `fk_coupon_module_coupon_id`
|
||||||
|
FOREIGN KEY (`coupon_id`)
|
||||||
|
REFERENCES `coupon` (`id`)
|
||||||
|
ON DELETE CASCADE,
|
||||||
|
CONSTRAINT `fk_coupon_module_module_id`
|
||||||
|
FOREIGN KEY (`module_id`)
|
||||||
|
REFERENCES `module` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- category_i18n
|
-- category_i18n
|
||||||
@@ -1670,7 +1712,7 @@ CREATE TABLE `category_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `category` (`id`)
|
REFERENCES `category` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_i18n
|
-- product_i18n
|
||||||
@@ -1694,7 +1736,7 @@ CREATE TABLE `product_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `product` (`id`)
|
REFERENCES `product` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- country_i18n
|
-- country_i18n
|
||||||
@@ -1715,7 +1757,7 @@ CREATE TABLE `country_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `country` (`id`)
|
REFERENCES `country` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- tax_i18n
|
-- tax_i18n
|
||||||
@@ -1734,7 +1776,7 @@ CREATE TABLE `tax_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `tax` (`id`)
|
REFERENCES `tax` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- tax_rule_i18n
|
-- tax_rule_i18n
|
||||||
@@ -1753,7 +1795,7 @@ CREATE TABLE `tax_rule_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `tax_rule` (`id`)
|
REFERENCES `tax_rule` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- feature_i18n
|
-- feature_i18n
|
||||||
@@ -1774,7 +1816,7 @@ CREATE TABLE `feature_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `feature` (`id`)
|
REFERENCES `feature` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- feature_av_i18n
|
-- feature_av_i18n
|
||||||
@@ -1795,7 +1837,7 @@ CREATE TABLE `feature_av_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `feature_av` (`id`)
|
REFERENCES `feature_av` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- attribute_i18n
|
-- attribute_i18n
|
||||||
@@ -1816,7 +1858,7 @@ CREATE TABLE `attribute_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `attribute` (`id`)
|
REFERENCES `attribute` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- attribute_av_i18n
|
-- attribute_av_i18n
|
||||||
@@ -1837,7 +1879,7 @@ CREATE TABLE `attribute_av_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `attribute_av` (`id`)
|
REFERENCES `attribute_av` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- config_i18n
|
-- config_i18n
|
||||||
@@ -1858,7 +1900,7 @@ CREATE TABLE `config_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `config` (`id`)
|
REFERENCES `config` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- customer_title_i18n
|
-- customer_title_i18n
|
||||||
@@ -1877,7 +1919,7 @@ CREATE TABLE `customer_title_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `customer_title` (`id`)
|
REFERENCES `customer_title` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- folder_i18n
|
-- folder_i18n
|
||||||
@@ -1901,7 +1943,7 @@ CREATE TABLE `folder_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `folder` (`id`)
|
REFERENCES `folder` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- content_i18n
|
-- content_i18n
|
||||||
@@ -1925,7 +1967,7 @@ CREATE TABLE `content_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `content` (`id`)
|
REFERENCES `content` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_image_i18n
|
-- product_image_i18n
|
||||||
@@ -1946,7 +1988,7 @@ CREATE TABLE `product_image_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `product_image` (`id`)
|
REFERENCES `product_image` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_document_i18n
|
-- product_document_i18n
|
||||||
@@ -1967,7 +2009,7 @@ CREATE TABLE `product_document_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `product_document` (`id`)
|
REFERENCES `product_document` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- currency_i18n
|
-- currency_i18n
|
||||||
@@ -1985,7 +2027,7 @@ CREATE TABLE `currency_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `currency` (`id`)
|
REFERENCES `currency` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- order_status_i18n
|
-- order_status_i18n
|
||||||
@@ -2006,7 +2048,7 @@ CREATE TABLE `order_status_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `order_status` (`id`)
|
REFERENCES `order_status` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- module_i18n
|
-- module_i18n
|
||||||
@@ -2027,7 +2069,7 @@ CREATE TABLE `module_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `module` (`id`)
|
REFERENCES `module` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- profile_i18n
|
-- profile_i18n
|
||||||
@@ -2048,7 +2090,7 @@ CREATE TABLE `profile_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `profile` (`id`)
|
REFERENCES `profile` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- resource_i18n
|
-- resource_i18n
|
||||||
@@ -2069,7 +2111,7 @@ CREATE TABLE `resource_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `resource` (`id`)
|
REFERENCES `resource` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- message_i18n
|
-- message_i18n
|
||||||
@@ -2090,7 +2132,7 @@ CREATE TABLE `message_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `message` (`id`)
|
REFERENCES `message` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- coupon_i18n
|
-- coupon_i18n
|
||||||
@@ -2110,7 +2152,7 @@ CREATE TABLE `coupon_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `coupon` (`id`)
|
REFERENCES `coupon` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- category_image_i18n
|
-- category_image_i18n
|
||||||
@@ -2131,7 +2173,7 @@ CREATE TABLE `category_image_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `category_image` (`id`)
|
REFERENCES `category_image` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- folder_image_i18n
|
-- folder_image_i18n
|
||||||
@@ -2152,7 +2194,7 @@ CREATE TABLE `folder_image_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `folder_image` (`id`)
|
REFERENCES `folder_image` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- content_image_i18n
|
-- content_image_i18n
|
||||||
@@ -2173,7 +2215,7 @@ CREATE TABLE `content_image_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `content_image` (`id`)
|
REFERENCES `content_image` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- category_document_i18n
|
-- category_document_i18n
|
||||||
@@ -2194,7 +2236,7 @@ CREATE TABLE `category_document_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `category_document` (`id`)
|
REFERENCES `category_document` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- content_document_i18n
|
-- content_document_i18n
|
||||||
@@ -2215,7 +2257,7 @@ CREATE TABLE `content_document_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `content_document` (`id`)
|
REFERENCES `content_document` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- folder_document_i18n
|
-- folder_document_i18n
|
||||||
@@ -2236,7 +2278,7 @@ CREATE TABLE `folder_document_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `folder_document` (`id`)
|
REFERENCES `folder_document` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- template_i18n
|
-- template_i18n
|
||||||
@@ -2254,7 +2296,7 @@ CREATE TABLE `template_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `template` (`id`)
|
REFERENCES `template` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- module_image_i18n
|
-- module_image_i18n
|
||||||
@@ -2275,7 +2317,7 @@ CREATE TABLE `module_image_i18n`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `module_image` (`id`)
|
REFERENCES `module_image` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- category_version
|
-- category_version
|
||||||
@@ -2299,7 +2341,7 @@ CREATE TABLE `category_version`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `category` (`id`)
|
REFERENCES `category` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- product_version
|
-- product_version
|
||||||
@@ -2325,7 +2367,7 @@ CREATE TABLE `product_version`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `product` (`id`)
|
REFERENCES `product` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- folder_version
|
-- folder_version
|
||||||
@@ -2349,7 +2391,7 @@ CREATE TABLE `folder_version`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `folder` (`id`)
|
REFERENCES `folder` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- content_version
|
-- content_version
|
||||||
@@ -2372,7 +2414,7 @@ CREATE TABLE `content_version`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `content` (`id`)
|
REFERENCES `content` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- message_version
|
-- message_version
|
||||||
@@ -2399,7 +2441,7 @@ CREATE TABLE `message_version`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `message` (`id`)
|
REFERENCES `message` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- coupon_version
|
-- coupon_version
|
||||||
@@ -2429,7 +2471,7 @@ CREATE TABLE `coupon_version`
|
|||||||
FOREIGN KEY (`id`)
|
FOREIGN KEY (`id`)
|
||||||
REFERENCES `coupon` (`id`)
|
REFERENCES `coupon` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB CHARACTER SET='utf8';
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
# This restores the fkey checks, after having unset them earlier
|
# This restores the fkey checks, after having unset them earlier
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user