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

@@ -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
*