- * $query->filterByIsDefault(true); // WHERE is_default = true
- * $query->filterByIsDefault('yes'); // WHERE is_default = true
- *
- *
- * @param boolean|string $isDefault The value to use as filter.
- * Non-boolean arguments are converted using the following rules:
- * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
- * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
- * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ChildTaxQuery The current query, for fluid interface
- */
- public function filterByIsDefault($isDefault = null, $comparison = null)
- {
- if (is_string($isDefault)) {
- $is_default = in_array(strtolower($isDefault), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
- }
-
- return $this->addUsingAlias(TaxTableMap::IS_DEFAULT, $isDefault, $comparison);
- }
-
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Base/TaxRule.php b/core/lib/Thelia/Model/Base/TaxRule.php
index 9edb7b2fc..b361567d8 100644
--- a/core/lib/Thelia/Model/Base/TaxRule.php
+++ b/core/lib/Thelia/Model/Base/TaxRule.php
@@ -67,6 +67,13 @@ abstract class TaxRule implements ActiveRecordInterface
*/
protected $id;
+ /**
+ * The value for the is_default field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $is_default;
+
/**
* The value for the created_at field.
* @var string
@@ -137,11 +144,24 @@ abstract class TaxRule implements ActiveRecordInterface
*/
protected $taxRuleI18nsScheduledForDeletion = null;
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->is_default = false;
+ }
+
/**
* Initializes internal state of Thelia\Model\Base\TaxRule object.
+ * @see applyDefaults()
*/
public function __construct()
{
+ $this->applyDefaultValues();
}
/**
@@ -402,6 +422,17 @@ abstract class TaxRule implements ActiveRecordInterface
return $this->id;
}
+ /**
+ * Get the [is_default] column value.
+ *
+ * @return boolean
+ */
+ public function getIsDefault()
+ {
+
+ return $this->is_default;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -463,6 +494,35 @@ abstract class TaxRule implements ActiveRecordInterface
return $this;
} // setId()
+ /**
+ * Sets the value of the [is_default] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return \Thelia\Model\TaxRule The current object (for fluent API support)
+ */
+ public function setIsDefault($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->is_default !== $v) {
+ $this->is_default = $v;
+ $this->modifiedColumns[] = TaxRuleTableMap::IS_DEFAULT;
+ }
+
+
+ return $this;
+ } // setIsDefault()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -515,6 +575,10 @@ abstract class TaxRule implements ActiveRecordInterface
*/
public function hasOnlyDefaultValues()
{
+ if ($this->is_default !== false) {
+ return false;
+ }
+
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -545,13 +609,16 @@ abstract class TaxRule implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleTableMap::translateFieldName('IsDefault', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->is_default = (null !== $col) ? (boolean) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -564,7 +631,7 @@ abstract class TaxRule implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 3; // 3 = TaxRuleTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 4; // 4 = TaxRuleTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\TaxRule object", 0, $e);
@@ -845,6 +912,9 @@ abstract class TaxRule implements ActiveRecordInterface
if ($this->isColumnModified(TaxRuleTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID';
}
+ if ($this->isColumnModified(TaxRuleTableMap::IS_DEFAULT)) {
+ $modifiedColumns[':p' . $index++] = 'IS_DEFAULT';
+ }
if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -865,6 +935,9 @@ abstract class TaxRule implements ActiveRecordInterface
case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
+ case 'IS_DEFAULT':
+ $stmt->bindValue($identifier, (int) $this->is_default, PDO::PARAM_INT);
+ break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -937,9 +1010,12 @@ abstract class TaxRule implements ActiveRecordInterface
return $this->getId();
break;
case 1:
- return $this->getCreatedAt();
+ return $this->getIsDefault();
break;
case 2:
+ return $this->getCreatedAt();
+ break;
+ case 3:
return $this->getUpdatedAt();
break;
default:
@@ -972,8 +1048,9 @@ abstract class TaxRule implements ActiveRecordInterface
$keys = TaxRuleTableMap::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
- $keys[1] => $this->getCreatedAt(),
- $keys[2] => $this->getUpdatedAt(),
+ $keys[1] => $this->getIsDefault(),
+ $keys[2] => $this->getCreatedAt(),
+ $keys[3] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1029,9 +1106,12 @@ abstract class TaxRule implements ActiveRecordInterface
$this->setId($value);
break;
case 1:
- $this->setCreatedAt($value);
+ $this->setIsDefault($value);
break;
case 2:
+ $this->setCreatedAt($value);
+ break;
+ case 3:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1059,8 +1139,9 @@ abstract class TaxRule implements ActiveRecordInterface
$keys = TaxRuleTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setCreatedAt($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setUpdatedAt($arr[$keys[2]]);
+ if (array_key_exists($keys[1], $arr)) $this->setIsDefault($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]);
}
/**
@@ -1073,6 +1154,7 @@ abstract class TaxRule implements ActiveRecordInterface
$criteria = new Criteria(TaxRuleTableMap::DATABASE_NAME);
if ($this->isColumnModified(TaxRuleTableMap::ID)) $criteria->add(TaxRuleTableMap::ID, $this->id);
+ if ($this->isColumnModified(TaxRuleTableMap::IS_DEFAULT)) $criteria->add(TaxRuleTableMap::IS_DEFAULT, $this->is_default);
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);
@@ -1138,6 +1220,7 @@ abstract class TaxRule implements ActiveRecordInterface
*/
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
+ $copyObj->setIsDefault($this->getIsDefault());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1961,10 +2044,12 @@ abstract class TaxRule implements ActiveRecordInterface
public function clear()
{
$this->id = null;
+ $this->is_default = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
+ $this->applyDefaultValues();
$this->resetModified();
$this->setNew(true);
$this->setDeleted(false);
diff --git a/core/lib/Thelia/Model/Base/TaxRuleQuery.php b/core/lib/Thelia/Model/Base/TaxRuleQuery.php
index 8ee264415..bc20c44b1 100644
--- a/core/lib/Thelia/Model/Base/TaxRuleQuery.php
+++ b/core/lib/Thelia/Model/Base/TaxRuleQuery.php
@@ -23,10 +23,12 @@ use Thelia\Model\Map\TaxRuleTableMap;
*
*
* @method ChildTaxRuleQuery orderById($order = Criteria::ASC) Order by the id column
+ * @method ChildTaxRuleQuery orderByIsDefault($order = Criteria::ASC) Order by the is_default 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 groupById() Group by the id column
+ * @method ChildTaxRuleQuery groupByIsDefault() Group by the is_default column
* @method ChildTaxRuleQuery groupByCreatedAt() Group by the created_at column
* @method ChildTaxRuleQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -50,10 +52,12 @@ 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 findOneById(int $id) Return the first ChildTaxRule filtered by the id column
+ * @method ChildTaxRule findOneByIsDefault(boolean $is_default) Return the first ChildTaxRule filtered by the is_default 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 array findById(int $id) Return ChildTaxRule objects filtered by the id column
+ * @method array findByIsDefault(boolean $is_default) Return ChildTaxRule objects filtered by the is_default 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
*
@@ -144,7 +148,7 @@ abstract class TaxRuleQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT ID, CREATED_AT, UPDATED_AT FROM tax_rule WHERE ID = :p0';
+ $sql = 'SELECT ID, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM tax_rule WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -274,6 +278,33 @@ abstract class TaxRuleQuery extends ModelCriteria
return $this->addUsingAlias(TaxRuleTableMap::ID, $id, $comparison);
}
+ /**
+ * Filter the query on the is_default column
+ *
+ * Example usage:
+ *
+ * $query->filterByIsDefault(true); // WHERE is_default = true
+ * $query->filterByIsDefault('yes'); // WHERE is_default = true
+ *
+ *
+ * @param boolean|string $isDefault The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildTaxRuleQuery The current query, for fluid interface
+ */
+ public function filterByIsDefault($isDefault = null, $comparison = null)
+ {
+ if (is_string($isDefault)) {
+ $is_default = in_array(strtolower($isDefault), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(TaxRuleTableMap::IS_DEFAULT, $isDefault, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php
index 204896674..347a0f7f7 100755
--- a/core/lib/Thelia/Model/Category.php
+++ b/core/lib/Thelia/Model/Category.php
@@ -79,7 +79,6 @@ class Category extends BaseCategory
*/
public function postInsert(ConnectionInterface $con = null)
{
- //$this->generateRewrittenUrl($this->getLocale());
$this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY, new CategoryEvent($this));
}
diff --git a/core/lib/Thelia/Model/Content.php b/core/lib/Thelia/Model/Content.php
index 4d9cf9f3a..10ed2afe3 100755
--- a/core/lib/Thelia/Model/Content.php
+++ b/core/lib/Thelia/Model/Content.php
@@ -39,9 +39,4 @@ class Content extends BaseContent
return true;
}
-
- public function postInsert(ConnectionInterface $con = null)
- {
- //$this->generateRewrittenUrl($this->getLocale());
- }
}
diff --git a/core/lib/Thelia/Model/Folder.php b/core/lib/Thelia/Model/Folder.php
index e32505d9d..f9006fbd7 100755
--- a/core/lib/Thelia/Model/Folder.php
+++ b/core/lib/Thelia/Model/Folder.php
@@ -70,9 +70,4 @@ class Folder extends BaseFolder
return true;
}
-
- public function postInsert(ConnectionInterface $con = null)
- {
- //$this->generateRewrittenUrl($this->getLocale());
- }
}
diff --git a/core/lib/Thelia/Model/FolderI18n.php b/core/lib/Thelia/Model/FolderI18n.php
index d1044452b..7ede39502 100755
--- a/core/lib/Thelia/Model/FolderI18n.php
+++ b/core/lib/Thelia/Model/FolderI18n.php
@@ -2,8 +2,14 @@
namespace Thelia\Model;
+use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\FolderI18n as BaseFolderI18n;
class FolderI18n extends BaseFolderI18n {
+ public function postInsert(ConnectionInterface $con = null)
+ {
+ $folder = $this->getFolder();
+ $folder->generateRewrittenUrl($this->getLocale());
+ }
}
diff --git a/core/lib/Thelia/Model/Map/TaxRuleTableMap.php b/core/lib/Thelia/Model/Map/TaxRuleTableMap.php
index 391e23b6d..ccc41e013 100644
--- a/core/lib/Thelia/Model/Map/TaxRuleTableMap.php
+++ b/core/lib/Thelia/Model/Map/TaxRuleTableMap.php
@@ -57,7 +57,7 @@ class TaxRuleTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 3;
+ const NUM_COLUMNS = 4;
/**
* The number of lazy-loaded columns
@@ -67,13 +67,18 @@ class TaxRuleTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 3;
+ const NUM_HYDRATE_COLUMNS = 4;
/**
* the column name for the ID field
*/
const ID = 'tax_rule.ID';
+ /**
+ * the column name for the IS_DEFAULT field
+ */
+ const IS_DEFAULT = 'tax_rule.IS_DEFAULT';
+
/**
* the column name for the CREATED_AT field
*/
@@ -105,12 +110,12 @@ class TaxRuleTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(TaxRuleTableMap::ID, TaxRuleTableMap::CREATED_AT, TaxRuleTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, )
+ self::TYPE_PHPNAME => array('Id', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'isDefault', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(TaxRuleTableMap::ID, TaxRuleTableMap::IS_DEFAULT, TaxRuleTableMap::CREATED_AT, TaxRuleTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'is_default', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, )
);
/**
@@ -120,12 +125,12 @@ class TaxRuleTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'CreatedAt' => 1, 'UpdatedAt' => 2, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'createdAt' => 1, 'updatedAt' => 2, ),
- self::TYPE_COLNAME => array(TaxRuleTableMap::ID => 0, TaxRuleTableMap::CREATED_AT => 1, TaxRuleTableMap::UPDATED_AT => 2, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'CREATED_AT' => 1, 'UPDATED_AT' => 2, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'created_at' => 1, 'updated_at' => 2, ),
- self::TYPE_NUM => array(0, 1, 2, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'IsDefault' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'isDefault' => 1, 'createdAt' => 2, 'updatedAt' => 3, ),
+ self::TYPE_COLNAME => array(TaxRuleTableMap::ID => 0, TaxRuleTableMap::IS_DEFAULT => 1, TaxRuleTableMap::CREATED_AT => 2, TaxRuleTableMap::UPDATED_AT => 3, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'IS_DEFAULT' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'is_default' => 1, 'created_at' => 2, 'updated_at' => 3, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, )
);
/**
@@ -145,6 +150,7 @@ class TaxRuleTableMap extends TableMap
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('IS_DEFAULT', 'IsDefault', 'BOOLEAN', true, 1, false);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -323,10 +329,12 @@ class TaxRuleTableMap extends TableMap
{
if (null === $alias) {
$criteria->addSelectColumn(TaxRuleTableMap::ID);
+ $criteria->addSelectColumn(TaxRuleTableMap::IS_DEFAULT);
$criteria->addSelectColumn(TaxRuleTableMap::CREATED_AT);
$criteria->addSelectColumn(TaxRuleTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.IS_DEFAULT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/TaxTableMap.php b/core/lib/Thelia/Model/Map/TaxTableMap.php
index eebde0ca0..6ca89ae85 100644
--- a/core/lib/Thelia/Model/Map/TaxTableMap.php
+++ b/core/lib/Thelia/Model/Map/TaxTableMap.php
@@ -57,7 +57,7 @@ class TaxTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 6;
+ const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class TaxTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 6;
+ const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the ID field
@@ -84,11 +84,6 @@ class TaxTableMap extends TableMap
*/
const SERIALIZED_REQUIREMENTS = 'tax.SERIALIZED_REQUIREMENTS';
- /**
- * the column name for the IS_DEFAULT field
- */
- const IS_DEFAULT = 'tax.IS_DEFAULT';
-
/**
* the column name for the CREATED_AT field
*/
@@ -120,12 +115,12 @@ class TaxTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Type', 'SerializedRequirements', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'type', 'serializedRequirements', 'isDefault', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(TaxTableMap::ID, TaxTableMap::TYPE, TaxTableMap::SERIALIZED_REQUIREMENTS, TaxTableMap::IS_DEFAULT, TaxTableMap::CREATED_AT, TaxTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'TYPE', 'SERIALIZED_REQUIREMENTS', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'type', 'serialized_requirements', 'is_default', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
+ self::TYPE_PHPNAME => array('Id', 'Type', 'SerializedRequirements', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'type', 'serializedRequirements', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(TaxTableMap::ID, TaxTableMap::TYPE, TaxTableMap::SERIALIZED_REQUIREMENTS, TaxTableMap::CREATED_AT, TaxTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'TYPE', 'SERIALIZED_REQUIREMENTS', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'type', 'serialized_requirements', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -135,12 +130,12 @@ class TaxTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Type' => 1, 'SerializedRequirements' => 2, 'IsDefault' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'type' => 1, 'serializedRequirements' => 2, 'isDefault' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
- self::TYPE_COLNAME => array(TaxTableMap::ID => 0, TaxTableMap::TYPE => 1, TaxTableMap::SERIALIZED_REQUIREMENTS => 2, TaxTableMap::IS_DEFAULT => 3, TaxTableMap::CREATED_AT => 4, TaxTableMap::UPDATED_AT => 5, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'TYPE' => 1, 'SERIALIZED_REQUIREMENTS' => 2, 'IS_DEFAULT' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'type' => 1, 'serialized_requirements' => 2, 'is_default' => 3, 'created_at' => 4, 'updated_at' => 5, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Type' => 1, 'SerializedRequirements' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'type' => 1, 'serializedRequirements' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
+ self::TYPE_COLNAME => array(TaxTableMap::ID => 0, TaxTableMap::TYPE => 1, TaxTableMap::SERIALIZED_REQUIREMENTS => 2, TaxTableMap::CREATED_AT => 3, TaxTableMap::UPDATED_AT => 4, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'TYPE' => 1, 'SERIALIZED_REQUIREMENTS' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'type' => 1, 'serialized_requirements' => 2, 'created_at' => 3, 'updated_at' => 4, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -162,7 +157,6 @@ class TaxTableMap extends TableMap
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null);
$this->addColumn('SERIALIZED_REQUIREMENTS', 'SerializedRequirements', 'LONGVARCHAR', true, null, null);
- $this->addColumn('IS_DEFAULT', 'IsDefault', 'BOOLEAN', false, 1, false);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -341,14 +335,12 @@ class TaxTableMap extends TableMap
$criteria->addSelectColumn(TaxTableMap::ID);
$criteria->addSelectColumn(TaxTableMap::TYPE);
$criteria->addSelectColumn(TaxTableMap::SERIALIZED_REQUIREMENTS);
- $criteria->addSelectColumn(TaxTableMap::IS_DEFAULT);
$criteria->addSelectColumn(TaxTableMap::CREATED_AT);
$criteria->addSelectColumn(TaxTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.SERIALIZED_REQUIREMENTS');
- $criteria->addSelectColumn($alias . '.IS_DEFAULT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php
index 2bc014d27..e2eb43971 100755
--- a/core/lib/Thelia/Model/Order.php
+++ b/core/lib/Thelia/Model/Order.php
@@ -7,7 +7,7 @@ use Thelia\Model\Base\Order as BaseOrder;
class Order extends BaseOrder
{
public $chosenDeliveryAddress = null;
- public $chosenInvoiceModule = null;
+ public $chosenInvoiceAddress = null;
/**
* calculate the total amount
diff --git a/core/lib/Thelia/Model/Product.php b/core/lib/Thelia/Model/Product.php
index 13600351a..825668cd0 100755
--- a/core/lib/Thelia/Model/Product.php
+++ b/core/lib/Thelia/Model/Product.php
@@ -103,7 +103,7 @@ class Product extends BaseProduct
try {
// Create the product
$this->save($con);
-echo "1";
+
// Add the default category
$pc = new ProductCategory();
@@ -116,19 +116,19 @@ echo "1";
// Set the position
$this->setPosition($this->getNextPosition())->save($con);
- echo "2";
+
// Create an empty product sale element
$sale_elements = new ProductSaleElements();
$sale_elements
->setProduct($this)
- ->setRef('')
+ ->setRef($this->getRef())
->setPromo(0)
->setNewness(0)
->setWeight(0)
->save($con)
;
- echo "3";
+
// Create an empty product price in the default currency
$product_price = new ProductPrice();
@@ -136,22 +136,19 @@ echo "1";
->setProductSaleElements($sale_elements)
->setPromoPrice(0)
->setPrice(0)
- ->setCurrency(CurrencyQuery::create()->findByByDefault(true))
+ ->setCurrency(CurrencyQuery::create()->findOneByByDefault(true))
->save($con)
;
- echo "4";
+
// Store all the stuff !
$con->commit();
-echo "commited !!!: ".$this->getId();
-
$this->dispatchEvent(TheliaEvents::AFTER_CREATEPRODUCT, new ProductEvent($this));
}
- catch(PropelException $ex) {
+ catch(\Exception $ex) {
$con->rollback();
-echo("error !");
-exit;
+
throw $ex;
}
}
@@ -172,9 +169,7 @@ exit;
if ($produits != null) $query->filterById($produits, Criteria::IN);
}
- /**
- * {@inheritDoc}
- */
+
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEPRODUCT, new ProductEvent($this));
diff --git a/core/lib/Thelia/Model/ProductI18n.php b/core/lib/Thelia/Model/ProductI18n.php
index 7507bceb1..6ec3ac4a3 100755
--- a/core/lib/Thelia/Model/ProductI18n.php
+++ b/core/lib/Thelia/Model/ProductI18n.php
@@ -2,8 +2,14 @@
namespace Thelia\Model;
+use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\ProductI18n as BaseProductI18n;
class ProductI18n extends BaseProductI18n {
+ public function postInsert(ConnectionInterface $con = null)
+ {
+ $product = $this->getProduct();
+ $product->generateRewrittenUrl($this->getLocale());
+ }
}
diff --git a/core/lib/Thelia/Module/DeliveryModuleInterface.php b/core/lib/Thelia/Module/DeliveryModuleInterface.php
index 72f8769bc..17b000d4f 100644
--- a/core/lib/Thelia/Module/DeliveryModuleInterface.php
+++ b/core/lib/Thelia/Module/DeliveryModuleInterface.php
@@ -34,5 +34,5 @@ interface DeliveryModuleInterface extends BaseModuleInterface
*
* @return mixed
*/
- public function calculate(Country $country);
+ public function getPostage(Country $country);
}
diff --git a/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php b/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php
index c38773814..b6601289d 100644
--- a/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php
+++ b/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php
@@ -76,6 +76,7 @@ class ProductRewriteTest extends \PHPUnit_Framework_TestCase
}
/**
+ * @covers Thelia\Model\Tools\UrlRewritingTrait::generateRewrittenUrl
* @expectedException \RuntimeException
* @expectedExceptionMessage Object product must be saved before generating url
*/
diff --git a/install/faker.php b/install/faker.php
index 3d48fc0e1..eed6db11a 100755
--- a/install/faker.php
+++ b/install/faker.php
@@ -281,7 +281,7 @@ try {
$folder = new Thelia\Model\Folder();
$folder->setParent(0);
$folder->setVisible(1);
- $folder->setPosition($i);
+ $folder->setPosition($i+1);
setI18n($faker, $folder);
$folder->save();
@@ -294,11 +294,11 @@ try {
$document->setFolderId($folder->getId());
generate_document($document, 1, 'folder', $folder->getId());
- for($j=1; $j