product price
This commit is contained in:
@@ -2276,7 +2276,10 @@ abstract class Currency implements ActiveRecordInterface
|
||||
$productPricesToDelete = $this->getProductPrices(new Criteria(), $con)->diff($productPrices);
|
||||
|
||||
|
||||
$this->productPricesScheduledForDeletion = $productPricesToDelete;
|
||||
//since at least one column in the foreign key is at the same time a PK
|
||||
//we can not just set a PK to NULL in the lines below. We have to store
|
||||
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
|
||||
$this->productPricesScheduledForDeletion = clone $productPricesToDelete;
|
||||
|
||||
foreach ($productPricesToDelete as $productPriceRemoved) {
|
||||
$productPriceRemoved->setCurrency(null);
|
||||
|
||||
@@ -58,12 +58,6 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
*/
|
||||
protected $virtualColumns = array();
|
||||
|
||||
/**
|
||||
* The value for the id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the product_sale_elements_id field.
|
||||
* @var int
|
||||
@@ -372,17 +366,6 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
return array_keys(get_object_vars($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [product_sale_elements_id] column value.
|
||||
*
|
||||
@@ -467,27 +450,6 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return \Thelia\Model\ProductPrice The current object (for fluent API support)
|
||||
*/
|
||||
public function setId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->id !== $v) {
|
||||
$this->id = $v;
|
||||
$this->modifiedColumns[] = ProductPriceTableMap::ID;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setId()
|
||||
|
||||
/**
|
||||
* Set the value of [product_sale_elements_id] column.
|
||||
*
|
||||
@@ -659,28 +621,25 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
try {
|
||||
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProductPriceTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductPriceTableMap::translateFieldName('ProductSaleElementsId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProductPriceTableMap::translateFieldName('ProductSaleElementsId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->product_sale_elements_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductPriceTableMap::translateFieldName('CurrencyId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductPriceTableMap::translateFieldName('CurrencyId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->currency_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductPriceTableMap::translateFieldName('Price', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductPriceTableMap::translateFieldName('Price', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->price = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductPriceTableMap::translateFieldName('PromoPrice', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductPriceTableMap::translateFieldName('PromoPrice', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->promo_price = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductPriceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductPriceTableMap::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 ? 6 + $startcol : ProductPriceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductPriceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -693,7 +652,7 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 7; // 7 = ProductPriceTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 6; // 6 = ProductPriceTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\ProductPrice object", 0, $e);
|
||||
@@ -934,15 +893,8 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$modifiedColumns = array();
|
||||
$index = 0;
|
||||
|
||||
$this->modifiedColumns[] = ProductPriceTableMap::ID;
|
||||
if (null !== $this->id) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProductPriceTableMap::ID . ')');
|
||||
}
|
||||
|
||||
// check the columns in natural order for more readable SQL queries
|
||||
if ($this->isColumnModified(ProductPriceTableMap::ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'ID';
|
||||
}
|
||||
if ($this->isColumnModified(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'PRODUCT_SALE_ELEMENTS_ID';
|
||||
}
|
||||
@@ -972,9 +924,6 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$stmt = $con->prepare($sql);
|
||||
foreach ($modifiedColumns as $identifier => $columnName) {
|
||||
switch ($columnName) {
|
||||
case 'ID':
|
||||
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'PRODUCT_SALE_ELEMENTS_ID':
|
||||
$stmt->bindValue($identifier, $this->product_sale_elements_id, PDO::PARAM_INT);
|
||||
break;
|
||||
@@ -1001,13 +950,6 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
|
||||
}
|
||||
|
||||
try {
|
||||
$pk = $con->lastInsertId();
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException('Unable to get autoincrement id.', 0, $e);
|
||||
}
|
||||
$this->setId($pk);
|
||||
|
||||
$this->setNew(false);
|
||||
}
|
||||
|
||||
@@ -1056,24 +998,21 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
{
|
||||
switch ($pos) {
|
||||
case 0:
|
||||
return $this->getId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getProductSaleElementsId();
|
||||
break;
|
||||
case 2:
|
||||
case 1:
|
||||
return $this->getCurrencyId();
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
return $this->getPrice();
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
return $this->getPromoPrice();
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1099,19 +1038,18 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
*/
|
||||
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
|
||||
{
|
||||
if (isset($alreadyDumpedObjects['ProductPrice'][$this->getPrimaryKey()])) {
|
||||
if (isset($alreadyDumpedObjects['ProductPrice'][serialize($this->getPrimaryKey())])) {
|
||||
return '*RECURSION*';
|
||||
}
|
||||
$alreadyDumpedObjects['ProductPrice'][$this->getPrimaryKey()] = true;
|
||||
$alreadyDumpedObjects['ProductPrice'][serialize($this->getPrimaryKey())] = true;
|
||||
$keys = ProductPriceTableMap::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getProductSaleElementsId(),
|
||||
$keys[2] => $this->getCurrencyId(),
|
||||
$keys[3] => $this->getPrice(),
|
||||
$keys[4] => $this->getPromoPrice(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
$keys[0] => $this->getProductSaleElementsId(),
|
||||
$keys[1] => $this->getCurrencyId(),
|
||||
$keys[2] => $this->getPrice(),
|
||||
$keys[3] => $this->getPromoPrice(),
|
||||
$keys[4] => $this->getCreatedAt(),
|
||||
$keys[5] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1161,24 +1099,21 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
{
|
||||
switch ($pos) {
|
||||
case 0:
|
||||
$this->setId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setProductSaleElementsId($value);
|
||||
break;
|
||||
case 2:
|
||||
case 1:
|
||||
$this->setCurrencyId($value);
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
$this->setPrice($value);
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
$this->setPromoPrice($value);
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 6:
|
||||
case 5:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1205,13 +1140,12 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
{
|
||||
$keys = ProductPriceTableMap::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setProductSaleElementsId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setCurrencyId($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setPrice($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setPromoPrice($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[0], $arr)) $this->setProductSaleElementsId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setCurrencyId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setPrice($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setPromoPrice($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1223,7 +1157,6 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
{
|
||||
$criteria = new Criteria(ProductPriceTableMap::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(ProductPriceTableMap::ID)) $criteria->add(ProductPriceTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID)) $criteria->add(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, $this->product_sale_elements_id);
|
||||
if ($this->isColumnModified(ProductPriceTableMap::CURRENCY_ID)) $criteria->add(ProductPriceTableMap::CURRENCY_ID, $this->currency_id);
|
||||
if ($this->isColumnModified(ProductPriceTableMap::PRICE)) $criteria->add(ProductPriceTableMap::PRICE, $this->price);
|
||||
@@ -1245,29 +1178,36 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
public function buildPkeyCriteria()
|
||||
{
|
||||
$criteria = new Criteria(ProductPriceTableMap::DATABASE_NAME);
|
||||
$criteria->add(ProductPriceTableMap::ID, $this->id);
|
||||
$criteria->add(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, $this->product_sale_elements_id);
|
||||
$criteria->add(ProductPriceTableMap::CURRENCY_ID, $this->currency_id);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the primary key for this object (row).
|
||||
* @return int
|
||||
* Returns the composite primary key for this object.
|
||||
* The array elements will be in same order as specified in XML.
|
||||
* @return array
|
||||
*/
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->getId();
|
||||
$pks = array();
|
||||
$pks[0] = $this->getProductSaleElementsId();
|
||||
$pks[1] = $this->getCurrencyId();
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic method to set the primary key (id column).
|
||||
* Set the [composite] primary key.
|
||||
*
|
||||
* @param int $key Primary key.
|
||||
* @param array $keys The elements of the composite key (order must match the order in XML file).
|
||||
* @return void
|
||||
*/
|
||||
public function setPrimaryKey($key)
|
||||
public function setPrimaryKey($keys)
|
||||
{
|
||||
$this->setId($key);
|
||||
$this->setProductSaleElementsId($keys[0]);
|
||||
$this->setCurrencyId($keys[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1277,7 +1217,7 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
public function isPrimaryKeyNull()
|
||||
{
|
||||
|
||||
return null === $this->getId();
|
||||
return (null === $this->getProductSaleElementsId()) && (null === $this->getCurrencyId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1301,7 +1241,6 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
if ($makeNew) {
|
||||
$copyObj->setNew(true);
|
||||
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1434,7 +1373,6 @@ abstract class ProductPrice implements ActiveRecordInterface
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->product_sale_elements_id = null;
|
||||
$this->currency_id = null;
|
||||
$this->price = null;
|
||||
|
||||
@@ -21,7 +21,6 @@ use Thelia\Model\Map\ProductPriceTableMap;
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildProductPriceQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildProductPriceQuery orderByProductSaleElementsId($order = Criteria::ASC) Order by the product_sale_elements_id column
|
||||
* @method ChildProductPriceQuery orderByCurrencyId($order = Criteria::ASC) Order by the currency_id column
|
||||
* @method ChildProductPriceQuery orderByPrice($order = Criteria::ASC) Order by the price column
|
||||
@@ -29,7 +28,6 @@ use Thelia\Model\Map\ProductPriceTableMap;
|
||||
* @method ChildProductPriceQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildProductPriceQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildProductPriceQuery groupById() Group by the id column
|
||||
* @method ChildProductPriceQuery groupByProductSaleElementsId() Group by the product_sale_elements_id column
|
||||
* @method ChildProductPriceQuery groupByCurrencyId() Group by the currency_id column
|
||||
* @method ChildProductPriceQuery groupByPrice() Group by the price column
|
||||
@@ -52,7 +50,6 @@ use Thelia\Model\Map\ProductPriceTableMap;
|
||||
* @method ChildProductPrice findOne(ConnectionInterface $con = null) Return the first ChildProductPrice matching the query
|
||||
* @method ChildProductPrice findOneOrCreate(ConnectionInterface $con = null) Return the first ChildProductPrice matching the query, or a new ChildProductPrice object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildProductPrice findOneById(int $id) Return the first ChildProductPrice filtered by the id column
|
||||
* @method ChildProductPrice findOneByProductSaleElementsId(int $product_sale_elements_id) Return the first ChildProductPrice filtered by the product_sale_elements_id column
|
||||
* @method ChildProductPrice findOneByCurrencyId(int $currency_id) Return the first ChildProductPrice filtered by the currency_id column
|
||||
* @method ChildProductPrice findOneByPrice(double $price) Return the first ChildProductPrice filtered by the price column
|
||||
@@ -60,7 +57,6 @@ use Thelia\Model\Map\ProductPriceTableMap;
|
||||
* @method ChildProductPrice findOneByCreatedAt(string $created_at) Return the first ChildProductPrice filtered by the created_at column
|
||||
* @method ChildProductPrice findOneByUpdatedAt(string $updated_at) Return the first ChildProductPrice filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildProductPrice objects filtered by the id column
|
||||
* @method array findByProductSaleElementsId(int $product_sale_elements_id) Return ChildProductPrice objects filtered by the product_sale_elements_id column
|
||||
* @method array findByCurrencyId(int $currency_id) Return ChildProductPrice objects filtered by the currency_id column
|
||||
* @method array findByPrice(double $price) Return ChildProductPrice objects filtered by the price column
|
||||
@@ -114,10 +110,10 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
* Go fast if the query is untouched.
|
||||
*
|
||||
* <code>
|
||||
* $obj = $c->findPk(12, $con);
|
||||
* $obj = $c->findPk(array(12, 34), $con);
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $key Primary key to use for the query
|
||||
* @param array[$product_sale_elements_id, $currency_id] $key Primary key to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
*
|
||||
* @return ChildProductPrice|array|mixed the result, formatted by the current formatter
|
||||
@@ -127,7 +123,7 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ProductPriceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
if ((null !== ($obj = ProductPriceTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
@@ -155,10 +151,11 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, CREATED_AT, UPDATED_AT FROM product_price WHERE ID = :p0';
|
||||
$sql = 'SELECT PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, CREATED_AT, UPDATED_AT FROM product_price WHERE PRODUCT_SALE_ELEMENTS_ID = :p0 AND CURRENCY_ID = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
} catch (Exception $e) {
|
||||
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||
@@ -168,7 +165,7 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
|
||||
$obj = new ChildProductPrice();
|
||||
$obj->hydrate($row);
|
||||
ProductPriceTableMap::addInstanceToPool($obj, (string) $key);
|
||||
ProductPriceTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -197,7 +194,7 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
/**
|
||||
* Find objects by primary key
|
||||
* <code>
|
||||
* $objs = $c->findPks(array(12, 56, 832), $con);
|
||||
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||
* </code>
|
||||
* @param array $keys Primary keys to use for the query
|
||||
* @param ConnectionInterface $con an optional connection object
|
||||
@@ -227,8 +224,10 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
$this->addUsingAlias(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, $key[0], Criteria::EQUAL);
|
||||
$this->addUsingAlias(ProductPriceTableMap::CURRENCY_ID, $key[1], Criteria::EQUAL);
|
||||
|
||||
return $this->addUsingAlias(ProductPriceTableMap::ID, $key, Criteria::EQUAL);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,49 +239,17 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ProductPriceTableMap::ID, $keys, Criteria::IN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterById(1234); // WHERE id = 1234
|
||||
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $id 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 ChildProductPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterById($id = null, $comparison = null)
|
||||
{
|
||||
if (is_array($id)) {
|
||||
$useMinMax = false;
|
||||
if (isset($id['min'])) {
|
||||
$this->addUsingAlias(ProductPriceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ProductPriceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
if (empty($keys)) {
|
||||
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$cton0 = $this->getNewCriterion(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, $key[0], Criteria::EQUAL);
|
||||
$cton1 = $this->getNewCriterion(ProductPriceTableMap::CURRENCY_ID, $key[1], Criteria::EQUAL);
|
||||
$cton0->addAnd($cton1);
|
||||
$this->addOr($cton0);
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ProductPriceTableMap::ID, $id, $comparison);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -699,7 +666,9 @@ abstract class ProductPriceQuery extends ModelCriteria
|
||||
public function prune($productPrice = null)
|
||||
{
|
||||
if ($productPrice) {
|
||||
$this->addUsingAlias(ProductPriceTableMap::ID, $productPrice->getId(), Criteria::NOT_EQUAL);
|
||||
$this->addCond('pruneCond0', $this->getAliasedColName(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID), $productPrice->getProductSaleElementsId(), Criteria::NOT_EQUAL);
|
||||
$this->addCond('pruneCond1', $this->getAliasedColName(ProductPriceTableMap::CURRENCY_ID), $productPrice->getCurrencyId(), Criteria::NOT_EQUAL);
|
||||
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -2248,7 +2248,10 @@ abstract class ProductSaleElements implements ActiveRecordInterface
|
||||
$productPricesToDelete = $this->getProductPrices(new Criteria(), $con)->diff($productPrices);
|
||||
|
||||
|
||||
$this->productPricesScheduledForDeletion = $productPricesToDelete;
|
||||
//since at least one column in the foreign key is at the same time a PK
|
||||
//we can not just set a PK to NULL in the lines below. We have to store
|
||||
//a backup of all values, so we are able to manipulate these items based on the onDelete value later.
|
||||
$this->productPricesScheduledForDeletion = clone $productPricesToDelete;
|
||||
|
||||
foreach ($productPricesToDelete as $productPriceRemoved) {
|
||||
$productPriceRemoved->setProductSaleElements(null);
|
||||
|
||||
Reference in New Issue
Block a user