Merge branch 'master' of https://github.com/thelia/thelia
Conflicts: core/lib/Thelia/Model/Product.php
This commit is contained in:
@@ -857,7 +857,7 @@ abstract class ProductQuery extends ModelCriteria
|
||||
*
|
||||
* @return ChildProductQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinTemplate($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Template');
|
||||
@@ -892,7 +892,7 @@ abstract class ProductQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinTemplate($relationAlias, $joinType)
|
||||
|
||||
@@ -77,6 +77,13 @@ abstract class Tax implements ActiveRecordInterface
|
||||
*/
|
||||
protected $serialized_requirements;
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -135,11 +142,24 @@ abstract class Tax implements ActiveRecordInterface
|
||||
*/
|
||||
protected $taxI18nsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Applies default values to this object.
|
||||
* This method should be called from the object's constructor (or
|
||||
* equivalent initialization method).
|
||||
* @see __construct()
|
||||
*/
|
||||
public function applyDefaultValues()
|
||||
{
|
||||
$this->is_default = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes internal state of Thelia\Model\Base\Tax object.
|
||||
* @see applyDefaults()
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->applyDefaultValues();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -422,6 +442,17 @@ abstract class Tax implements ActiveRecordInterface
|
||||
return $this->serialized_requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [is_default] column value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIsDefault()
|
||||
{
|
||||
|
||||
return $this->is_default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
@@ -525,6 +556,35 @@ abstract class Tax implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setSerializedRequirements()
|
||||
|
||||
/**
|
||||
* 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\Tax 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[] = TaxTableMap::IS_DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setIsDefault()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
@@ -577,6 +637,10 @@ abstract class Tax implements ActiveRecordInterface
|
||||
*/
|
||||
public function hasOnlyDefaultValues()
|
||||
{
|
||||
if ($this->is_default !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, everything was equal, so return TRUE
|
||||
return true;
|
||||
} // hasOnlyDefaultValues()
|
||||
@@ -613,13 +677,16 @@ abstract class Tax implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxTableMap::translateFieldName('SerializedRequirements', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->serialized_requirements = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxTableMap::translateFieldName('IsDefault', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_default = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : TaxTableMap::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 ? 4 + $startcol : TaxTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : TaxTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -632,7 +699,7 @@ abstract class Tax implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 5; // 5 = TaxTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 6; // 6 = TaxTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Tax object", 0, $e);
|
||||
@@ -899,6 +966,9 @@ abstract class Tax implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(TaxTableMap::SERIALIZED_REQUIREMENTS)) {
|
||||
$modifiedColumns[':p' . $index++] = 'SERIALIZED_REQUIREMENTS';
|
||||
}
|
||||
if ($this->isColumnModified(TaxTableMap::IS_DEFAULT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'IS_DEFAULT';
|
||||
}
|
||||
if ($this->isColumnModified(TaxTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
@@ -925,6 +995,9 @@ abstract class Tax implements ActiveRecordInterface
|
||||
case 'SERIALIZED_REQUIREMENTS':
|
||||
$stmt->bindValue($identifier, $this->serialized_requirements, 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;
|
||||
@@ -1003,9 +1076,12 @@ abstract class Tax implements ActiveRecordInterface
|
||||
return $this->getSerializedRequirements();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getCreatedAt();
|
||||
return $this->getIsDefault();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1040,8 +1116,9 @@ abstract class Tax implements ActiveRecordInterface
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getType(),
|
||||
$keys[2] => $this->getSerializedRequirements(),
|
||||
$keys[3] => $this->getCreatedAt(),
|
||||
$keys[4] => $this->getUpdatedAt(),
|
||||
$keys[3] => $this->getIsDefault(),
|
||||
$keys[4] => $this->getCreatedAt(),
|
||||
$keys[5] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1100,9 +1177,12 @@ abstract class Tax implements ActiveRecordInterface
|
||||
$this->setSerializedRequirements($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setCreatedAt($value);
|
||||
$this->setIsDefault($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1132,8 +1212,9 @@ abstract class Tax implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setType($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setSerializedRequirements($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setIsDefault($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]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1148,6 +1229,7 @@ abstract class Tax implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(TaxTableMap::ID)) $criteria->add(TaxTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(TaxTableMap::TYPE)) $criteria->add(TaxTableMap::TYPE, $this->type);
|
||||
if ($this->isColumnModified(TaxTableMap::SERIALIZED_REQUIREMENTS)) $criteria->add(TaxTableMap::SERIALIZED_REQUIREMENTS, $this->serialized_requirements);
|
||||
if ($this->isColumnModified(TaxTableMap::IS_DEFAULT)) $criteria->add(TaxTableMap::IS_DEFAULT, $this->is_default);
|
||||
if ($this->isColumnModified(TaxTableMap::CREATED_AT)) $criteria->add(TaxTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(TaxTableMap::UPDATED_AT)) $criteria->add(TaxTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
@@ -1215,6 +1297,7 @@ abstract class Tax implements ActiveRecordInterface
|
||||
{
|
||||
$copyObj->setType($this->getType());
|
||||
$copyObj->setSerializedRequirements($this->getSerializedRequirements());
|
||||
$copyObj->setIsDefault($this->getIsDefault());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
|
||||
@@ -1788,10 +1871,12 @@ abstract class Tax implements ActiveRecordInterface
|
||||
$this->id = null;
|
||||
$this->type = null;
|
||||
$this->serialized_requirements = null;
|
||||
$this->is_default = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->clearAllReferences();
|
||||
$this->applyDefaultValues();
|
||||
$this->resetModified();
|
||||
$this->setNew(true);
|
||||
$this->setDeleted(false);
|
||||
|
||||
@@ -25,12 +25,14 @@ use Thelia\Model\Map\TaxTableMap;
|
||||
* @method ChildTaxQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildTaxQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||
* @method ChildTaxQuery orderBySerializedRequirements($order = Criteria::ASC) Order by the serialized_requirements column
|
||||
* @method ChildTaxQuery orderByIsDefault($order = Criteria::ASC) Order by the is_default column
|
||||
* @method ChildTaxQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildTaxQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildTaxQuery groupById() Group by the id column
|
||||
* @method ChildTaxQuery groupByType() Group by the type column
|
||||
* @method ChildTaxQuery groupBySerializedRequirements() Group by the serialized_requirements column
|
||||
* @method ChildTaxQuery groupByIsDefault() Group by the is_default column
|
||||
* @method ChildTaxQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildTaxQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
@@ -52,12 +54,14 @@ use Thelia\Model\Map\TaxTableMap;
|
||||
* @method ChildTax findOneById(int $id) Return the first ChildTax filtered by the id column
|
||||
* @method ChildTax findOneByType(string $type) Return the first ChildTax filtered by the type column
|
||||
* @method ChildTax findOneBySerializedRequirements(string $serialized_requirements) Return the first ChildTax filtered by the serialized_requirements column
|
||||
* @method ChildTax findOneByIsDefault(boolean $is_default) Return the first ChildTax filtered by the is_default column
|
||||
* @method ChildTax findOneByCreatedAt(string $created_at) Return the first ChildTax filtered by the created_at column
|
||||
* @method ChildTax findOneByUpdatedAt(string $updated_at) Return the first ChildTax filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildTax objects filtered by the id column
|
||||
* @method array findByType(string $type) Return ChildTax objects filtered by the type column
|
||||
* @method array findBySerializedRequirements(string $serialized_requirements) Return ChildTax objects filtered by the serialized_requirements column
|
||||
* @method array findByIsDefault(boolean $is_default) Return ChildTax objects filtered by the is_default column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildTax objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildTax objects filtered by the updated_at column
|
||||
*
|
||||
@@ -148,7 +152,7 @@ abstract class TaxQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, TYPE, SERIALIZED_REQUIREMENTS, CREATED_AT, UPDATED_AT FROM tax WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, TYPE, SERIALIZED_REQUIREMENTS, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM tax WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -336,6 +340,33 @@ abstract class TaxQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(TaxTableMap::SERIALIZED_REQUIREMENTS, $serializedRequirements, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the is_default column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByIsDefault(true); // WHERE is_default = true
|
||||
* $query->filterByIsDefault('yes'); // WHERE is_default = true
|
||||
* </code>
|
||||
*
|
||||
* @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 ChildTaxQuery 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(TaxTableMap::IS_DEFAULT, $isDefault, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
|
||||
@@ -864,9 +864,10 @@ abstract class Template implements ActiveRecordInterface
|
||||
|
||||
if ($this->productsScheduledForDeletion !== null) {
|
||||
if (!$this->productsScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\ProductQuery::create()
|
||||
->filterByPrimaryKeys($this->productsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
foreach ($this->productsScheduledForDeletion as $product) {
|
||||
// need to save related object because we set the relation to null
|
||||
$product->save($con);
|
||||
}
|
||||
$this->productsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
@@ -1553,7 +1554,7 @@ abstract class Template implements ActiveRecordInterface
|
||||
$this->productsScheduledForDeletion = clone $this->collProducts;
|
||||
$this->productsScheduledForDeletion->clear();
|
||||
}
|
||||
$this->productsScheduledForDeletion[]= clone $product;
|
||||
$this->productsScheduledForDeletion[]= $product;
|
||||
$product->setTemplate(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ abstract class TemplateQuery extends ModelCriteria
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Product');
|
||||
@@ -430,7 +430,7 @@ abstract class TemplateQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useProductQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinProduct($relationAlias, $joinType)
|
||||
|
||||
Reference in New Issue
Block a user