This commit is contained in:
Etienne Roudeix
2013-09-12 11:56:00 +02:00
parent b698d1aada
commit d5004071c9
5 changed files with 149 additions and 44 deletions

View File

@@ -75,6 +75,12 @@ abstract class ProductSaleElements implements ActiveRecordInterface
*/
protected $product_id;
/**
* The value for the ref field.
* @var string
*/
protected $ref;
/**
* The value for the quantity field.
* @var double
@@ -452,6 +458,17 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return $this->product_id;
}
/**
* Get the [ref] column value.
*
* @return string
*/
public function getRef()
{
return $this->ref;
}
/**
* Get the [quantity] column value.
*
@@ -582,6 +599,27 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return $this;
} // setProductId()
/**
* Set the value of [ref] column.
*
* @param string $v new value
* @return \Thelia\Model\ProductSaleElements The current object (for fluent API support)
*/
public function setRef($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->ref !== $v) {
$this->ref = $v;
$this->modifiedColumns[] = ProductSaleElementsTableMap::REF;
}
return $this;
} // setRef()
/**
* Set the value of [quantity] column.
*
@@ -759,25 +797,28 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductSaleElementsTableMap::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)];
$this->product_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductSaleElementsTableMap::translateFieldName('Quantity', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductSaleElementsTableMap::translateFieldName('Ref', TableMap::TYPE_PHPNAME, $indexType)];
$this->ref = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductSaleElementsTableMap::translateFieldName('Quantity', TableMap::TYPE_PHPNAME, $indexType)];
$this->quantity = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductSaleElementsTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductSaleElementsTableMap::translateFieldName('Promo', TableMap::TYPE_PHPNAME, $indexType)];
$this->promo = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductSaleElementsTableMap::translateFieldName('Newness', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductSaleElementsTableMap::translateFieldName('Newness', TableMap::TYPE_PHPNAME, $indexType)];
$this->newness = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductSaleElementsTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
$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 ? 6 + $startcol : ProductSaleElementsTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $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 ? 7 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductSaleElementsTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -790,7 +831,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 8; // 8 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 9; // 9 = ProductSaleElementsTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductSaleElements object", 0, $e);
@@ -1089,6 +1130,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
if ($this->isColumnModified(ProductSaleElementsTableMap::PRODUCT_ID)) {
$modifiedColumns[':p' . $index++] = 'PRODUCT_ID';
}
if ($this->isColumnModified(ProductSaleElementsTableMap::REF)) {
$modifiedColumns[':p' . $index++] = 'REF';
}
if ($this->isColumnModified(ProductSaleElementsTableMap::QUANTITY)) {
$modifiedColumns[':p' . $index++] = 'QUANTITY';
}
@@ -1124,6 +1168,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface
case 'PRODUCT_ID':
$stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT);
break;
case 'REF':
$stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
break;
case 'QUANTITY':
$stmt->bindValue($identifier, $this->quantity, PDO::PARAM_STR);
break;
@@ -1211,21 +1258,24 @@ abstract class ProductSaleElements implements ActiveRecordInterface
return $this->getProductId();
break;
case 2:
return $this->getQuantity();
return $this->getRef();
break;
case 3:
return $this->getPromo();
return $this->getQuantity();
break;
case 4:
return $this->getNewness();
return $this->getPromo();
break;
case 5:
return $this->getWeight();
return $this->getNewness();
break;
case 6:
return $this->getCreatedAt();
return $this->getWeight();
break;
case 7:
return $this->getCreatedAt();
break;
case 8:
return $this->getUpdatedAt();
break;
default:
@@ -1259,12 +1309,13 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getProductId(),
$keys[2] => $this->getQuantity(),
$keys[3] => $this->getPromo(),
$keys[4] => $this->getNewness(),
$keys[5] => $this->getWeight(),
$keys[6] => $this->getCreatedAt(),
$keys[7] => $this->getUpdatedAt(),
$keys[2] => $this->getRef(),
$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)
@@ -1326,21 +1377,24 @@ abstract class ProductSaleElements implements ActiveRecordInterface
$this->setProductId($value);
break;
case 2:
$this->setQuantity($value);
$this->setRef($value);
break;
case 3:
$this->setPromo($value);
$this->setQuantity($value);
break;
case 4:
$this->setNewness($value);
$this->setPromo($value);
break;
case 5:
$this->setWeight($value);
$this->setNewness($value);
break;
case 6:
$this->setCreatedAt($value);
$this->setWeight($value);
break;
case 7:
$this->setCreatedAt($value);
break;
case 8:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1369,12 +1423,13 @@ abstract class ProductSaleElements implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setProductId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setQuantity($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setPromo($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setNewness($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setWeight($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
if (array_key_exists($keys[2], $arr)) $this->setRef($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]]);
}
/**
@@ -1388,6 +1443,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
if ($this->isColumnModified(ProductSaleElementsTableMap::ID)) $criteria->add(ProductSaleElementsTableMap::ID, $this->id);
if ($this->isColumnModified(ProductSaleElementsTableMap::PRODUCT_ID)) $criteria->add(ProductSaleElementsTableMap::PRODUCT_ID, $this->product_id);
if ($this->isColumnModified(ProductSaleElementsTableMap::REF)) $criteria->add(ProductSaleElementsTableMap::REF, $this->ref);
if ($this->isColumnModified(ProductSaleElementsTableMap::QUANTITY)) $criteria->add(ProductSaleElementsTableMap::QUANTITY, $this->quantity);
if ($this->isColumnModified(ProductSaleElementsTableMap::PROMO)) $criteria->add(ProductSaleElementsTableMap::PROMO, $this->promo);
if ($this->isColumnModified(ProductSaleElementsTableMap::NEWNESS)) $criteria->add(ProductSaleElementsTableMap::NEWNESS, $this->newness);
@@ -1458,6 +1514,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setProductId($this->getProductId());
$copyObj->setRef($this->getRef());
$copyObj->setQuantity($this->getQuantity());
$copyObj->setPromo($this->getPromo());
$copyObj->setNewness($this->getNewness());
@@ -2383,6 +2440,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface
{
$this->id = null;
$this->product_id = null;
$this->ref = null;
$this->quantity = null;
$this->promo = null;
$this->newness = null;

View File

@@ -23,6 +23,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
*
* @method ChildProductSaleElementsQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildProductSaleElementsQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
* @method ChildProductSaleElementsQuery orderByRef($order = Criteria::ASC) Order by the ref column
* @method ChildProductSaleElementsQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column
* @method ChildProductSaleElementsQuery orderByPromo($order = Criteria::ASC) Order by the promo column
* @method ChildProductSaleElementsQuery orderByNewness($order = Criteria::ASC) Order by the newness column
@@ -32,6 +33,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
*
* @method ChildProductSaleElementsQuery groupById() Group by the id column
* @method ChildProductSaleElementsQuery groupByProductId() Group by the product_id column
* @method ChildProductSaleElementsQuery groupByRef() Group by the ref column
* @method ChildProductSaleElementsQuery groupByQuantity() Group by the quantity column
* @method ChildProductSaleElementsQuery groupByPromo() Group by the promo column
* @method ChildProductSaleElementsQuery groupByNewness() Group by the newness column
@@ -64,6 +66,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
*
* @method ChildProductSaleElements findOneById(int $id) Return the first ChildProductSaleElements filtered by the id column
* @method ChildProductSaleElements findOneByProductId(int $product_id) Return the first ChildProductSaleElements filtered by the product_id column
* @method ChildProductSaleElements findOneByRef(string $ref) Return the first ChildProductSaleElements filtered by the ref column
* @method ChildProductSaleElements findOneByQuantity(double $quantity) Return the first ChildProductSaleElements filtered by the quantity column
* @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
@@ -73,6 +76,7 @@ use Thelia\Model\Map\ProductSaleElementsTableMap;
*
* @method array findById(int $id) Return ChildProductSaleElements objects filtered by the id column
* @method array findByProductId(int $product_id) Return ChildProductSaleElements objects filtered by the product_id column
* @method array findByRef(string $ref) Return ChildProductSaleElements objects filtered by the ref column
* @method array findByQuantity(double $quantity) Return ChildProductSaleElements objects filtered by the quantity column
* @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
@@ -167,7 +171,7 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, PRODUCT_ID, 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, CREATED_AT, UPDATED_AT FROM product_sale_elements WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -340,6 +344,35 @@ abstract class ProductSaleElementsQuery extends ModelCriteria
return $this->addUsingAlias(ProductSaleElementsTableMap::PRODUCT_ID, $productId, $comparison);
}
/**
* Filter the query on the ref column
*
* Example usage:
* <code>
* $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
* $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
* </code>
*
* @param string $ref The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildProductSaleElementsQuery The current query, for fluid interface
*/
public function filterByRef($ref = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($ref)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $ref)) {
$ref = str_replace('*', '%', $ref);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ProductSaleElementsTableMap::REF, $ref, $comparison);
}
/**
* Filter the query on the quantity column
*