tax engine model

This commit is contained in:
Etienne Roudeix
2013-09-09 11:01:31 +02:00
parent 0a5281c1e6
commit ca9ec3b089
16 changed files with 535 additions and 602 deletions

View File

@@ -1631,7 +1631,10 @@ abstract class Country implements ActiveRecordInterface
$taxRuleCountriesToDelete = $this->getTaxRuleCountries(new Criteria(), $con)->diff($taxRuleCountries); $taxRuleCountriesToDelete = $this->getTaxRuleCountries(new Criteria(), $con)->diff($taxRuleCountries);
$this->taxRuleCountriesScheduledForDeletion = $taxRuleCountriesToDelete; //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->taxRuleCountriesScheduledForDeletion = clone $taxRuleCountriesToDelete;
foreach ($taxRuleCountriesToDelete as $taxRuleCountryRemoved) { foreach ($taxRuleCountriesToDelete as $taxRuleCountryRemoved) {
$taxRuleCountryRemoved->setCountry(null); $taxRuleCountryRemoved->setCountry(null);
@@ -1724,7 +1727,7 @@ abstract class Country implements ActiveRecordInterface
$this->taxRuleCountriesScheduledForDeletion = clone $this->collTaxRuleCountries; $this->taxRuleCountriesScheduledForDeletion = clone $this->collTaxRuleCountries;
$this->taxRuleCountriesScheduledForDeletion->clear(); $this->taxRuleCountriesScheduledForDeletion->clear();
} }
$this->taxRuleCountriesScheduledForDeletion[]= $taxRuleCountry; $this->taxRuleCountriesScheduledForDeletion[]= clone $taxRuleCountry;
$taxRuleCountry->setCountry(null); $taxRuleCountry->setCountry(null);
} }

View File

@@ -616,7 +616,7 @@ abstract class CountryQuery extends ModelCriteria
* *
* @return ChildCountryQuery The current query, for fluid interface * @return ChildCountryQuery The current query, for fluid interface
*/ */
public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('TaxRuleCountry'); $relationMap = $tableMap->getRelation('TaxRuleCountry');
@@ -651,7 +651,7 @@ abstract class CountryQuery extends ModelCriteria
* *
* @return \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query * @return \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query
*/ */
public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinTaxRuleCountry($relationAlias, $joinType) ->joinTaxRuleCountry($relationAlias, $joinType)

View File

@@ -791,10 +791,9 @@ abstract class Tax implements ActiveRecordInterface
if ($this->taxRuleCountriesScheduledForDeletion !== null) { if ($this->taxRuleCountriesScheduledForDeletion !== null) {
if (!$this->taxRuleCountriesScheduledForDeletion->isEmpty()) { if (!$this->taxRuleCountriesScheduledForDeletion->isEmpty()) {
foreach ($this->taxRuleCountriesScheduledForDeletion as $taxRuleCountry) { \Thelia\Model\TaxRuleCountryQuery::create()
// need to save related object because we set the relation to null ->filterByPrimaryKeys($this->taxRuleCountriesScheduledForDeletion->getPrimaryKeys(false))
$taxRuleCountry->save($con); ->delete($con);
}
$this->taxRuleCountriesScheduledForDeletion = null; $this->taxRuleCountriesScheduledForDeletion = null;
} }
} }
@@ -1346,7 +1345,10 @@ abstract class Tax implements ActiveRecordInterface
$taxRuleCountriesToDelete = $this->getTaxRuleCountries(new Criteria(), $con)->diff($taxRuleCountries); $taxRuleCountriesToDelete = $this->getTaxRuleCountries(new Criteria(), $con)->diff($taxRuleCountries);
$this->taxRuleCountriesScheduledForDeletion = $taxRuleCountriesToDelete; //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->taxRuleCountriesScheduledForDeletion = clone $taxRuleCountriesToDelete;
foreach ($taxRuleCountriesToDelete as $taxRuleCountryRemoved) { foreach ($taxRuleCountriesToDelete as $taxRuleCountryRemoved) {
$taxRuleCountryRemoved->setTax(null); $taxRuleCountryRemoved->setTax(null);
@@ -1439,7 +1441,7 @@ abstract class Tax implements ActiveRecordInterface
$this->taxRuleCountriesScheduledForDeletion = clone $this->collTaxRuleCountries; $this->taxRuleCountriesScheduledForDeletion = clone $this->collTaxRuleCountries;
$this->taxRuleCountriesScheduledForDeletion->clear(); $this->taxRuleCountriesScheduledForDeletion->clear();
} }
$this->taxRuleCountriesScheduledForDeletion[]= $taxRuleCountry; $this->taxRuleCountriesScheduledForDeletion[]= clone $taxRuleCountry;
$taxRuleCountry->setTax(null); $taxRuleCountry->setTax(null);
} }

View File

@@ -432,7 +432,7 @@ abstract class TaxQuery extends ModelCriteria
* *
* @return ChildTaxQuery The current query, for fluid interface * @return ChildTaxQuery The current query, for fluid interface
*/ */
public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('TaxRuleCountry'); $relationMap = $tableMap->getRelation('TaxRuleCountry');
@@ -467,7 +467,7 @@ abstract class TaxQuery extends ModelCriteria
* *
* @return \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query * @return \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query
*/ */
public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinTaxRuleCountry($relationAlias, $joinType) ->joinTaxRuleCountry($relationAlias, $joinType)

View File

