remove combination_id in stock table

This commit is contained in:
Manuel Raynaud
2013-07-29 15:26:33 +02:00
parent e64549c91a
commit 0738104f52
6 changed files with 59 additions and 175 deletions

View File

@@ -64,10 +64,10 @@ class CartAdd extends BaseForm
))
)
))
->add("combination", "hidden", array(
->add("stock_id", "hidden", array(
"constraints" => array(
new Constraints\Callback(array(
"methods" => array($this, "checkCombination")
"methods" => array($this, "checkStockAvailability")
))
)
@@ -94,18 +94,15 @@ class CartAdd extends BaseForm
}
}
protected function checkCombination($value, ExecutionContextInterface $context)
protected function checkStockAvailability($value, ExecutionContextInterface $context)
{
if ($value) {
$data = $context->getRoot()->getData();
$stock = StockQuery::create()
->filterByProductId($data["product"])
->filterByCombinationId($value, Criteria::EQUAL)
->findOne();
$stock = StockQuery::create()->findPk($value);
if (is_null($stock)) {
throw new CombinationNotFoundException(sprintf("This combination id does not exists for this product : %d", $value));
throw new CombinationNotFoundException(sprintf("This stock_id does not exists for this product : %d", $value));
}
}
}

View File

@@ -69,12 +69,6 @@ abstract class Stock implements ActiveRecordInterface
*/
protected $id;
/**
* The value for the combination_id field.
* @var int
*/
protected $combination_id;
/**
* The value for the product_id field.
* @var int
@@ -453,17 +447,6 @@ abstract class Stock implements ActiveRecordInterface
return $this->id;
}
/**
* Get the [combination_id] column value.
*
* @return int
*/
public function getCombinationId()
{
return $this->combination_id;
}
/**
* Get the [product_id] column value.
*
@@ -591,27 +574,6 @@ abstract class Stock implements ActiveRecordInterface
return $this;
} // setId()
/**
* Set the value of [combination_id] column.
*
* @param int $v new value
* @return \Thelia\Model\Stock The current object (for fluent API support)
*/
public function setCombinationId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->combination_id !== $v) {
$this->combination_id = $v;
$this->modifiedColumns[] = StockTableMap::COMBINATION_ID;
}
return $this;
} // setCombinationId()
/**
* Set the value of [product_id] column.
*
@@ -832,34 +794,31 @@ abstract class Stock implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : StockTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : StockTableMap::translateFieldName('CombinationId', TableMap::TYPE_PHPNAME, $indexType)];
$this->combination_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : StockTableMap::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : StockTableMap::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)];
$this->product_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : StockTableMap::translateFieldName('Increase', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : StockTableMap::translateFieldName('Increase', TableMap::TYPE_PHPNAME, $indexType)];
$this->increase = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : StockTableMap::translateFieldName('Quantity', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : StockTableMap::translateFieldName('Quantity', TableMap::TYPE_PHPNAME, $indexType)];
$this->quantity = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : StockTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : StockTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
$this->promo = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : StockTableMap::translateFieldName('Newness', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : StockTableMap::translateFieldName('Newness', TableMap::TYPE_PHPNAME, $indexType)];
$this->newness = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : StockTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : StockTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
$this->weight = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : StockTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : StockTableMap::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 ? 9 + $startcol : StockTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : StockTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -872,7 +831,7 @@ abstract class Stock implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 10; // 10 = StockTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 9; // 9 = StockTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Stock object", 0, $e);
@@ -1168,9 +1127,6 @@ abstract class Stock implements ActiveRecordInterface
if ($this->isColumnModified(StockTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID';
}
if ($this->isColumnModified(StockTableMap::COMBINATION_ID)) {
$modifiedColumns[':p' . $index++] = 'COMBINATION_ID';
}
if ($this->isColumnModified(StockTableMap::PRODUCT_ID)) {
$modifiedColumns[':p' . $index++] = 'PRODUCT_ID';
}
@@ -1209,9 +1165,6 @@ abstract class Stock implements ActiveRecordInterface
case 'ID':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case 'COMBINATION_ID':
$stmt->bindValue($identifier, $this->combination_id, PDO::PARAM_INT);
break;
case 'PRODUCT_ID':
$stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT);
break;
@@ -1302,30 +1255,27 @@ abstract class Stock implements ActiveRecordInterface
return $this->getId();
break;
case 1:
return $this->getCombinationId();
break;
case 2:
return $this->getProductId();
break;
case 3:
case 2:
return $this->getIncrease();
break;
case 4:
case 3:
return $this->getQuantity();
break;
case 5:
case 4:
return $this->getPromo();
break;
case 6:
case 5:
return $this->getNewness();
break;
case 7:
case 6:
return $this->getWeight();
break;
case 8:
case 7:
return $this->getCreatedAt();
break;
case 9:
case 8:
return $this->getUpdatedAt();
break;
default:
@@ -1358,15 +1308,14 @@ abstract class Stock implements ActiveRecordInterface
$keys = StockTableMap::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getCombinationId(),
$keys[2] => $this->getProductId(),
$keys[3] => $this->getIncrease(),
$keys[4] => $this->getQuantity(),
$keys[5] => $this->getPromo(),
$keys[6] => $this->getNewness(),
$keys[7] => $this->getWeight(),
$keys[8] => $this->getCreatedAt(),
$keys[9] => $this->getUpdatedAt(),
$keys[1] => $this->getProductId(),
$keys[2] => $this->getIncrease(),
$keys[3] => $this->getQuantity(),
$keys[4] => $this->getPromo(),
$keys[5] => $this->getNewness(),
$keys[6] => $this->getWeight(),
$keys[7] => $this->getCreatedAt(),
$keys[8] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1425,30 +1374,27 @@ abstract class Stock implements ActiveRecordInterface
$this->setId($value);
break;
case 1:
$this->setCombinationId($value);
break;
case 2:
$this->setProductId($value);
break;
case 3:
case 2:
$this->setIncrease($value);
break;
case 4:
case 3:
$this->setQuantity($value);
break;
case 5:
case 4:
$this->setPromo($value);
break;
case 6:
case 5:
$this->setNewness($value);
break;
case 7:
case 6:
$this->setWeight($value);
break;
case 8:
case 7:
$this->setCreatedAt($value);
break;
case 9:
case 8:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1476,15 +1422,14 @@ abstract class Stock implements ActiveRecordInterface
$keys = StockTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setCombinationId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setProductId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setIncrease($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setQuantity($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setPromo($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setNewness($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setWeight($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]]);
if (array_key_exists($keys[1], $arr)) $this->setProductId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setIncrease($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setQuantity($arr[$keys[3]]);
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]]);
}
/**
@@ -1497,7 +1442,6 @@ abstract class Stock implements ActiveRecordInterface
$criteria = new Criteria(StockTableMap::DATABASE_NAME);
if ($this->isColumnModified(StockTableMap::ID)) $criteria->add(StockTableMap::ID, $this->id);
if ($this->isColumnModified(StockTableMap::COMBINATION_ID)) $criteria->add(StockTableMap::COMBINATION_ID, $this->combination_id);
if ($this->isColumnModified(StockTableMap::PRODUCT_ID)) $criteria->add(StockTableMap::PRODUCT_ID, $this->product_id);
if ($this->isColumnModified(StockTableMap::INCREASE)) $criteria->add(StockTableMap::INCREASE, $this->increase);
if ($this->isColumnModified(StockTableMap::QUANTITY)) $criteria->add(StockTableMap::QUANTITY, $this->quantity);
@@ -1569,7 +1513,6 @@ abstract class Stock implements ActiveRecordInterface
*/
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setCombinationId($this->getCombinationId());
$copyObj->setProductId($this->getProductId());
$copyObj->setIncrease($this->getIncrease());
$copyObj->setQuantity($this->getQuantity());
@@ -2493,7 +2436,6 @@ abstract class Stock implements ActiveRecordInterface
public function clear()
{
$this->id = null;
$this->combination_id = null;
$this->product_id = null;
$this->increase = null;
$this->quantity = null;

View File

@@ -22,7 +22,6 @@ use Thelia\Model\Map\StockTableMap;
*
*
* @method ChildStockQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildStockQuery orderByCombinationId($order = Criteria::ASC) Order by the combination_id column
* @method ChildStockQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
* @method ChildStockQuery orderByIncrease($order = Criteria::ASC) Order by the increase column
* @method ChildStockQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column
@@ -33,7 +32,6 @@ use Thelia\Model\Map\StockTableMap;
* @method ChildStockQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildStockQuery groupById() Group by the id column
* @method ChildStockQuery groupByCombinationId() Group by the combination_id column
* @method ChildStockQuery groupByProductId() Group by the product_id column
* @method ChildStockQuery groupByIncrease() Group by the increase column
* @method ChildStockQuery groupByQuantity() Group by the quantity column
@@ -67,7 +65,6 @@ use Thelia\Model\Map\StockTableMap;
* @method ChildStock findOneOrCreate(ConnectionInterface $con = null) Return the first ChildStock matching the query, or a new ChildStock object populated from the query conditions when no match is found
*
* @method ChildStock findOneById(int $id) Return the first ChildStock filtered by the id column
* @method ChildStock findOneByCombinationId(int $combination_id) Return the first ChildStock filtered by the combination_id column
* @method ChildStock findOneByProductId(int $product_id) Return the first ChildStock filtered by the product_id column
* @method ChildStock findOneByIncrease(double $increase) Return the first ChildStock filtered by the increase column
* @method ChildStock findOneByQuantity(double $quantity) Return the first ChildStock filtered by the quantity column
@@ -78,7 +75,6 @@ use Thelia\Model\Map\StockTableMap;
* @method ChildStock findOneByUpdatedAt(string $updated_at) Return the first ChildStock filtered by the updated_at column
*
* @method array findById(int $id) Return ChildStock objects filtered by the id column
* @method array findByCombinationId(int $combination_id) Return ChildStock objects filtered by the combination_id column
* @method array findByProductId(int $product_id) Return ChildStock objects filtered by the product_id column
* @method array findByIncrease(double $increase) Return ChildStock objects filtered by the increase column
* @method array findByQuantity(double $quantity) Return ChildStock objects filtered by the quantity column
@@ -175,7 +171,7 @@ abstract class StockQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, COMBINATION_ID, PRODUCT_ID, INCREASE, QUANTITY, PROMO, NEWNESS, WEIGHT, CREATED_AT, UPDATED_AT FROM stock WHERE ID = :p0';
$sql = 'SELECT ID, PRODUCT_ID, INCREASE, QUANTITY, PROMO, NEWNESS, WEIGHT, CREATED_AT, UPDATED_AT FROM stock WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -305,47 +301,6 @@ abstract class StockQuery extends ModelCriteria
return $this->addUsingAlias(StockTableMap::ID, $id, $comparison);
}
/**
* Filter the query on the combination_id column
*
* Example usage:
* <code>
* $query->filterByCombinationId(1234); // WHERE combination_id = 1234
* $query->filterByCombinationId(array(12, 34)); // WHERE combination_id IN (12, 34)
* $query->filterByCombinationId(array('min' => 12)); // WHERE combination_id > 12
* </code>
*
* @param mixed $combinationId 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 ChildStockQuery The current query, for fluid interface
*/
public function filterByCombinationId($combinationId = null, $comparison = null)
{
if (is_array($combinationId)) {
$useMinMax = false;
if (isset($combinationId['min'])) {
$this->addUsingAlias(StockTableMap::COMBINATION_ID, $combinationId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($combinationId['max'])) {
$this->addUsingAlias(StockTableMap::COMBINATION_ID, $combinationId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(StockTableMap::COMBINATION_ID, $combinationId, $comparison);
}
/**
* Filter the query on the product_id column
*

View File

@@ -57,7 +57,7 @@ class StockTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 10;
const NUM_COLUMNS = 9;
/**
* The number of lazy-loaded columns
@@ -67,18 +67,13 @@ class StockTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 10;
const NUM_HYDRATE_COLUMNS = 9;
/**
* the column name for the ID field
*/
const ID = 'stock.ID';
/**
* the column name for the COMBINATION_ID field
*/
const COMBINATION_ID = 'stock.COMBINATION_ID';
/**
* the column name for the PRODUCT_ID field
*/
@@ -131,12 +126,12 @@ class StockTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'CombinationId', 'ProductId', 'Increase', 'Quantity', 'Promo', 'Newness', 'Weight', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'combinationId', 'productId', 'increase', 'quantity', 'promo', 'newness', 'weight', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(StockTableMap::ID, StockTableMap::COMBINATION_ID, StockTableMap::PRODUCT_ID, StockTableMap::INCREASE, StockTableMap::QUANTITY, StockTableMap::PROMO, StockTableMap::NEWNESS, StockTableMap::WEIGHT, StockTableMap::CREATED_AT, StockTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'COMBINATION_ID', 'PRODUCT_ID', 'INCREASE', 'QUANTITY', 'PROMO', 'NEWNESS', 'WEIGHT', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'combination_id', 'product_id', 'increase', 'quantity', 'promo', 'newness', 'weight', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
self::TYPE_PHPNAME => array('Id', 'ProductId', 'Increase', 'Quantity', 'Promo', 'Newness', 'Weight', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'increase', 'quantity', 'promo', 'newness', 'weight', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(StockTableMap::ID, StockTableMap::PRODUCT_ID, StockTableMap::INCREASE, StockTableMap::QUANTITY, StockTableMap::PROMO, StockTableMap::NEWNESS, StockTableMap::WEIGHT, StockTableMap::CREATED_AT, StockTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'INCREASE', 'QUANTITY', 'PROMO', 'NEWNESS', 'WEIGHT', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'product_id', 'increase', 'quantity', 'promo', 'newness', 'weight', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -146,12 +141,12 @@ class StockTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'CombinationId' => 1, 'ProductId' => 2, 'Increase' => 3, 'Quantity' => 4, 'Promo' => 5, 'Newness' => 6, 'Weight' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'combinationId' => 1, 'productId' => 2, 'increase' => 3, 'quantity' => 4, 'promo' => 5, 'newness' => 6, 'weight' => 7, 'createdAt' => 8, 'updatedAt' => 9, ),
self::TYPE_COLNAME => array(StockTableMap::ID => 0, StockTableMap::COMBINATION_ID => 1, StockTableMap::PRODUCT_ID => 2, StockTableMap::INCREASE => 3, StockTableMap::QUANTITY => 4, StockTableMap::PROMO => 5, StockTableMap::NEWNESS => 6, StockTableMap::WEIGHT => 7, StockTableMap::CREATED_AT => 8, StockTableMap::UPDATED_AT => 9, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'COMBINATION_ID' => 1, 'PRODUCT_ID' => 2, 'INCREASE' => 3, 'QUANTITY' => 4, 'PROMO' => 5, 'NEWNESS' => 6, 'WEIGHT' => 7, 'CREATED_AT' => 8, 'UPDATED_AT' => 9, ),
self::TYPE_FIELDNAME => array('id' => 0, 'combination_id' => 1, 'product_id' => 2, 'increase' => 3, 'quantity' => 4, 'promo' => 5, 'newness' => 6, 'weight' => 7, 'created_at' => 8, 'updated_at' => 9, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'Increase' => 2, 'Quantity' => 3, 'Promo' => 4, 'Newness' => 5, 'Weight' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'increase' => 2, 'quantity' => 3, 'promo' => 4, 'newness' => 5, 'weight' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
self::TYPE_COLNAME => array(StockTableMap::ID => 0, StockTableMap::PRODUCT_ID => 1, StockTableMap::INCREASE => 2, StockTableMap::QUANTITY => 3, StockTableMap::PROMO => 4, StockTableMap::NEWNESS => 5, StockTableMap::WEIGHT => 6, StockTableMap::CREATED_AT => 7, StockTableMap::UPDATED_AT => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'INCREASE' => 2, 'QUANTITY' => 3, 'PROMO' => 4, 'NEWNESS' => 5, 'WEIGHT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'increase' => 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, )
);
/**
@@ -171,7 +166,6 @@ class StockTableMap extends TableMap
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('COMBINATION_ID', 'CombinationId', 'INTEGER', false, null, null);
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null);
$this->addColumn('INCREASE', 'Increase', 'FLOAT', false, null, null);
$this->addColumn('QUANTITY', 'Quantity', 'FLOAT', true, null, null);
@@ -345,7 +339,6 @@ class StockTableMap extends TableMap
{
if (null === $alias) {
$criteria->addSelectColumn(StockTableMap::ID);
$criteria->addSelectColumn(StockTableMap::COMBINATION_ID);
$criteria->addSelectColumn(StockTableMap::PRODUCT_ID);
$criteria->addSelectColumn(StockTableMap::INCREASE);
$criteria->addSelectColumn(StockTableMap::QUANTITY);
@@ -356,7 +349,6 @@ class StockTableMap extends TableMap
$criteria->addSelectColumn(StockTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.COMBINATION_ID');
$criteria->addSelectColumn($alias . '.PRODUCT_ID');
$criteria->addSelectColumn($alias . '.INCREASE');
$criteria->addSelectColumn($alias . '.QUANTITY');

View File

@@ -350,7 +350,6 @@ DROP TABLE IF EXISTS `stock`;
CREATE TABLE `stock`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`combination_id` INTEGER,
`product_id` INTEGER NOT NULL,
`increase` FLOAT,
`quantity` FLOAT NOT NULL,

View File

@@ -261,7 +261,6 @@
</table>
<table name="stock" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="combination_id" type="INTEGER" />
<column name="product_id" required="true" type="INTEGER" />
<column name="increase" type="FLOAT" />
<column name="quantity" required="true" type="FLOAT" />