- * $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 ChildAttributeCombinationQuery 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(AttributeCombinationTableMap::IS_DEFAULT, $isDefault, $comparison);
- }
-
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Base/ProductSaleElements.php b/core/lib/Thelia/Model/Base/ProductSaleElements.php
index fa887dc8a..eb6aa2b1a 100644
--- a/core/lib/Thelia/Model/Base/ProductSaleElements.php
+++ b/core/lib/Thelia/Model/Base/ProductSaleElements.php
@@ -103,10 +103,18 @@ abstract class ProductSaleElements implements ActiveRecordInterface
/**
* The value for the weight field.
+ * Note: this column has a database default value of: 0
* @var double
*/
protected $weight;
+ /**
+ * 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
@@ -178,6 +186,8 @@ abstract class ProductSaleElements implements ActiveRecordInterface
{
$this->promo = 0;
$this->newness = 0;
+ $this->weight = 0;
+ $this->is_default = false;
}
/**
@@ -513,6 +523,17 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return $this->weight;
}
+ /**
+ * Get the [is_default] column value.
+ *
+ * @return boolean
+ */
+ public function getIsDefault()
+ {
+
+ return $this->is_default;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -704,6 +725,35 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return $this;
} // setWeight()
+ /**
+ * 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\ProductSaleElements 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[] = ProductSaleElementsTableMap::IS_DEFAULT;
+ }
+
+
+ return $this;
+ } // setIsDefault()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -764,6 +814,14 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return false;
}
+ if ($this->weight !== 0) {
+ return false;
+ }
+
+ if ($this->is_default !== false) {
+ return false;
+ }
+
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -812,13 +870,16 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductSaleElementsTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
$this->weight = (null !== $col) ? (double) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductSaleElementsTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductSaleElementsTableMap::translateFieldName('IsDefault', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->is_default = (null !== $col) ? (boolean) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductSaleElementsTableMap::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 ? 8 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -831,7 +892,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 9; // 9 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 10; // 10 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductSaleElements object", 0, $e);
@@ -1145,6 +1206,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
if ($this->isColumnModified(ProductSaleElementsTableMap::WEIGHT)) {
$modifiedColumns[':p' . $index++] = 'WEIGHT';
}
+ if ($this->isColumnModified(ProductSaleElementsTableMap::IS_DEFAULT)) {
+ $modifiedColumns[':p' . $index++] = 'IS_DEFAULT';
+ }
if ($this->isColumnModified(ProductSaleElementsTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -1183,6 +1247,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
case 'WEIGHT':
$stmt->bindValue($identifier, $this->weight, PDO::PARAM_STR);
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;
@@ -1273,9 +1340,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return $this->getWeight();
break;
case 7:
- return $this->getCreatedAt();
+ return $this->getIsDefault();
break;
case 8:
+ return $this->getCreatedAt();
+ break;
+ case 9:
return $this->getUpdatedAt();
break;
default:
@@ -1314,8 +1384,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$keys[4] => $this->getPromo(),
$keys[5] => $this->getNewness(),
$keys[6] => $this->getWeight(),
- $keys[7] => $this->getCreatedAt(),
- $keys[8] => $this->getUpdatedAt(),
+ $keys[7] => $this->getIsDefault(),
+ $keys[8] => $this->getCreatedAt(),
+ $keys[9] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1392,9 +1463,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$this->setWeight($value);
break;
case 7:
- $this->setCreatedAt($value);
+ $this->setIsDefault($value);
break;
case 8:
+ $this->setCreatedAt($value);
+ break;
+ case 9:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1428,8 +1502,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
if (array_key_exists($keys[4], $arr)) $this->setPromo($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setNewness($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setWeight($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
+ if (array_key_exists($keys[7], $arr)) $this->setIsDefault($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setUpdatedAt($arr[$keys[9]]);
}
/**
@@ -1448,6 +1523,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
if ($this->isColumnModified(ProductSaleElementsTableMap::PROMO)) $criteria->add(ProductSaleElementsTableMap::PROMO, $this->promo);
if ($this->isColumnModified(ProductSaleElementsTableMap::NEWNESS)) $criteria->add(ProductSaleElementsTableMap::NEWNESS, $this->newness);
if ($this->isColumnModified(ProductSaleElementsTableMap::WEIGHT)) $criteria->add(ProductSaleElementsTableMap::WEIGHT, $this->weight);
+ if ($this->isColumnModified(ProductSaleElementsTableMap::IS_DEFAULT)) $criteria->add(ProductSaleElementsTableMap::IS_DEFAULT, $this->is_default);
if ($this->isColumnModified(ProductSaleElementsTableMap::CREATED_AT)) $criteria->add(ProductSaleElementsTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductSaleElementsTableMap::UPDATED_AT)) $criteria->add(ProductSaleElementsTableMap::UPDATED_AT, $this->updated_at);
@@ -1519,6 +1595,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$copyObj->setPromo($this->getPromo());
$copyObj->setNewness($this->getNewness());
$copyObj->setWeight($this->getWeight());
+ $copyObj->setIsDefault($this->getIsDefault());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -2445,6 +2522,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$this->promo = null;
$this->newness = null;
$this->weight = null;
+ $this->is_default = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
diff --git a/core/lib/Thelia/Model/Base/ProductSaleElementsQuery.php b/core/lib/Thelia/Model/Base/ProductSaleElementsQuery.php
index 6e9068002..c8201ed0b 100644
--- a/core/lib/Thelia/Model/Base/ProductSaleElementsQuery.php
+++ b/core/lib/Thelia/Model/Base/ProductSaleElementsQuery.php
@@ -28,6 +28,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
* @method ChildProductSaleElementsQuery orderByPromo($order = Criteria::ASC) Order by the promo column
* @method ChildProductSaleElementsQuery orderByNewness($order = Criteria::ASC) Order by the newness column
* @method ChildProductSaleElementsQuery orderByWeight($order = Criteria::ASC) Order by the weight column
+ * @method ChildProductSaleElementsQuery orderByIsDefault($order = Criteria::ASC) Order by the is_default column
* @method ChildProductSaleElementsQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductSaleElementsQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -38,6 +39,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
* @method ChildProductSaleElementsQuery groupByPromo() Group by the promo column
* @method ChildProductSaleElementsQuery groupByNewness() Group by the newness column
* @method ChildProductSaleElementsQuery groupByWeight() Group by the weight column
+ * @method ChildProductSaleElementsQuery groupByIsDefault() Group by the is_default column
* @method ChildProductSaleElementsQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductSaleElementsQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -71,6 +73,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
* @method ChildProductSaleElements findOneByPromo(int $promo) Return the first ChildProductSaleElements filtered by the promo column
* @method ChildProductSaleElements findOneByNewness(int $newness) Return the first ChildProductSaleElements filtered by the newness column
* @method ChildProductSaleElements findOneByWeight(double $weight) Return the first ChildProductSaleElements filtered by the weight column
+ * @method ChildProductSaleElements findOneByIsDefault(boolean $is_default) Return the first ChildProductSaleElements filtered by the is_default column
* @method ChildProductSaleElements findOneByCreatedAt(string $created_at) Return the first ChildProductSaleElements filtered by the created_at column
* @method ChildProductSaleElements findOneByUpdatedAt(string $updated_at) Return the first ChildProductSaleElements filtered by the updated_at column
*
@@ -81,6 +84,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
* @method array findByPromo(int $promo) Return ChildProductSaleElements objects filtered by the promo column
* @method array findByNewness(int $newness) Return ChildProductSaleElements objects filtered by the newness column
* @method array findByWeight(double $weight) Return ChildProductSaleElements objects filtered by the weight column
+ * @method array findByIsDefault(boolean $is_default) Return ChildProductSaleElements objects filtered by the is_default column
* @method array findByCreatedAt(string $created_at) Return ChildProductSaleElements objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductSaleElements objects filtered by the updated_at column
*
@@ -171,7 +175,7 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT ID, PRODUCT_ID, REF, QUANTITY, PROMO, NEWNESS, WEIGHT, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0';
+ $sql = 'SELECT ID, PRODUCT_ID, REF, QUANTITY, PROMO, NEWNESS, WEIGHT, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -537,6 +541,33 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
return $this->addUsingAlias(ProductSaleElementsTableMap::WEIGHT, $weight, $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 ChildProductSaleElementsQuery 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(ProductSaleElementsTableMap::IS_DEFAULT, $isDefault, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Map/AttributeCombinationTableMap.php b/core/lib/Thelia/Model/Map/AttributeCombinationTableMap.php
index 031ecfd81..c13b85bbf 100644
--- a/core/lib/Thelia/Model/Map/AttributeCombinationTableMap.php
+++ b/core/lib/Thelia/Model/Map/AttributeCombinationTableMap.php
@@ -57,7 +57,7 @@ class AttributeCombinationTableMap 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 AttributeCombinationTableMap 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 ATTRIBUTE_ID field
@@ -84,11 +84,6 @@ class AttributeCombinationTableMap extends TableMap
*/
const PRODUCT_SALE_ELEMENTS_ID = 'attribute_combination.PRODUCT_SALE_ELEMENTS_ID';
- /**
- * the column name for the IS_DEFAULT field
- */
- const IS_DEFAULT = 'attribute_combination.IS_DEFAULT';
-
/**
* the column name for the CREATED_AT field
*/
@@ -111,12 +106,12 @@ class AttributeCombinationTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('AttributeId', 'AttributeAvId', 'ProductSaleElementsId', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('attributeId', 'attributeAvId', 'productSaleElementsId', 'isDefault', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(AttributeCombinationTableMap::ATTRIBUTE_ID, AttributeCombinationTableMap::ATTRIBUTE_AV_ID, AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID, AttributeCombinationTableMap::IS_DEFAULT, AttributeCombinationTableMap::CREATED_AT, AttributeCombinationTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ATTRIBUTE_ID', 'ATTRIBUTE_AV_ID', 'PRODUCT_SALE_ELEMENTS_ID', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('attribute_id', 'attribute_av_id', 'product_sale_elements_id', 'is_default', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
+ self::TYPE_PHPNAME => array('AttributeId', 'AttributeAvId', 'ProductSaleElementsId', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('attributeId', 'attributeAvId', 'productSaleElementsId', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(AttributeCombinationTableMap::ATTRIBUTE_ID, AttributeCombinationTableMap::ATTRIBUTE_AV_ID, AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID, AttributeCombinationTableMap::CREATED_AT, AttributeCombinationTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ATTRIBUTE_ID', 'ATTRIBUTE_AV_ID', 'PRODUCT_SALE_ELEMENTS_ID', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('attribute_id', 'attribute_av_id', 'product_sale_elements_id', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -126,12 +121,12 @@ class AttributeCombinationTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('AttributeId' => 0, 'AttributeAvId' => 1, 'ProductSaleElementsId' => 2, 'IsDefault' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
- self::TYPE_STUDLYPHPNAME => array('attributeId' => 0, 'attributeAvId' => 1, 'productSaleElementsId' => 2, 'isDefault' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
- self::TYPE_COLNAME => array(AttributeCombinationTableMap::ATTRIBUTE_ID => 0, AttributeCombinationTableMap::ATTRIBUTE_AV_ID => 1, AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID => 2, AttributeCombinationTableMap::IS_DEFAULT => 3, AttributeCombinationTableMap::CREATED_AT => 4, AttributeCombinationTableMap::UPDATED_AT => 5, ),
- self::TYPE_RAW_COLNAME => array('ATTRIBUTE_ID' => 0, 'ATTRIBUTE_AV_ID' => 1, 'PRODUCT_SALE_ELEMENTS_ID' => 2, 'IS_DEFAULT' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
- self::TYPE_FIELDNAME => array('attribute_id' => 0, 'attribute_av_id' => 1, 'product_sale_elements_id' => 2, 'is_default' => 3, 'created_at' => 4, 'updated_at' => 5, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
+ self::TYPE_PHPNAME => array('AttributeId' => 0, 'AttributeAvId' => 1, 'ProductSaleElementsId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
+ self::TYPE_STUDLYPHPNAME => array('attributeId' => 0, 'attributeAvId' => 1, 'productSaleElementsId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
+ self::TYPE_COLNAME => array(AttributeCombinationTableMap::ATTRIBUTE_ID => 0, AttributeCombinationTableMap::ATTRIBUTE_AV_ID => 1, AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID => 2, AttributeCombinationTableMap::CREATED_AT => 3, AttributeCombinationTableMap::UPDATED_AT => 4, ),
+ self::TYPE_RAW_COLNAME => array('ATTRIBUTE_ID' => 0, 'ATTRIBUTE_AV_ID' => 1, 'PRODUCT_SALE_ELEMENTS_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
+ self::TYPE_FIELDNAME => array('attribute_id' => 0, 'attribute_av_id' => 1, 'product_sale_elements_id' => 2, 'created_at' => 3, 'updated_at' => 4, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -153,7 +148,6 @@ class AttributeCombinationTableMap extends TableMap
$this->addForeignPrimaryKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER' , 'attribute', 'ID', true, null, null);
$this->addForeignPrimaryKey('ATTRIBUTE_AV_ID', 'AttributeAvId', 'INTEGER' , 'attribute_av', 'ID', true, null, null);
$this->addForeignPrimaryKey('PRODUCT_SALE_ELEMENTS_ID', 'ProductSaleElementsId', 'INTEGER' , 'product_sale_elements', 'ID', 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()
@@ -371,14 +365,12 @@ class AttributeCombinationTableMap extends TableMap
$criteria->addSelectColumn(AttributeCombinationTableMap::ATTRIBUTE_ID);
$criteria->addSelectColumn(AttributeCombinationTableMap::ATTRIBUTE_AV_ID);
$criteria->addSelectColumn(AttributeCombinationTableMap::PRODUCT_SALE_ELEMENTS_ID);
- $criteria->addSelectColumn(AttributeCombinationTableMap::IS_DEFAULT);
$criteria->addSelectColumn(AttributeCombinationTableMap::CREATED_AT);
$criteria->addSelectColumn(AttributeCombinationTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ATTRIBUTE_ID');
$criteria->addSelectColumn($alias . '.ATTRIBUTE_AV_ID');
$criteria->addSelectColumn($alias . '.PRODUCT_SALE_ELEMENTS_ID');
- $criteria->addSelectColumn($alias . '.IS_DEFAULT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php b/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php
index 70b3819f9..1e894ef24 100644
--- a/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php
@@ -57,7 +57,7 @@ class ProductSaleElementsTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 9;
+ const NUM_COLUMNS = 10;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ProductSaleElementsTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 9;
+ const NUM_HYDRATE_COLUMNS = 10;
/**
* the column name for the ID field
@@ -104,6 +104,11 @@ class ProductSaleElementsTableMap extends TableMap
*/
const WEIGHT = 'product_sale_elements.WEIGHT';
+ /**
+ * the column name for the IS_DEFAULT field
+ */
+ const IS_DEFAULT = 'product_sale_elements.IS_DEFAULT';
+
/**
* the column name for the CREATED_AT field
*/
@@ -126,12 +131,12 @@ class ProductSaleElementsTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'ProductId', 'Ref', 'Quantity', 'Promo', 'Newness', 'Weight', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'ref', 'quantity', 'promo', 'newness', 'weight', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID, ProductSaleElementsTableMap::PRODUCT_ID, ProductSaleElementsTableMap::REF, ProductSaleElementsTableMap::QUANTITY, ProductSaleElementsTableMap::PROMO, ProductSaleElementsTableMap::NEWNESS, ProductSaleElementsTableMap::WEIGHT, ProductSaleElementsTableMap::CREATED_AT, ProductSaleElementsTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'REF', 'QUANTITY', 'PROMO', 'NEWNESS', 'WEIGHT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'product_id', 'ref', 'quantity', 'promo', 'newness', 'weight', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ self::TYPE_PHPNAME => array('Id', 'ProductId', 'Ref', 'Quantity', 'Promo', 'Newness', 'Weight', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'ref', 'quantity', 'promo', 'newness', 'weight', 'isDefault', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID, ProductSaleElementsTableMap::PRODUCT_ID, ProductSaleElementsTableMap::REF, ProductSaleElementsTableMap::QUANTITY, ProductSaleElementsTableMap::PROMO, ProductSaleElementsTableMap::NEWNESS, ProductSaleElementsTableMap::WEIGHT, ProductSaleElementsTableMap::IS_DEFAULT, ProductSaleElementsTableMap::CREATED_AT, ProductSaleElementsTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'REF', 'QUANTITY', 'PROMO', 'NEWNESS', 'WEIGHT', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'product_id', 'ref', 'quantity', 'promo', 'newness', 'weight', 'is_default', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
@@ -141,12 +146,12 @@ class ProductSaleElementsTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'Ref' => 2, 'Quantity' => 3, 'Promo' => 4, 'Newness' => 5, 'Weight' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
- self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID => 0, ProductSaleElementsTableMap::PRODUCT_ID => 1, ProductSaleElementsTableMap::REF => 2, ProductSaleElementsTableMap::QUANTITY => 3, ProductSaleElementsTableMap::PROMO => 4, ProductSaleElementsTableMap::NEWNESS => 5, ProductSaleElementsTableMap::WEIGHT => 6, ProductSaleElementsTableMap::CREATED_AT => 7, ProductSaleElementsTableMap::UPDATED_AT => 8, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'REF' => 2, 'QUANTITY' => 3, 'PROMO' => 4, 'NEWNESS' => 5, 'WEIGHT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'created_at' => 7, 'updated_at' => 8, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'Ref' => 2, 'Quantity' => 3, 'Promo' => 4, 'Newness' => 5, 'Weight' => 6, 'IsDefault' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'isDefault' => 7, 'createdAt' => 8, 'updatedAt' => 9, ),
+ self::TYPE_COLNAME => array(ProductSaleElementsTableMap::ID => 0, ProductSaleElementsTableMap::PRODUCT_ID => 1, ProductSaleElementsTableMap::REF => 2, ProductSaleElementsTableMap::QUANTITY => 3, ProductSaleElementsTableMap::PROMO => 4, ProductSaleElementsTableMap::NEWNESS => 5, ProductSaleElementsTableMap::WEIGHT => 6, ProductSaleElementsTableMap::IS_DEFAULT => 7, ProductSaleElementsTableMap::CREATED_AT => 8, ProductSaleElementsTableMap::UPDATED_AT => 9, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'REF' => 2, 'QUANTITY' => 3, 'PROMO' => 4, 'NEWNESS' => 5, 'WEIGHT' => 6, 'IS_DEFAULT' => 7, 'CREATED_AT' => 8, 'UPDATED_AT' => 9, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'ref' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'is_default' => 7, 'created_at' => 8, 'updated_at' => 9, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
@@ -171,7 +176,8 @@ class ProductSaleElementsTableMap extends TableMap
$this->addColumn('QUANTITY', 'Quantity', 'FLOAT', true, null, null);
$this->addColumn('PROMO', 'Promo', 'TINYINT', false, null, 0);
$this->addColumn('NEWNESS', 'Newness', 'TINYINT', false, null, 0);
- $this->addColumn('WEIGHT', 'Weight', 'FLOAT', false, null, null);
+ $this->addColumn('WEIGHT', 'Weight', 'FLOAT', false, null, 0);
+ $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()
@@ -355,6 +361,7 @@ class ProductSaleElementsTableMap extends TableMap
$criteria->addSelectColumn(ProductSaleElementsTableMap::PROMO);
$criteria->addSelectColumn(ProductSaleElementsTableMap::NEWNESS);
$criteria->addSelectColumn(ProductSaleElementsTableMap::WEIGHT);
+ $criteria->addSelectColumn(ProductSaleElementsTableMap::IS_DEFAULT);
$criteria->addSelectColumn(ProductSaleElementsTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductSaleElementsTableMap::UPDATED_AT);
} else {
@@ -365,6 +372,7 @@ class ProductSaleElementsTableMap extends TableMap
$criteria->addSelectColumn($alias . '.PROMO');
$criteria->addSelectColumn($alias . '.NEWNESS');
$criteria->addSelectColumn($alias . '.WEIGHT');
+ $criteria->addSelectColumn($alias . '.IS_DEFAULT');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Product.php b/core/lib/Thelia/Model/Product.php
index 8521d8dc5..6114b8acf 100755
--- a/core/lib/Thelia/Model/Product.php
+++ b/core/lib/Thelia/Model/Product.php
@@ -108,7 +108,7 @@ class Product extends BaseProduct
->setProduct($this)
->setCategoryId($defaultCategoryId)
->setDefaultCategory(true)
- ->save($con)
+ ->save()
;
}
}
diff --git a/install/thelia.sql b/install/thelia.sql
index efa72b629..503040a88 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -325,7 +325,6 @@ CREATE TABLE `attribute_combination`
`attribute_id` INTEGER NOT NULL,
`attribute_av_id` INTEGER NOT NULL,
`product_sale_elements_id` INTEGER NOT NULL,
- `is_default` TINYINT(1) DEFAULT 0,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`attribute_id`,`attribute_av_id`,`product_sale_elements_id`),
@@ -363,7 +362,8 @@ CREATE TABLE `product_sale_elements`
`quantity` FLOAT NOT NULL,
`promo` TINYINT DEFAULT 0,
`newness` TINYINT DEFAULT 0,
- `weight` FLOAT,
+ `weight` FLOAT DEFAULT 0,
+ `is_default` TINYINT(1) DEFAULT 0,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 98cf32ffb..88a3d2a9d 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -55,7 +55,7 @@