@@ -67,24 +67,6 @@ abstract class TaxRule implements ActiveRecordInterface
*/ */
protected $id; protected $id;
/**
* The value for the code field.
* @var string
*/
protected $code;
/**
* The value for the title field.
* @var string
*/
protected $title;
/**
* The value for the description field.
* @var string
*/
protected $description;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -420,39 +402,6 @@ abstract class TaxRule implements ActiveRecordInterface
return $this->id; return $this->id;
} }
/**
* Get the [code] column value.
*
* @return string
*/
public function getCode()
{
return $this->code;
}
/**
* Get the [title] column value.
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get the [description] column value.
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -514,69 +463,6 @@ abstract class TaxRule implements ActiveRecordInterface
return $this; return $this;
} // setId() } // setId()
/**
* Set the value of [code] column.
*
* @param string $v new value
* @return \Thelia\Model\TaxRule The current object (for fluent API support)
*/
public function setCode($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->code !== $v) {
$this->code = $v;
$this->modifiedColumns[] = TaxRuleTableMap::CODE;
}
return $this;
} // setCode()
/**
* Set the value of [title] column.
*
* @param string $v new value
* @return \Thelia\Model\TaxRule The current object (for fluent API support)
*/
public function setTitle($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->title !== $v) {
$this->title = $v;
$this->modifiedColumns[] = TaxRuleTableMap::TITLE;
}
return $this;
} // setTitle()
/**
* Set the value of [description] column.
*
* @param string $v new value
* @return \Thelia\Model\TaxRule The current object (for fluent API support)
*/
public function setDescription($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->description !== $v) {
$this->description = $v;
$this->modifiedColumns[] = TaxRuleTableMap::DESCRIPTION;
}
return $this;
} // setDescription()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
* *
@@ -659,22 +545,13 @@ abstract class TaxRule implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null; $this->id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$this->code = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
$this->title = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
$this->description = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : TaxRuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : TaxRuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -687,7 +564,7 @@ abstract class TaxRule implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 6; // 6 = TaxRuleTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 3; // 3 = TaxRuleTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\TaxRule object", 0, $e); throw new PropelException("Error populating \Thelia\Model\TaxRule object", 0, $e);
@@ -968,15 +845,6 @@ abstract class TaxRule implements ActiveRecordInterface
if ($this->isColumnModified(TaxRuleTableMap::ID)) { if ($this->isColumnModified(TaxRuleTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID'; $modifiedColumns[':p' . $index++] = 'ID';
} }
if ($this->isColumnModified(TaxRuleTableMap::CODE)) {
$modifiedColumns[':p' . $index++] = 'CODE';
}
if ($this->isColumnModified(TaxRuleTableMap::TITLE)) {
$modifiedColumns[':p' . $index++] = 'TITLE';
}
if ($this->isColumnModified(TaxRuleTableMap::DESCRIPTION)) {
$modifiedColumns[':p' . $index++] = 'DESCRIPTION';
}
if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) { if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
@@ -997,15 +865,6 @@ abstract class TaxRule implements ActiveRecordInterface
case 'ID': case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break; break;
case 'CODE':
$stmt->bindValue($identifier, $this->code, PDO::PARAM_STR);
break;
case 'TITLE':
$stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
break;
case 'DESCRIPTION':
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break; break;
@@ -1078,18 +937,9 @@ abstract class TaxRule implements ActiveRecordInterface
return $this->getId(); return $this->getId();
break; break;
case 1: case 1:
return $this->getCode();
break;
case 2:
return $this->getTitle();
break;
case 3:
return $this->getDescription();
break;
case 4:
return $this->getCreatedAt(); return $this->getCreatedAt();
break; break;
case 5: case 2:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -1122,11 +972,8 @@ abstract class TaxRule implements ActiveRecordInterface
$keys = TaxRuleTableMap::getFieldNames($keyType); $keys = TaxRuleTableMap::getFieldNames($keyType);
$result = array( $result = array(
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getCode(), $keys[1] => $this->getCreatedAt(),
$keys[2] => $this->getTitle(), $keys[2] => $this->getUpdatedAt(),
$keys[3] => $this->getDescription(),
$keys[4] => $this->getCreatedAt(),
$keys[5] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1182,18 +1029,9 @@ abstract class TaxRule implements ActiveRecordInterface
$this->setId($value); $this->setId($value);
break; break;
case 1: case 1:
$this->setCode($value);
break;
case 2:
$this->setTitle($value);
break;
case 3:
$this->setDescription($value);
break;
case 4:
$this->setCreatedAt($value); $this->setCreatedAt($value);
break; break;
case 5: case 2:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1221,11 +1059,8 @@ abstract class TaxRule implements ActiveRecordInterface
$keys = TaxRuleTableMap::getFieldNames($keyType); $keys = TaxRuleTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setCreatedAt($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setUpdatedAt($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
} }
/** /**
@@ -1238,9 +1073,6 @@ abstract class TaxRule implements ActiveRecordInterface
$criteria = new Criteria(TaxRuleTableMap::DATABASE_NAME); $criteria = new Criteria(TaxRuleTableMap::DATABASE_NAME);
if ($this->isColumnModified(TaxRuleTableMap::ID)) $criteria->add(TaxRuleTableMap::ID, $this->id); if ($this->isColumnModified(TaxRuleTableMap::ID)) $criteria->add(TaxRuleTableMap::ID, $this->id);
if ($this->isColumnModified(TaxRuleTableMap::CODE)) $criteria->add(TaxRuleTableMap::CODE, $this->code);
if ($this->isColumnModified(TaxRuleTableMap::TITLE)) $criteria->add(TaxRuleTableMap::TITLE, $this->title);
if ($this->isColumnModified(TaxRuleTableMap::DESCRIPTION)) $criteria->add(TaxRuleTableMap::DESCRIPTION, $this->description);
if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) $criteria->add(TaxRuleTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) $criteria->add(TaxRuleTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(TaxRuleTableMap::UPDATED_AT)) $criteria->add(TaxRuleTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(TaxRuleTableMap::UPDATED_AT)) $criteria->add(TaxRuleTableMap::UPDATED_AT, $this->updated_at);
@@ -1306,9 +1138,6 @@ abstract class TaxRule implements ActiveRecordInterface
*/ */
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{ {
$copyObj->setCode($this->getCode());
$copyObj->setTitle($this->getTitle());
$copyObj->setDescription($this->getDescription());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1723,7 +1552,10 @@ abstract class TaxRule implements ActiveRecordInterface
$taxRuleCountriesToDelete = $this->getTaxRuleCountries(new Criteria(), $con)->diff($taxRuleCountries); $taxRuleCountriesToDelete = $this->getTaxRuleCountries(new Criteria(), $con)->diff($taxRuleCountries);
$this->taxRuleCountriesScheduledForDeletion = $taxRuleCountriesToDelete; //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->taxRuleCountriesScheduledForDeletion = clone $taxRuleCountriesToDelete;
foreach ($taxRuleCountriesToDelete as $taxRuleCountryRemoved) { foreach ($taxRuleCountriesToDelete as $taxRuleCountryRemoved) {
$taxRuleCountryRemoved->setTaxRule(null); $taxRuleCountryRemoved->setTaxRule(null);
@@ -1816,7 +1648,7 @@ abstract class TaxRule implements ActiveRecordInterface
$this->taxRuleCountriesScheduledForDeletion = clone $this->collTaxRuleCountries; $this->taxRuleCountriesScheduledForDeletion = clone $this->collTaxRuleCountries;
$this->taxRuleCountriesScheduledForDeletion->clear(); $this->taxRuleCountriesScheduledForDeletion->clear();
} }
$this->taxRuleCountriesScheduledForDeletion[]= $taxRuleCountry; $this->taxRuleCountriesScheduledForDeletion[]= clone $taxRuleCountry;
$taxRuleCountry->setTaxRule(null); $taxRuleCountry->setTaxRule(null);
} }
@@ -2104,9 +1936,6 @@ abstract class TaxRule implements ActiveRecordInterface
public function clear() public function clear()
{ {
$this->id = null; $this->id = null;
$this->code = null;
$this->title = null;
$this->description = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
@@ -2286,6 +2115,54 @@ abstract class TaxRule implements ActiveRecordInterface
return $this->getTranslation($this->getLocale(), $con); return $this->getTranslation($this->getLocale(), $con);
} }
/**
* Get the [title] column value.
*
* @return string
*/
public function getTitle()
{
return $this->getCurrentTranslation()->getTitle();
}
/**
* Set the value of [title] column.
*
* @param string $v new value
* @return \Thelia\Model\TaxRuleI18n The current object (for fluent API support)
*/
public function setTitle($v)
{ $this->getCurrentTranslation()->setTitle($v);
return $this;
}
/**
* Get the [description] column value.
*
* @return string
*/
public function getDescription()
{
return $this->getCurrentTranslation()->getDescription();
}
/**
* Set the value of [description] column.
*
* @param string $v new value
* @return \Thelia\Model\TaxRuleI18n The current object (for fluent API support)
*/
public function setDescription($v)
{ $this->getCurrentTranslation()->setDescription($v);
return $this;
}
/** /**
* Code to be run before persisting the object * Code to be run before persisting the object
* @param ConnectionInterface $con * @param ConnectionInterface $con

View File

@@ -60,12 +60,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
*/ */
protected $virtualColumns = array(); protected $virtualColumns = array();
/**
* The value for the id field.
* @var int
*/
protected $id;
/** /**
* The value for the tax_rule_id field. * The value for the tax_rule_id field.
* @var int * @var int
@@ -85,10 +79,10 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
protected $tax_id; protected $tax_id;
/** /**
* The value for the none field. * The value for the position field.
* @var int * @var int
*/ */
protected $none; protected $position;
/** /**
* The value for the created_at field. * The value for the created_at field.
@@ -379,17 +373,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
return array_keys(get_object_vars($this)); return array_keys(get_object_vars($this));
} }
/**
* Get the [id] column value.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/** /**
* Get the [tax_rule_id] column value. * Get the [tax_rule_id] column value.
* *
@@ -424,14 +407,14 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
} }
/** /**
* Get the [none] column value. * Get the [position] column value.
* *
* @return int * @return int
*/ */
public function getNone() public function getPosition()
{ {
return $this->none; return $this->position;
} }
/** /**
@@ -474,27 +457,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
} }
} }
/**
* Set the value of [id] column.
*
* @param int $v new value
* @return \Thelia\Model\TaxRuleCountry The current object (for fluent API support)
*/
public function setId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->id !== $v) {
$this->id = $v;
$this->modifiedColumns[] = TaxRuleCountryTableMap::ID;
}
return $this;
} // setId()
/** /**
* Set the value of [tax_rule_id] column. * Set the value of [tax_rule_id] column.
* *
@@ -571,25 +533,25 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
} // setTaxId() } // setTaxId()
/** /**
* Set the value of [none] column. * Set the value of [position] column.
* *
* @param int $v new value * @param int $v new value
* @return \Thelia\Model\TaxRuleCountry The current object (for fluent API support) * @return \Thelia\Model\TaxRuleCountry The current object (for fluent API support)
*/ */
public function setNone($v) public function setPosition($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (int) $v; $v = (int) $v;
} }
if ($this->none !== $v) { if ($this->position !== $v) {
$this->none = $v; $this->position = $v;
$this->modifiedColumns[] = TaxRuleCountryTableMap::NONE; $this->modifiedColumns[] = TaxRuleCountryTableMap::POSITION;
} }
return $this; return $this;
} // setNone() } // setPosition()
/** /**
* Sets the value of [created_at] column to a normalized version of the date/time value specified. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
@@ -670,28 +632,25 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
try { try {
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleCountryTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleCountryTableMap::translateFieldName('TaxRuleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleCountryTableMap::translateFieldName('TaxRuleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->tax_rule_id = (null !== $col) ? (int) $col : null; $this->tax_rule_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleCountryTableMap::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleCountryTableMap::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)];
$this->country_id = (null !== $col) ? (int) $col : null; $this->country_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleCountryTableMap::translateFieldName('TaxId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleCountryTableMap::translateFieldName('TaxId', TableMap::TYPE_PHPNAME, $indexType)];
$this->tax_id = (null !== $col) ? (int) $col : null; $this->tax_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : TaxRuleCountryTableMap::translateFieldName('None', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleCountryTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
$this->none = (null !== $col) ? (int) $col : null; $this->position = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : TaxRuleCountryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : TaxRuleCountryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : TaxRuleCountryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : TaxRuleCountryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
$col = null; $col = null;
} }
@@ -704,7 +663,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 7; // 7 = TaxRuleCountryTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 6; // 6 = TaxRuleCountryTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\TaxRuleCountry object", 0, $e); throw new PropelException("Error populating \Thelia\Model\TaxRuleCountry object", 0, $e);
@@ -958,9 +917,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
// check the columns in natural order for more readable SQL queries // check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(TaxRuleCountryTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID';
}
if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_RULE_ID)) { if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_RULE_ID)) {
$modifiedColumns[':p' . $index++] = 'TAX_RULE_ID'; $modifiedColumns[':p' . $index++] = 'TAX_RULE_ID';
} }
@@ -970,8 +926,8 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_ID)) { if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_ID)) {
$modifiedColumns[':p' . $index++] = 'TAX_ID'; $modifiedColumns[':p' . $index++] = 'TAX_ID';
} }
if ($this->isColumnModified(TaxRuleCountryTableMap::NONE)) { if ($this->isColumnModified(TaxRuleCountryTableMap::POSITION)) {
$modifiedColumns[':p' . $index++] = 'NONE'; $modifiedColumns[':p' . $index++] = 'POSITION';
} }
if ($this->isColumnModified(TaxRuleCountryTableMap::CREATED_AT)) { if ($this->isColumnModified(TaxRuleCountryTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
@@ -990,9 +946,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) { foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) { switch ($columnName) {
case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case 'TAX_RULE_ID': case 'TAX_RULE_ID':
$stmt->bindValue($identifier, $this->tax_rule_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->tax_rule_id, PDO::PARAM_INT);
break; break;
@@ -1002,8 +955,8 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
case 'TAX_ID': case 'TAX_ID':
$stmt->bindValue($identifier, $this->tax_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->tax_id, PDO::PARAM_INT);
break; break;
case 'NONE': case 'POSITION':
$stmt->bindValue($identifier, $this->none, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
break; break;
case 'CREATED_AT': case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
@@ -1067,24 +1020,21 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
{ {
switch ($pos) { switch ($pos) {
case 0: case 0:
return $this->getId();
break;
case 1:
return $this->getTaxRuleId(); return $this->getTaxRuleId();
break; break;
case 2: case 1:
return $this->getCountryId(); return $this->getCountryId();
break; break;
case 3: case 2:
return $this->getTaxId(); return $this->getTaxId();
break; break;
case 4: case 3:
return $this->getNone(); return $this->getPosition();
break; break;
case 5: case 4:
return $this->getCreatedAt(); return $this->getCreatedAt();
break; break;
case 6: case 5:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -1110,19 +1060,18 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
*/ */
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{ {
if (isset($alreadyDumpedObjects['TaxRuleCountry'][$this->getPrimaryKey()])) { if (isset($alreadyDumpedObjects['TaxRuleCountry'][serialize($this->getPrimaryKey())])) {
return '*RECURSION*'; return '*RECURSION*';
} }
$alreadyDumpedObjects['TaxRuleCountry'][$this->getPrimaryKey()] = true; $alreadyDumpedObjects['TaxRuleCountry'][serialize($this->getPrimaryKey())] = true;
$keys = TaxRuleCountryTableMap::getFieldNames($keyType); $keys = TaxRuleCountryTableMap::getFieldNames($keyType);
$result = array( $result = array(
$keys[0] => $this->getId(), $keys[0] => $this->getTaxRuleId(),
$keys[1] => $this->getTaxRuleId(), $keys[1] => $this->getCountryId(),
$keys[2] => $this->getCountryId(), $keys[2] => $this->getTaxId(),
$keys[3] => $this->getTaxId(), $keys[3] => $this->getPosition(),
$keys[4] => $this->getNone(), $keys[4] => $this->getCreatedAt(),
$keys[5] => $this->getCreatedAt(), $keys[5] => $this->getUpdatedAt(),
$keys[6] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1175,24 +1124,21 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
{ {
switch ($pos) { switch ($pos) {
case 0: case 0:
$this->setId($value);
break;
case 1:
$this->setTaxRuleId($value); $this->setTaxRuleId($value);
break; break;
case 2: case 1:
$this->setCountryId($value); $this->setCountryId($value);
break; break;
case 3: case 2:
$this->setTaxId($value); $this->setTaxId($value);
break; break;
case 4: case 3:
$this->setNone($value); $this->setPosition($value);
break; break;
case 5: case 4:
$this->setCreatedAt($value); $this->setCreatedAt($value);
break; break;
case 6: case 5:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1219,13 +1165,12 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
{ {
$keys = TaxRuleCountryTableMap::getFieldNames($keyType); $keys = TaxRuleCountryTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setTaxRuleId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setTaxRuleId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setCountryId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setCountryId($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setTaxId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setTaxId($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setNone($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
} }
/** /**
@@ -1237,11 +1182,10 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
{ {
$criteria = new Criteria(TaxRuleCountryTableMap::DATABASE_NAME); $criteria = new Criteria(TaxRuleCountryTableMap::DATABASE_NAME);
if ($this->isColumnModified(TaxRuleCountryTableMap::ID)) $criteria->add(TaxRuleCountryTableMap::ID, $this->id);
if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_RULE_ID)) $criteria->add(TaxRuleCountryTableMap::TAX_RULE_ID, $this->tax_rule_id); if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_RULE_ID)) $criteria->add(TaxRuleCountryTableMap::TAX_RULE_ID, $this->tax_rule_id);
if ($this->isColumnModified(TaxRuleCountryTableMap::COUNTRY_ID)) $criteria->add(TaxRuleCountryTableMap::COUNTRY_ID, $this->country_id); if ($this->isColumnModified(TaxRuleCountryTableMap::COUNTRY_ID)) $criteria->add(TaxRuleCountryTableMap::COUNTRY_ID, $this->country_id);
if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_ID)) $criteria->add(TaxRuleCountryTableMap::TAX_ID, $this->tax_id); if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_ID)) $criteria->add(TaxRuleCountryTableMap::TAX_ID, $this->tax_id);
if ($this->isColumnModified(TaxRuleCountryTableMap::NONE)) $criteria->add(TaxRuleCountryTableMap::NONE, $this->none); if ($this->isColumnModified(TaxRuleCountryTableMap::POSITION)) $criteria->add(TaxRuleCountryTableMap::POSITION, $this->position);
if ($this->isColumnModified(TaxRuleCountryTableMap::CREATED_AT)) $criteria->add(TaxRuleCountryTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(TaxRuleCountryTableMap::CREATED_AT)) $criteria->add(TaxRuleCountryTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(TaxRuleCountryTableMap::UPDATED_AT)) $criteria->add(TaxRuleCountryTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(TaxRuleCountryTableMap::UPDATED_AT)) $criteria->add(TaxRuleCountryTableMap::UPDATED_AT, $this->updated_at);
@@ -1259,29 +1203,39 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
public function buildPkeyCriteria() public function buildPkeyCriteria()
{ {
$criteria = new Criteria(TaxRuleCountryTableMap::DATABASE_NAME); $criteria = new Criteria(TaxRuleCountryTableMap::DATABASE_NAME);
$criteria->add(TaxRuleCountryTableMap::ID, $this->id); $criteria->add(TaxRuleCountryTableMap::TAX_RULE_ID, $this->tax_rule_id);
$criteria->add(TaxRuleCountryTableMap::COUNTRY_ID, $this->country_id);
$criteria->add(TaxRuleCountryTableMap::TAX_ID, $this->tax_id);
return $criteria; return $criteria;
} }
/** /**
* Returns the primary key for this object (row). * Returns the composite primary key for this object.
* @return int * The array elements will be in same order as specified in XML.
* @return array
*/ */
public function getPrimaryKey() public function getPrimaryKey()
{ {
return $this->getId(); $pks = array();
$pks[0] = $this->getTaxRuleId();
$pks[1] = $this->getCountryId();
$pks[2] = $this->getTaxId();
return $pks;
} }
/** /**
* Generic method to set the primary key (id column). * Set the [composite] primary key.
* *
* @param int $key Primary key. * @param array $keys The elements of the composite key (order must match the order in XML file).
* @return void * @return void
*/ */
public function setPrimaryKey($key) public function setPrimaryKey($keys)
{ {
$this->setId($key); $this->setTaxRuleId($keys[0]);
$this->setCountryId($keys[1]);
$this->setTaxId($keys[2]);
} }
/** /**
@@ -1291,7 +1245,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
public function isPrimaryKeyNull() public function isPrimaryKeyNull()
{ {
return null === $this->getId(); return (null === $this->getTaxRuleId()) && (null === $this->getCountryId()) && (null === $this->getTaxId());
} }
/** /**
@@ -1307,11 +1261,10 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
*/ */
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{ {
$copyObj->setId($this->getId());
$copyObj->setTaxRuleId($this->getTaxRuleId()); $copyObj->setTaxRuleId($this->getTaxRuleId());
$copyObj->setCountryId($this->getCountryId()); $copyObj->setCountryId($this->getCountryId());
$copyObj->setTaxId($this->getTaxId()); $copyObj->setTaxId($this->getTaxId());
$copyObj->setNone($this->getNone()); $copyObj->setPosition($this->getPosition());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1499,11 +1452,10 @@ abstract class TaxRuleCountry implements ActiveRecordInterface
*/ */
public function clear() public function clear()
{ {
$this->id = null;
$this->tax_rule_id = null; $this->tax_rule_id = null;
$this->country_id = null; $this->country_id = null;
$this->tax_id = null; $this->tax_id = null;
$this->none = null; $this->position = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;

View File

@@ -21,19 +21,17 @@ use Thelia\Model\Map\TaxRuleCountryTableMap;
* *
* *
* *
* @method ChildTaxRuleCountryQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildTaxRuleCountryQuery orderByTaxRuleId($order = Criteria::ASC) Order by the tax_rule_id column * @method ChildTaxRuleCountryQuery orderByTaxRuleId($order = Criteria::ASC) Order by the tax_rule_id column
* @method ChildTaxRuleCountryQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column * @method ChildTaxRuleCountryQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
* @method ChildTaxRuleCountryQuery orderByTaxId($order = Criteria::ASC) Order by the tax_id column * @method ChildTaxRuleCountryQuery orderByTaxId($order = Criteria::ASC) Order by the tax_id column
* @method ChildTaxRuleCountryQuery orderByNone($order = Criteria::ASC) Order by the none column * @method ChildTaxRuleCountryQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildTaxRuleCountryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildTaxRuleCountryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildTaxRuleCountryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildTaxRuleCountryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildTaxRuleCountryQuery groupById() Group by the id column
* @method ChildTaxRuleCountryQuery groupByTaxRuleId() Group by the tax_rule_id column * @method ChildTaxRuleCountryQuery groupByTaxRuleId() Group by the tax_rule_id column
* @method ChildTaxRuleCountryQuery groupByCountryId() Group by the country_id column * @method ChildTaxRuleCountryQuery groupByCountryId() Group by the country_id column
* @method ChildTaxRuleCountryQuery groupByTaxId() Group by the tax_id column * @method ChildTaxRuleCountryQuery groupByTaxId() Group by the tax_id column
* @method ChildTaxRuleCountryQuery groupByNone() Group by the none column * @method ChildTaxRuleCountryQuery groupByPosition() Group by the position column
* @method ChildTaxRuleCountryQuery groupByCreatedAt() Group by the created_at column * @method ChildTaxRuleCountryQuery groupByCreatedAt() Group by the created_at column
* @method ChildTaxRuleCountryQuery groupByUpdatedAt() Group by the updated_at column * @method ChildTaxRuleCountryQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -56,19 +54,17 @@ use Thelia\Model\Map\TaxRuleCountryTableMap;
* @method ChildTaxRuleCountry findOne(ConnectionInterface $con = null) Return the first ChildTaxRuleCountry matching the query * @method ChildTaxRuleCountry findOne(ConnectionInterface $con = null) Return the first ChildTaxRuleCountry matching the query
* @method ChildTaxRuleCountry findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTaxRuleCountry matching the query, or a new ChildTaxRuleCountry object populated from the query conditions when no match is found * @method ChildTaxRuleCountry findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTaxRuleCountry matching the query, or a new ChildTaxRuleCountry object populated from the query conditions when no match is found
* *
* @method ChildTaxRuleCountry findOneById(int $id) Return the first ChildTaxRuleCountry filtered by the id column
* @method ChildTaxRuleCountry findOneByTaxRuleId(int $tax_rule_id) Return the first ChildTaxRuleCountry filtered by the tax_rule_id column * @method ChildTaxRuleCountry findOneByTaxRuleId(int $tax_rule_id) Return the first ChildTaxRuleCountry filtered by the tax_rule_id column
* @method ChildTaxRuleCountry findOneByCountryId(int $country_id) Return the first ChildTaxRuleCountry filtered by the country_id column * @method ChildTaxRuleCountry findOneByCountryId(int $country_id) Return the first ChildTaxRuleCountry filtered by the country_id column
* @method ChildTaxRuleCountry findOneByTaxId(int $tax_id) Return the first ChildTaxRuleCountry filtered by the tax_id column * @method ChildTaxRuleCountry findOneByTaxId(int $tax_id) Return the first ChildTaxRuleCountry filtered by the tax_id column
* @method ChildTaxRuleCountry findOneByNone(int $none) Return the first ChildTaxRuleCountry filtered by the none column * @method ChildTaxRuleCountry findOneByPosition(int $position) Return the first ChildTaxRuleCountry filtered by the position column
* @method ChildTaxRuleCountry findOneByCreatedAt(string $created_at) Return the first ChildTaxRuleCountry filtered by the created_at column * @method ChildTaxRuleCountry findOneByCreatedAt(string $created_at) Return the first ChildTaxRuleCountry filtered by the created_at column
* @method ChildTaxRuleCountry findOneByUpdatedAt(string $updated_at) Return the first ChildTaxRuleCountry filtered by the updated_at column * @method ChildTaxRuleCountry findOneByUpdatedAt(string $updated_at) Return the first ChildTaxRuleCountry filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildTaxRuleCountry objects filtered by the id column
* @method array findByTaxRuleId(int $tax_rule_id) Return ChildTaxRuleCountry objects filtered by the tax_rule_id column * @method array findByTaxRuleId(int $tax_rule_id) Return ChildTaxRuleCountry objects filtered by the tax_rule_id column
* @method array findByCountryId(int $country_id) Return ChildTaxRuleCountry objects filtered by the country_id column * @method array findByCountryId(int $country_id) Return ChildTaxRuleCountry objects filtered by the country_id column
* @method array findByTaxId(int $tax_id) Return ChildTaxRuleCountry objects filtered by the tax_id column * @method array findByTaxId(int $tax_id) Return ChildTaxRuleCountry objects filtered by the tax_id column
* @method array findByNone(int $none) Return ChildTaxRuleCountry objects filtered by the none column * @method array findByPosition(int $position) Return ChildTaxRuleCountry objects filtered by the position column
* @method array findByCreatedAt(string $created_at) Return ChildTaxRuleCountry objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildTaxRuleCountry objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildTaxRuleCountry objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildTaxRuleCountry objects filtered by the updated_at column
* *
@@ -118,10 +114,10 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
* Go fast if the query is untouched. * Go fast if the query is untouched.
* *
* <code> * <code>
* $obj = $c->findPk(12, $con); * $obj = $c->findPk(array(12, 34, 56), $con);
* </code> * </code>
* *
* @param mixed $key Primary key to use for the query * @param array[$tax_rule_id, $country_id, $tax_id] $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object * @param ConnectionInterface $con an optional connection object
* *
* @return ChildTaxRuleCountry|array|mixed the result, formatted by the current formatter * @return ChildTaxRuleCountry|array|mixed the result, formatted by the current formatter
@@ -131,7 +127,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
if ($key === null) { if ($key === null) {
return null; return null;
} }
if ((null !== ($obj = TaxRuleCountryTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { if ((null !== ($obj = TaxRuleCountryTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))))) && !$this->formatter) {
// the object is already in the instance pool // the object is already in the instance pool
return $obj; return $obj;
} }
@@ -159,10 +155,12 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, TAX_RULE_ID, COUNTRY_ID, TAX_ID, NONE, CREATED_AT, UPDATED_AT FROM tax_rule_country WHERE ID = :p0'; $sql = 'SELECT TAX_RULE_ID, COUNTRY_ID, TAX_ID, POSITION, CREATED_AT, UPDATED_AT FROM tax_rule_country WHERE TAX_RULE_ID = :p0 AND COUNTRY_ID = :p1 AND TAX_ID = :p2';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
$stmt->bindValue(':p2', $key[2], PDO::PARAM_INT);
$stmt->execute(); $stmt->execute();
} catch (Exception $e) { } catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR); Propel::log($e->getMessage(), Propel::LOG_ERR);
@@ -172,7 +170,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildTaxRuleCountry(); $obj = new ChildTaxRuleCountry();
$obj->hydrate($row); $obj->hydrate($row);
TaxRuleCountryTableMap::addInstanceToPool($obj, (string) $key); TaxRuleCountryTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1], (string) $key[2])));
} }
$stmt->closeCursor(); $stmt->closeCursor();
@@ -201,7 +199,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
/** /**
* Find objects by primary key * Find objects by primary key
* <code> * <code>
* $objs = $c->findPks(array(12, 56, 832), $con); * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
* </code> * </code>
* @param array $keys Primary keys to use for the query * @param array $keys Primary keys to use for the query
* @param ConnectionInterface $con an optional connection object * @param ConnectionInterface $con an optional connection object
@@ -231,8 +229,11 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
*/ */
public function filterByPrimaryKey($key) public function filterByPrimaryKey($key)
{ {
$this->addUsingAlias(TaxRuleCountryTableMap::TAX_RULE_ID, $key[0], Criteria::EQUAL);
$this->addUsingAlias(TaxRuleCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL);
$this->addUsingAlias(TaxRuleCountryTableMap::TAX_ID, $key[2], Criteria::EQUAL);
return $this->addUsingAlias(TaxRuleCountryTableMap::ID, $key, Criteria::EQUAL); return $this;
} }
/** /**
@@ -244,49 +245,19 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
*/ */
public function filterByPrimaryKeys($keys) public function filterByPrimaryKeys($keys)
{ {
if (empty($keys)) {
return $this->addUsingAlias(TaxRuleCountryTableMap::ID, $keys, Criteria::IN); return $this->add(null, '1<>1', Criteria::CUSTOM);
} }
foreach ($keys as $key) {
/** $cton0 = $this->getNewCriterion(TaxRuleCountryTableMap::TAX_RULE_ID, $key[0], Criteria::EQUAL);
* Filter the query on the id column $cton1 = $this->getNewCriterion(TaxRuleCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL);
* $cton0->addAnd($cton1);
* Example usage: $cton2 = $this->getNewCriterion(TaxRuleCountryTableMap::TAX_ID, $key[2], Criteria::EQUAL);
* <code> $cton0->addAnd($cton2);
* $query->filterById(1234); // WHERE id = 1234 $this->addOr($cton0);
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTaxRuleCountryQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(TaxRuleCountryTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(TaxRuleCountryTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
} }
return $this->addUsingAlias(TaxRuleCountryTableMap::ID, $id, $comparison); return $this;
} }
/** /**
@@ -419,16 +390,16 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
} }
/** /**
* Filter the query on the none column * Filter the query on the position column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByNone(1234); // WHERE none = 1234 * $query->filterByPosition(1234); // WHERE position = 1234
* $query->filterByNone(array(12, 34)); // WHERE none IN (12, 34) * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByNone(array('min' => 12)); // WHERE none > 12 * $query->filterByPosition(array('min' => 12)); // WHERE position > 12
* </code> * </code>
* *
* @param mixed $none The value to use as filter. * @param mixed $position The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -436,16 +407,16 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
* *
* @return ChildTaxRuleCountryQuery The current query, for fluid interface * @return ChildTaxRuleCountryQuery The current query, for fluid interface
*/ */
public function filterByNone($none = null, $comparison = null) public function filterByPosition($position = null, $comparison = null)
{ {
if (is_array($none)) { if (is_array($position)) {
$useMinMax = false; $useMinMax = false;
if (isset($none['min'])) { if (isset($position['min'])) {
$this->addUsingAlias(TaxRuleCountryTableMap::NONE, $none['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(TaxRuleCountryTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($none['max'])) { if (isset($position['max'])) {
$this->addUsingAlias(TaxRuleCountryTableMap::NONE, $none['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(TaxRuleCountryTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -456,7 +427,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(TaxRuleCountryTableMap::NONE, $none, $comparison); return $this->addUsingAlias(TaxRuleCountryTableMap::POSITION, $position, $comparison);
} }
/** /**
@@ -578,7 +549,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
* *
* @return ChildTaxRuleCountryQuery The current query, for fluid interface * @return ChildTaxRuleCountryQuery The current query, for fluid interface
*/ */
public function joinTax($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinTax($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Tax'); $relationMap = $tableMap->getRelation('Tax');
@@ -613,7 +584,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
* *
* @return \Thelia\Model\TaxQuery A secondary query class using the current class as primary query * @return \Thelia\Model\TaxQuery A secondary query class using the current class as primary query
*/ */
public function useTaxQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useTaxQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinTax($relationAlias, $joinType) ->joinTax($relationAlias, $joinType)
@@ -653,7 +624,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
* *
* @return ChildTaxRuleCountryQuery The current query, for fluid interface * @return ChildTaxRuleCountryQuery The current query, for fluid interface
*/ */
public function joinTaxRule($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinTaxRule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('TaxRule'); $relationMap = $tableMap->getRelation('TaxRule');
@@ -688,7 +659,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
* *
* @return \Thelia\Model\TaxRuleQuery A secondary query class using the current class as primary query * @return \Thelia\Model\TaxRuleQuery A secondary query class using the current class as primary query
*/ */
public function useTaxRuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useTaxRuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinTaxRule($relationAlias, $joinType) ->joinTaxRule($relationAlias, $joinType)
@@ -728,7 +699,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
* *
* @return ChildTaxRuleCountryQuery The current query, for fluid interface * @return ChildTaxRuleCountryQuery The current query, for fluid interface
*/ */
public function joinCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Country'); $relationMap = $tableMap->getRelation('Country');
@@ -763,7 +734,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
* *
* @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query * @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query
*/ */
public function useCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinCountry($relationAlias, $joinType) ->joinCountry($relationAlias, $joinType)
@@ -780,7 +751,10 @@ abstract class TaxRuleCountryQuery extends ModelCriteria
public function prune($taxRuleCountry = null) public function prune($taxRuleCountry = null)
{ {
if ($taxRuleCountry) { if ($taxRuleCountry) {
$this->addUsingAlias(TaxRuleCountryTableMap::ID, $taxRuleCountry->getId(), Criteria::NOT_EQUAL); $this->addCond('pruneCond0', $this->getAliasedColName(TaxRuleCountryTableMap::TAX_RULE_ID), $taxRuleCountry->getTaxRuleId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond1', $this->getAliasedColName(TaxRuleCountryTableMap::COUNTRY_ID), $taxRuleCountry->getCountryId(), Criteria::NOT_EQUAL);
$this->addCond('pruneCond2', $this->getAliasedColName(TaxRuleCountryTableMap::TAX_ID), $taxRuleCountry->getTaxId(), Criteria::NOT_EQUAL);
$this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2'), Criteria::LOGICAL_OR);
} }
return $this; return $this;

View File

@@ -66,6 +66,18 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
*/ */
protected $locale; protected $locale;
/**
* The value for the title field.
* @var string
*/
protected $title;
/**
* The value for the description field.
* @var string
*/
protected $description;
/** /**
* @var TaxRule * @var TaxRule
*/ */
@@ -368,6 +380,28 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
return $this->locale; return $this->locale;
} }
/**
* Get the [title] column value.
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get the [description] column value.
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
@@ -414,6 +448,48 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
return $this; return $this;
} // setLocale() } // setLocale()
/**
* Set the value of [title] column.
*
* @param string $v new value
* @return \Thelia\Model\TaxRuleI18n The current object (for fluent API support)
*/
public function setTitle($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->title !== $v) {
$this->title = $v;
$this->modifiedColumns[] = TaxRuleI18nTableMap::TITLE;
}
return $this;
} // setTitle()
/**
* Set the value of [description] column.
*
* @param string $v new value
* @return \Thelia\Model\TaxRuleI18n The current object (for fluent API support)
*/
public function setDescription($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->description !== $v) {
$this->description = $v;
$this->modifiedColumns[] = TaxRuleI18nTableMap::DESCRIPTION;
}
return $this;
} // setDescription()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@@ -460,6 +536,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
$this->locale = (null !== $col) ? (string) $col : null; $this->locale = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
$this->title = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
$this->description = (null !== $col) ? (string) $col : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@@ -468,7 +550,7 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 2; // 2 = TaxRuleI18nTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 4; // 4 = TaxRuleI18nTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\TaxRuleI18n object", 0, $e); throw new PropelException("Error populating \Thelia\Model\TaxRuleI18n object", 0, $e);
@@ -695,6 +777,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
if ($this->isColumnModified(TaxRuleI18nTableMap::LOCALE)) { if ($this->isColumnModified(TaxRuleI18nTableMap::LOCALE)) {
$modifiedColumns[':p' . $index++] = 'LOCALE'; $modifiedColumns[':p' . $index++] = 'LOCALE';
} }
if ($this->isColumnModified(TaxRuleI18nTableMap::TITLE)) {
$modifiedColumns[':p' . $index++] = 'TITLE';
}
if ($this->isColumnModified(TaxRuleI18nTableMap::DESCRIPTION)) {
$modifiedColumns[':p' . $index++] = 'DESCRIPTION';
}
$sql = sprintf( $sql = sprintf(
'INSERT INTO tax_rule_i18n (%s) VALUES (%s)', 'INSERT INTO tax_rule_i18n (%s) VALUES (%s)',
@@ -712,6 +800,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
case 'LOCALE': case 'LOCALE':
$stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
break; break;
case 'TITLE':
$stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
break;
case 'DESCRIPTION':
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
break;
} }
} }
$stmt->execute(); $stmt->execute();
@@ -773,6 +867,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
case 1: case 1:
return $this->getLocale(); return $this->getLocale();
break; break;
case 2:
return $this->getTitle();
break;
case 3:
return $this->getDescription();
break;
default: default:
return null; return null;
break; break;
@@ -804,6 +904,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
$result = array( $result = array(
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getLocale(), $keys[1] => $this->getLocale(),
$keys[2] => $this->getTitle(),
$keys[3] => $this->getDescription(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -855,6 +957,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
case 1: case 1:
$this->setLocale($value); $this->setLocale($value);
break; break;
case 2:
$this->setTitle($value);
break;
case 3:
$this->setDescription($value);
break;
} // switch() } // switch()
} }
@@ -881,6 +989,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
} }
/** /**
@@ -894,6 +1004,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
if ($this->isColumnModified(TaxRuleI18nTableMap::ID)) $criteria->add(TaxRuleI18nTableMap::ID, $this->id); if ($this->isColumnModified(TaxRuleI18nTableMap::ID)) $criteria->add(TaxRuleI18nTableMap::ID, $this->id);
if ($this->isColumnModified(TaxRuleI18nTableMap::LOCALE)) $criteria->add(TaxRuleI18nTableMap::LOCALE, $this->locale); if ($this->isColumnModified(TaxRuleI18nTableMap::LOCALE)) $criteria->add(TaxRuleI18nTableMap::LOCALE, $this->locale);
if ($this->isColumnModified(TaxRuleI18nTableMap::TITLE)) $criteria->add(TaxRuleI18nTableMap::TITLE, $this->title);
if ($this->isColumnModified(TaxRuleI18nTableMap::DESCRIPTION)) $criteria->add(TaxRuleI18nTableMap::DESCRIPTION, $this->description);
return $criteria; return $criteria;
} }
@@ -966,6 +1078,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
{ {
$copyObj->setId($this->getId()); $copyObj->setId($this->getId());
$copyObj->setLocale($this->getLocale()); $copyObj->setLocale($this->getLocale());
$copyObj->setTitle($this->getTitle());
$copyObj->setDescription($this->getDescription());
if ($makeNew) { if ($makeNew) {
$copyObj->setNew(true); $copyObj->setNew(true);
} }
@@ -1051,6 +1165,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface
{ {
$this->id = null; $this->id = null;
$this->locale = null; $this->locale = null;
$this->title = null;
$this->description = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->clearAllReferences(); $this->clearAllReferences();
$this->applyDefaultValues(); $this->applyDefaultValues();

View File

@@ -23,9 +23,13 @@ use Thelia\Model\Map\TaxRuleI18nTableMap;
* *
* @method ChildTaxRuleI18nQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildTaxRuleI18nQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildTaxRuleI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column * @method ChildTaxRuleI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildTaxRuleI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildTaxRuleI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* *
* @method ChildTaxRuleI18nQuery groupById() Group by the id column * @method ChildTaxRuleI18nQuery groupById() Group by the id column
* @method ChildTaxRuleI18nQuery groupByLocale() Group by the locale column * @method ChildTaxRuleI18nQuery groupByLocale() Group by the locale column
* @method ChildTaxRuleI18nQuery groupByTitle() Group by the title column
* @method ChildTaxRuleI18nQuery groupByDescription() Group by the description column
* *
* @method ChildTaxRuleI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildTaxRuleI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildTaxRuleI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildTaxRuleI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -40,9 +44,13 @@ use Thelia\Model\Map\TaxRuleI18nTableMap;
* *
* @method ChildTaxRuleI18n findOneById(int $id) Return the first ChildTaxRuleI18n filtered by the id column * @method ChildTaxRuleI18n findOneById(int $id) Return the first ChildTaxRuleI18n filtered by the id column
* @method ChildTaxRuleI18n findOneByLocale(string $locale) Return the first ChildTaxRuleI18n filtered by the locale column * @method ChildTaxRuleI18n findOneByLocale(string $locale) Return the first ChildTaxRuleI18n filtered by the locale column
* @method ChildTaxRuleI18n findOneByTitle(string $title) Return the first ChildTaxRuleI18n filtered by the title column
* @method ChildTaxRuleI18n findOneByDescription(string $description) Return the first ChildTaxRuleI18n filtered by the description column
* *
* @method array findById(int $id) Return ChildTaxRuleI18n objects filtered by the id column * @method array findById(int $id) Return ChildTaxRuleI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildTaxRuleI18n objects filtered by the locale column * @method array findByLocale(string $locale) Return ChildTaxRuleI18n objects filtered by the locale column
* @method array findByTitle(string $title) Return ChildTaxRuleI18n objects filtered by the title column
* @method array findByDescription(string $description) Return ChildTaxRuleI18n objects filtered by the description column
* *
*/ */
abstract class TaxRuleI18nQuery extends ModelCriteria abstract class TaxRuleI18nQuery extends ModelCriteria
@@ -131,7 +139,7 @@ abstract class TaxRuleI18nQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, LOCALE FROM tax_rule_i18n WHERE ID = :p0 AND LOCALE = :p1'; $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION FROM tax_rule_i18n WHERE ID = :p0 AND LOCALE = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -304,6 +312,64 @@ abstract class TaxRuleI18nQuery extends ModelCriteria
return $this->addUsingAlias(TaxRuleI18nTableMap::LOCALE, $locale, $comparison); return $this->addUsingAlias(TaxRuleI18nTableMap::LOCALE, $locale, $comparison);
} }
/**
* Filter the query on the title column
*
* Example usage:
* <code>
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* </code>
*
* @param string $title The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTaxRuleI18nQuery The current query, for fluid interface
*/
public function filterByTitle($title = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($title)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $title)) {
$title = str_replace('*', '%', $title);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(TaxRuleI18nTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $description The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTaxRuleI18nQuery The current query, for fluid interface
*/
public function filterByDescription($description = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($description)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $description)) {
$description = str_replace('*', '%', $description);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(TaxRuleI18nTableMap::DESCRIPTION, $description, $comparison);
}
/** /**
* Filter the query by a related \Thelia\Model\TaxRule object * Filter the query by a related \Thelia\Model\TaxRule object
* *

View File

@@ -23,16 +23,10 @@ use Thelia\Model\Map\TaxRuleTableMap;
* *
* *
* @method ChildTaxRuleQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildTaxRuleQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildTaxRuleQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method ChildTaxRuleQuery orderByTitle($order = Criteria::ASC) Order by the title column
* @method ChildTaxRuleQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildTaxRuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildTaxRuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildTaxRuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildTaxRuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildTaxRuleQuery groupById() Group by the id column * @method ChildTaxRuleQuery groupById() Group by the id column
* @method ChildTaxRuleQuery groupByCode() Group by the code column
* @method ChildTaxRuleQuery groupByTitle() Group by the title column
* @method ChildTaxRuleQuery groupByDescription() Group by the description column
* @method ChildTaxRuleQuery groupByCreatedAt() Group by the created_at column * @method ChildTaxRuleQuery groupByCreatedAt() Group by the created_at column
* @method ChildTaxRuleQuery groupByUpdatedAt() Group by the updated_at column * @method ChildTaxRuleQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -56,16 +50,10 @@ use Thelia\Model\Map\TaxRuleTableMap;
* @method ChildTaxRule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTaxRule matching the query, or a new ChildTaxRule object populated from the query conditions when no match is found * @method ChildTaxRule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTaxRule matching the query, or a new ChildTaxRule object populated from the query conditions when no match is found
* *
* @method ChildTaxRule findOneById(int $id) Return the first ChildTaxRule filtered by the id column * @method ChildTaxRule findOneById(int $id) Return the first ChildTaxRule filtered by the id column
* @method ChildTaxRule findOneByCode(string $code) Return the first ChildTaxRule filtered by the code column
* @method ChildTaxRule findOneByTitle(string $title) Return the first ChildTaxRule filtered by the title column
* @method ChildTaxRule findOneByDescription(string $description) Return the first ChildTaxRule filtered by the description column
* @method ChildTaxRule findOneByCreatedAt(string $created_at) Return the first ChildTaxRule filtered by the created_at column * @method ChildTaxRule findOneByCreatedAt(string $created_at) Return the first ChildTaxRule filtered by the created_at column
* @method ChildTaxRule findOneByUpdatedAt(string $updated_at) Return the first ChildTaxRule filtered by the updated_at column * @method ChildTaxRule findOneByUpdatedAt(string $updated_at) Return the first ChildTaxRule filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildTaxRule objects filtered by the id column * @method array findById(int $id) Return ChildTaxRule objects filtered by the id column
* @method array findByCode(string $code) Return ChildTaxRule objects filtered by the code column
* @method array findByTitle(string $title) Return ChildTaxRule objects filtered by the title column
* @method array findByDescription(string $description) Return ChildTaxRule objects filtered by the description column
* @method array findByCreatedAt(string $created_at) Return ChildTaxRule objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildTaxRule objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildTaxRule objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildTaxRule objects filtered by the updated_at column
* *
@@ -156,7 +144,7 @@ abstract class TaxRuleQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, CODE, TITLE, DESCRIPTION, CREATED_AT, UPDATED_AT FROM tax_rule WHERE ID = :p0'; $sql = 'SELECT ID, CREATED_AT, UPDATED_AT FROM tax_rule WHERE ID = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -286,93 +274,6 @@ abstract class TaxRuleQuery extends ModelCriteria
return $this->addUsingAlias(TaxRuleTableMap::ID, $id, $comparison); return $this->addUsingAlias(TaxRuleTableMap::ID, $id, $comparison);
} }
/**
* Filter the query on the code column
*
* Example usage:
* <code>
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
* </code>
*
* @param string $code The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTaxRuleQuery The current query, for fluid interface
*/
public function filterByCode($code = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($code)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $code)) {
$code = str_replace('*', '%', $code);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(TaxRuleTableMap::CODE, $code, $comparison);
}
/**
* Filter the query on the title column
*
* Example usage:
* <code>
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
* </code>
*
* @param string $title The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTaxRuleQuery The current query, for fluid interface
*/
public function filterByTitle($title = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($title)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $title)) {
$title = str_replace('*', '%', $title);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(TaxRuleTableMap::TITLE, $title, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $description The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildTaxRuleQuery The current query, for fluid interface
*/
public function filterByDescription($description = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($description)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $description)) {
$description = str_replace('*', '%', $description);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(TaxRuleTableMap::DESCRIPTION, $description, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *
@@ -563,7 +464,7 @@ abstract class TaxRuleQuery extends ModelCriteria
* *
* @return ChildTaxRuleQuery The current query, for fluid interface * @return ChildTaxRuleQuery The current query, for fluid interface
*/ */
public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('TaxRuleCountry'); $relationMap = $tableMap->getRelation('TaxRuleCountry');
@@ -598,7 +499,7 @@ abstract class TaxRuleQuery extends ModelCriteria
* *
* @return \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query * @return \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query
*/ */
public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinTaxRuleCountry($relationAlias, $joinType) ->joinTaxRuleCountry($relationAlias, $joinType)

View File

@@ -57,7 +57,7 @@ class TaxRuleCountryTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 7; const NUM_COLUMNS = 6;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,12 +67,7 @@ class TaxRuleCountryTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 7; const NUM_HYDRATE_COLUMNS = 6;
/**
* the column name for the ID field
*/
const ID = 'tax_rule_country.ID';
/** /**
* the column name for the TAX_RULE_ID field * the column name for the TAX_RULE_ID field
@@ -90,9 +85,9 @@ class TaxRuleCountryTableMap extends TableMap
const TAX_ID = 'tax_rule_country.TAX_ID'; const TAX_ID = 'tax_rule_country.TAX_ID';
/** /**
* the column name for the NONE field * the column name for the POSITION field
*/ */
const NONE = 'tax_rule_country.NONE'; const POSITION = 'tax_rule_country.POSITION';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
@@ -116,12 +111,12 @@ class TaxRuleCountryTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'CountryId', 'TaxId', 'None', 'CreatedAt', 'UpdatedAt', ), self::TYPE_PHPNAME => array('TaxRuleId', 'CountryId', 'TaxId', 'Position', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'countryId', 'taxId', 'none', 'createdAt', 'updatedAt', ), self::TYPE_STUDLYPHPNAME => array('taxRuleId', 'countryId', 'taxId', 'position', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(TaxRuleCountryTableMap::ID, TaxRuleCountryTableMap::TAX_RULE_ID, TaxRuleCountryTableMap::COUNTRY_ID, TaxRuleCountryTableMap::TAX_ID, TaxRuleCountryTableMap::NONE, TaxRuleCountryTableMap::CREATED_AT, TaxRuleCountryTableMap::UPDATED_AT, ), self::TYPE_COLNAME => array(TaxRuleCountryTableMap::TAX_RULE_ID, TaxRuleCountryTableMap::COUNTRY_ID, TaxRuleCountryTableMap::TAX_ID, TaxRuleCountryTableMap::POSITION, TaxRuleCountryTableMap::CREATED_AT, TaxRuleCountryTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'COUNTRY_ID', 'TAX_ID', 'NONE', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_RAW_COLNAME => array('TAX_RULE_ID', 'COUNTRY_ID', 'TAX_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'country_id', 'tax_id', 'none', 'created_at', 'updated_at', ), self::TYPE_FIELDNAME => array('tax_rule_id', 'country_id', 'tax_id', 'position', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
); );
/** /**
@@ -131,12 +126,12 @@ class TaxRuleCountryTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'CountryId' => 2, 'TaxId' => 3, 'None' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), self::TYPE_PHPNAME => array('TaxRuleId' => 0, 'CountryId' => 1, 'TaxId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'countryId' => 2, 'taxId' => 3, 'none' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), self::TYPE_STUDLYPHPNAME => array('taxRuleId' => 0, 'countryId' => 1, 'taxId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
self::TYPE_COLNAME => array(TaxRuleCountryTableMap::ID => 0, TaxRuleCountryTableMap::TAX_RULE_ID => 1, TaxRuleCountryTableMap::COUNTRY_ID => 2, TaxRuleCountryTableMap::TAX_ID => 3, TaxRuleCountryTableMap::NONE => 4, TaxRuleCountryTableMap::CREATED_AT => 5, TaxRuleCountryTableMap::UPDATED_AT => 6, ), self::TYPE_COLNAME => array(TaxRuleCountryTableMap::TAX_RULE_ID => 0, TaxRuleCountryTableMap::COUNTRY_ID => 1, TaxRuleCountryTableMap::TAX_ID => 2, TaxRuleCountryTableMap::POSITION => 3, TaxRuleCountryTableMap::CREATED_AT => 4, TaxRuleCountryTableMap::UPDATED_AT => 5, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'COUNTRY_ID' => 2, 'TAX_ID' => 3, 'NONE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), self::TYPE_RAW_COLNAME => array('TAX_RULE_ID' => 0, 'COUNTRY_ID' => 1, 'TAX_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'country_id' => 2, 'tax_id' => 3, 'none' => 4, 'created_at' => 5, 'updated_at' => 6, ), self::TYPE_FIELDNAME => array('tax_rule_id' => 0, 'country_id' => 1, 'tax_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
); );
/** /**
@@ -155,11 +150,10 @@ class TaxRuleCountryTableMap extends TableMap
$this->setPackage('Thelia.Model'); $this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false); $this->setUseIdGenerator(false);
// columns // columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addForeignPrimaryKey('TAX_RULE_ID', 'TaxRuleId', 'INTEGER' , 'tax_rule', 'ID', true, null, null);
$this->addForeignKey('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', 'tax_rule', 'ID', false, null, null); $this->addForeignPrimaryKey('COUNTRY_ID', 'CountryId', 'INTEGER' , 'country', 'ID', true, null, null);
$this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', false, null, null); $this->addForeignPrimaryKey('TAX_ID', 'TaxId', 'INTEGER' , 'tax', 'ID', true, null, null);
$this->addForeignKey('TAX_ID', 'TaxId', 'INTEGER', 'tax', 'ID', false, null, null); $this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
$this->addColumn('NONE', 'None', 'TINYINT', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize() } // initialize()
@@ -169,7 +163,7 @@ class TaxRuleCountryTableMap extends TableMap
*/ */
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('Tax', '\\Thelia\\Model\\Tax', RelationMap::MANY_TO_ONE, array('tax_id' => 'id', ), 'SET NULL', 'RESTRICT'); $this->addRelation('Tax', '\\Thelia\\Model\\Tax', RelationMap::MANY_TO_ONE, array('tax_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'CASCADE', 'RESTRICT'); $this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'CASCADE', 'RESTRICT'); $this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations() } // buildRelations()
@@ -187,6 +181,59 @@ class TaxRuleCountryTableMap extends TableMap
); );
} // getBehaviors() } // getBehaviors()
/**
* 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\TaxRuleCountry $obj A \Thelia\Model\TaxRuleCountry 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->getTaxRuleId(), (string) $obj->getCountryId(), (string) $obj->getTaxId()));
} // 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\TaxRuleCountry object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && null !== $value) {
if (is_object($value) && $value instanceof \Thelia\Model\TaxRuleCountry) {
$key = serialize(array((string) $value->getTaxRuleId(), (string) $value->getCountryId(), (string) $value->getTaxId()));
} elseif (is_array($value) && count($value) === 3) {
// assume we've been passed a primary key";
$key = serialize(array((string) $value[0], (string) $value[1], (string) $value[2]));
} elseif ($value instanceof Criteria) {
self::$instances = [];
return;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\TaxRuleCountry 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. * 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.
* *
@@ -201,11 +248,11 @@ class TaxRuleCountryTableMap extends TableMap
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = 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 the PK cannot be derived from the row, return NULL.
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('TaxRuleId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('TaxId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null; return null;
} }
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('TaxRuleId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('TaxId', TableMap::TYPE_PHPNAME, $indexType)]));
} }
/** /**
@@ -223,11 +270,7 @@ class TaxRuleCountryTableMap extends TableMap
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{ {
return (int) $row[ return $pks;
$indexType == TableMap::TYPE_NUM
? 0 + $offset
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
];
} }
/** /**
@@ -325,19 +368,17 @@ class TaxRuleCountryTableMap extends TableMap
public static function addSelectColumns(Criteria $criteria, $alias = null) public static function addSelectColumns(Criteria $criteria, $alias = null)
{ {
if (null === $alias) { if (null === $alias) {
$criteria->addSelectColumn(TaxRuleCountryTableMap::ID);
$criteria->addSelectColumn(TaxRuleCountryTableMap::TAX_RULE_ID); $criteria->addSelectColumn(TaxRuleCountryTableMap::TAX_RULE_ID);
$criteria->addSelectColumn(TaxRuleCountryTableMap::COUNTRY_ID); $criteria->addSelectColumn(TaxRuleCountryTableMap::COUNTRY_ID);
$criteria->addSelectColumn(TaxRuleCountryTableMap::TAX_ID); $criteria->addSelectColumn(TaxRuleCountryTableMap::TAX_ID);
$criteria->addSelectColumn(TaxRuleCountryTableMap::NONE); $criteria->addSelectColumn(TaxRuleCountryTableMap::POSITION);
$criteria->addSelectColumn(TaxRuleCountryTableMap::CREATED_AT); $criteria->addSelectColumn(TaxRuleCountryTableMap::CREATED_AT);
$criteria->addSelectColumn(TaxRuleCountryTableMap::UPDATED_AT); $criteria->addSelectColumn(TaxRuleCountryTableMap::UPDATED_AT);
} else { } else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.TAX_RULE_ID'); $criteria->addSelectColumn($alias . '.TAX_RULE_ID');
$criteria->addSelectColumn($alias . '.COUNTRY_ID'); $criteria->addSelectColumn($alias . '.COUNTRY_ID');
$criteria->addSelectColumn($alias . '.TAX_ID'); $criteria->addSelectColumn($alias . '.TAX_ID');
$criteria->addSelectColumn($alias . '.NONE'); $criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
} }
@@ -391,7 +432,18 @@ class TaxRuleCountryTableMap extends TableMap
$criteria = $values->buildPkeyCriteria(); $criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks } else { // it's a primary key, or an array of pks
$criteria = new Criteria(TaxRuleCountryTableMap::DATABASE_NAME); $criteria = new Criteria(TaxRuleCountryTableMap::DATABASE_NAME);
$criteria->add(TaxRuleCountryTableMap::ID, (array) $values, Criteria::IN); // 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(TaxRuleCountryTableMap::TAX_RULE_ID, $value[0]);
$criterion->addAnd($criteria->getNewCriterion(TaxRuleCountryTableMap::COUNTRY_ID, $value[1]));
$criterion->addAnd($criteria->getNewCriterion(TaxRuleCountryTableMap::TAX_ID, $value[2]));
$criteria->addOr($criterion);
}
} }
$query = TaxRuleCountryQuery::create()->mergeWith($criteria); $query = TaxRuleCountryQuery::create()->mergeWith($criteria);

View File

@@ -57,7 +57,7 @@ class TaxRuleI18nTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 2; const NUM_COLUMNS = 4;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class TaxRuleI18nTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 2; const NUM_HYDRATE_COLUMNS = 4;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -79,6 +79,16 @@ class TaxRuleI18nTableMap extends TableMap
*/ */
const LOCALE = 'tax_rule_i18n.LOCALE'; const LOCALE = 'tax_rule_i18n.LOCALE';
/**
* the column name for the TITLE field
*/
const TITLE = 'tax_rule_i18n.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'tax_rule_i18n.DESCRIPTION';
/** /**
* The default string format for model objects of the related table * The default string format for model objects of the related table
*/ */
@@ -91,12 +101,12 @@ class TaxRuleI18nTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Locale', ), self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', ), self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', ),
self::TYPE_COLNAME => array(TaxRuleI18nTableMap::ID, TaxRuleI18nTableMap::LOCALE, ), self::TYPE_COLNAME => array(TaxRuleI18nTableMap::ID, TaxRuleI18nTableMap::LOCALE, TaxRuleI18nTableMap::TITLE, TaxRuleI18nTableMap::DESCRIPTION, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', ), self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', ),
self::TYPE_FIELDNAME => array('id', 'locale', ), self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', ),
self::TYPE_NUM => array(0, 1, ) self::TYPE_NUM => array(0, 1, 2, 3, )
); );
/** /**
@@ -106,12 +116,12 @@ class TaxRuleI18nTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, ), self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ),
self::TYPE_COLNAME => array(TaxRuleI18nTableMap::ID => 0, TaxRuleI18nTableMap::LOCALE => 1, ), self::TYPE_COLNAME => array(TaxRuleI18nTableMap::ID => 0, TaxRuleI18nTableMap::LOCALE => 1, TaxRuleI18nTableMap::TITLE => 2, TaxRuleI18nTableMap::DESCRIPTION => 3, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, ), self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ),
self::TYPE_NUM => array(0, 1, ) self::TYPE_NUM => array(0, 1, 2, 3, )
); );
/** /**
@@ -132,6 +142,8 @@ class TaxRuleI18nTableMap extends TableMap
// columns // columns
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule', 'ID', true, null, null); $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule', 'ID', true, null, null);
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
} // initialize() } // initialize()
/** /**
@@ -331,9 +343,13 @@ class TaxRuleI18nTableMap extends TableMap
if (null === $alias) { if (null === $alias) {
$criteria->addSelectColumn(TaxRuleI18nTableMap::ID); $criteria->addSelectColumn(TaxRuleI18nTableMap::ID);
$criteria->addSelectColumn(TaxRuleI18nTableMap::LOCALE); $criteria->addSelectColumn(TaxRuleI18nTableMap::LOCALE);
$criteria->addSelectColumn(TaxRuleI18nTableMap::TITLE);
$criteria->addSelectColumn(TaxRuleI18nTableMap::DESCRIPTION);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE'); $criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
} }
} }

View File

@@ -57,7 +57,7 @@ class TaxRuleTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 6; const NUM_COLUMNS = 3;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,28 +67,13 @@ class TaxRuleTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 6; const NUM_HYDRATE_COLUMNS = 3;
/** /**
* the column name for the ID field * the column name for the ID field
*/ */
const ID = 'tax_rule.ID'; const ID = 'tax_rule.ID';
/**
* the column name for the CODE field
*/
const CODE = 'tax_rule.CODE';
/**
* the column name for the TITLE field
*/
const TITLE = 'tax_rule.TITLE';
/**
* the column name for the DESCRIPTION field
*/
const DESCRIPTION = 'tax_rule.DESCRIPTION';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
*/ */
@@ -120,12 +105,12 @@ class TaxRuleTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Code', 'Title', 'Description', 'CreatedAt', 'UpdatedAt', ), self::TYPE_PHPNAME => array('Id', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'title', 'description', 'createdAt', 'updatedAt', ), self::TYPE_STUDLYPHPNAME => array('id', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(TaxRuleTableMap::ID, TaxRuleTableMap::CODE, TaxRuleTableMap::TITLE, TaxRuleTableMap::DESCRIPTION, TaxRuleTableMap::CREATED_AT, TaxRuleTableMap::UPDATED_AT, ), self::TYPE_COLNAME => array(TaxRuleTableMap::ID, TaxRuleTableMap::CREATED_AT, TaxRuleTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TITLE', 'DESCRIPTION', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_RAW_COLNAME => array('ID', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'code', 'title', 'description', 'created_at', 'updated_at', ), self::TYPE_FIELDNAME => array('id', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) self::TYPE_NUM => array(0, 1, 2, )
); );
/** /**
@@ -135,12 +120,12 @@ class TaxRuleTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Title' => 2, 'Description' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), self::TYPE_PHPNAME => array('Id' => 0, 'CreatedAt' => 1, 'UpdatedAt' => 2, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'title' => 2, 'description' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'createdAt' => 1, 'updatedAt' => 2, ),
self::TYPE_COLNAME => array(TaxRuleTableMap::ID => 0, TaxRuleTableMap::CODE => 1, TaxRuleTableMap::TITLE => 2, TaxRuleTableMap::DESCRIPTION => 3, TaxRuleTableMap::CREATED_AT => 4, TaxRuleTableMap::UPDATED_AT => 5, ), self::TYPE_COLNAME => array(TaxRuleTableMap::ID => 0, TaxRuleTableMap::CREATED_AT => 1, TaxRuleTableMap::UPDATED_AT => 2, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'CREATED_AT' => 1, 'UPDATED_AT' => 2, ),
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'title' => 2, 'description' => 3, 'created_at' => 4, 'updated_at' => 5, ), self::TYPE_FIELDNAME => array('id' => 0, 'created_at' => 1, 'updated_at' => 2, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) self::TYPE_NUM => array(0, 1, 2, )
); );
/** /**
@@ -160,9 +145,6 @@ class TaxRuleTableMap extends TableMap
$this->setUseIdGenerator(true); $this->setUseIdGenerator(true);
// columns // columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', false, 45, null);
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize() } // initialize()
@@ -187,7 +169,7 @@ class TaxRuleTableMap extends TableMap
{ {
return array( return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => '', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
); );
} // getBehaviors() } // getBehaviors()
/** /**
@@ -341,16 +323,10 @@ class TaxRuleTableMap extends TableMap
{ {
if (null === $alias) { if (null === $alias) {
$criteria->addSelectColumn(TaxRuleTableMap::ID); $criteria->addSelectColumn(TaxRuleTableMap::ID);
$criteria->addSelectColumn(TaxRuleTableMap::CODE);
$criteria->addSelectColumn(TaxRuleTableMap::TITLE);
$criteria->addSelectColumn(TaxRuleTableMap::DESCRIPTION);
$criteria->addSelectColumn(TaxRuleTableMap::CREATED_AT); $criteria->addSelectColumn(TaxRuleTableMap::CREATED_AT);
$criteria->addSelectColumn(TaxRuleTableMap::UPDATED_AT); $criteria->addSelectColumn(TaxRuleTableMap::UPDATED_AT);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE');
$criteria->addSelectColumn($alias . '.TITLE');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
} }

View File

@@ -160,7 +160,7 @@ class TaxTableMap extends TableMap
*/ */
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_id', ), 'SET NULL', 'RESTRICT', 'TaxRuleCountries'); $this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountries');
$this->addRelation('TaxI18n', '\\Thelia\\Model\\TaxI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'TaxI18ns'); $this->addRelation('TaxI18n', '\\Thelia\\Model\\TaxI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'TaxI18ns');
} // buildRelations() } // buildRelations()

View File

@@ -126,9 +126,6 @@ DROP TABLE IF EXISTS `tax_rule`;
CREATE TABLE `tax_rule` CREATE TABLE `tax_rule`
( (
`id` INTEGER NOT NULL AUTO_INCREMENT, `id` INTEGER NOT NULL AUTO_INCREMENT,
`code` VARCHAR(45),
`title` VARCHAR(255),
`description` TEXT,
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
@@ -142,14 +139,13 @@ DROP TABLE IF EXISTS `tax_rule_country`;
CREATE TABLE `tax_rule_country` CREATE TABLE `tax_rule_country`
( (
`id` INTEGER NOT NULL, `tax_rule_id` INTEGER NOT NULL,
`tax_rule_id` INTEGER, `country_id` INTEGER NOT NULL,
`country_id` INTEGER, `tax_id` INTEGER NOT NULL,
`tax_id` INTEGER, `position` INTEGER NOT NULL,
`none` TINYINT,
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`), PRIMARY KEY (`tax_rule_id`,`country_id`,`tax_id`),
INDEX `idx_tax_rule_country_tax_id` (`tax_id`), INDEX `idx_tax_rule_country_tax_id` (`tax_id`),
INDEX `idx_tax_rule_country_tax_rule_id` (`tax_rule_id`), INDEX `idx_tax_rule_country_tax_rule_id` (`tax_rule_id`),
INDEX `idx_tax_rule_country_country_id` (`country_id`), INDEX `idx_tax_rule_country_country_id` (`country_id`),
@@ -157,7 +153,7 @@ CREATE TABLE `tax_rule_country`
FOREIGN KEY (`tax_id`) FOREIGN KEY (`tax_id`)
REFERENCES `tax` (`id`) REFERENCES `tax` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE SET NULL, ON DELETE CASCADE,
CONSTRAINT `fk_tax_rule_country_tax_rule_id` CONSTRAINT `fk_tax_rule_country_tax_rule_id`
FOREIGN KEY (`tax_rule_id`) FOREIGN KEY (`tax_rule_id`)
REFERENCES `tax_rule` (`id`) REFERENCES `tax_rule` (`id`)
@@ -1574,6 +1570,8 @@ CREATE TABLE `tax_rule_i18n`
( (
`id` INTEGER NOT NULL, `id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
PRIMARY KEY (`id`,`locale`), PRIMARY KEY (`id`,`locale`),
CONSTRAINT `tax_rule_i18n_FK_1` CONSTRAINT `tax_rule_i18n_FK_1`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)

View File

@@ -104,9 +104,9 @@
</behavior> </behavior>
</table> </table>
<table name="tax_rule_country" namespace="Thelia\Model"> <table name="tax_rule_country" namespace="Thelia\Model">
<column name="tax_rule_id" required="true" type="INTEGER" /> <column name="tax_rule_id" primaryKey="true" required="true" type="INTEGER" />
<column name="country_id" required="true" type="INTEGER" /> <column name="country_id" primaryKey="true" required="true" type="INTEGER" />
<column name="tax_id" type="INTEGER" /> <column name="tax_id" primaryKey="true" required="true" type="INTEGER" />
<column name="position" required="true" type="INTEGER" /> <column name="position" required="true" type="INTEGER" />
<foreign-key foreignTable="tax" name="fk_tax_rule_country_tax_id" onDelete="CASCADE" onUpdate="RESTRICT"> <foreign-key foreignTable="tax" name="fk_tax_rule_country_tax_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="tax_id" /> <reference foreign="id" local="tax_id" />