From 7d766c68ffdaf21d4c4b1e0b3543777a86f01a1c Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 30 Apr 2013 14:56:23 +0200 Subject: [PATCH] delete table before inserting faker data --- core/lib/Thelia/Model/map/ProductTableMap.php | 2 +- .../Model/map/ProductVersionTableMap.php | 2 +- core/lib/Thelia/Model/om/BaseProduct.php | 54 +++++++++---------- core/lib/Thelia/Model/om/BaseProductPeer.php | 28 +++++----- core/lib/Thelia/Model/om/BaseProductQuery.php | 36 ++++++------- .../Thelia/Model/om/BaseProductVersion.php | 50 ++++++++--------- .../Model/om/BaseProductVersionPeer.php | 28 +++++----- .../Model/om/BaseProductVersionQuery.php | 36 ++++++------- install/faker.php | 13 ++++- local/config/schema.xml | 2 +- 10 files changed, 130 insertions(+), 121 deletions(-) diff --git a/core/lib/Thelia/Model/map/ProductTableMap.php b/core/lib/Thelia/Model/map/ProductTableMap.php index dce837c5b..6ec4aa4e1 100644 --- a/core/lib/Thelia/Model/map/ProductTableMap.php +++ b/core/lib/Thelia/Model/map/ProductTableMap.php @@ -50,7 +50,7 @@ class ProductTableMap extends TableMap $this->addColumn('ecotax', 'Ecotax', 'FLOAT', false, null, null); $this->addColumn('newness', 'Newness', 'TINYINT', false, null, 0); $this->addColumn('promo', 'Promo', 'TINYINT', false, null, 0); - $this->addColumn('stock', 'Stock', 'INTEGER', false, null, 0); + $this->addColumn('quantity', 'Quantity', 'INTEGER', false, null, 0); $this->addColumn('visible', 'Visible', 'TINYINT', true, null, 0); $this->addColumn('weight', 'Weight', 'FLOAT', false, null, null); $this->addColumn('position', 'Position', 'INTEGER', true, null, null); diff --git a/core/lib/Thelia/Model/map/ProductVersionTableMap.php b/core/lib/Thelia/Model/map/ProductVersionTableMap.php index 67c459197..490fb28c1 100644 --- a/core/lib/Thelia/Model/map/ProductVersionTableMap.php +++ b/core/lib/Thelia/Model/map/ProductVersionTableMap.php @@ -50,7 +50,7 @@ class ProductVersionTableMap extends TableMap $this->addColumn('ecotax', 'Ecotax', 'FLOAT', false, null, null); $this->addColumn('newness', 'Newness', 'TINYINT', false, null, 0); $this->addColumn('promo', 'Promo', 'TINYINT', false, null, 0); - $this->addColumn('stock', 'Stock', 'INTEGER', false, null, 0); + $this->addColumn('quantity', 'Quantity', 'INTEGER', false, null, 0); $this->addColumn('visible', 'Visible', 'TINYINT', true, null, 0); $this->addColumn('weight', 'Weight', 'FLOAT', false, null, null); $this->addColumn('position', 'Position', 'INTEGER', true, null, null); diff --git a/core/lib/Thelia/Model/om/BaseProduct.php b/core/lib/Thelia/Model/om/BaseProduct.php index 64068b28b..a48b71c31 100644 --- a/core/lib/Thelia/Model/om/BaseProduct.php +++ b/core/lib/Thelia/Model/om/BaseProduct.php @@ -123,11 +123,11 @@ abstract class BaseProduct extends BaseObject implements Persistent protected $promo; /** - * The value for the stock field. + * The value for the quantity field. * Note: this column has a database default value of: 0 * @var int */ - protected $stock; + protected $quantity; /** * The value for the visible field. @@ -401,7 +401,7 @@ abstract class BaseProduct extends BaseObject implements Persistent { $this->newness = 0; $this->promo = 0; - $this->stock = 0; + $this->quantity = 0; $this->visible = 0; $this->version = 0; } @@ -497,13 +497,13 @@ abstract class BaseProduct extends BaseObject implements Persistent } /** - * Get the [stock] column value. + * Get the [quantity] column value. * * @return int */ - public function getStock() + public function getQuantity() { - return $this->stock; + return $this->quantity; } /** @@ -849,25 +849,25 @@ abstract class BaseProduct extends BaseObject implements Persistent } // setPromo() /** - * Set the value of [stock] column. + * Set the value of [quantity] column. * * @param int $v new value * @return Product The current object (for fluent API support) */ - public function setStock($v) + public function setQuantity($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } - if ($this->stock !== $v) { - $this->stock = $v; - $this->modifiedColumns[] = ProductPeer::STOCK; + if ($this->quantity !== $v) { + $this->quantity = $v; + $this->modifiedColumns[] = ProductPeer::QUANTITY; } return $this; - } // setStock() + } // setQuantity() /** * Set the value of [visible] column. @@ -1061,7 +1061,7 @@ abstract class BaseProduct extends BaseObject implements Persistent return false; } - if ($this->stock !== 0) { + if ($this->quantity !== 0) { return false; } @@ -1103,7 +1103,7 @@ abstract class BaseProduct extends BaseObject implements Persistent $this->ecotax = ($row[$startcol + 5] !== null) ? (double) $row[$startcol + 5] : null; $this->newness = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; $this->promo = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; - $this->stock = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; + $this->quantity = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; $this->visible = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null; $this->weight = ($row[$startcol + 10] !== null) ? (double) $row[$startcol + 10] : null; $this->position = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null; @@ -1689,8 +1689,8 @@ abstract class BaseProduct extends BaseObject implements Persistent if ($this->isColumnModified(ProductPeer::PROMO)) { $modifiedColumns[':p' . $index++] = '`promo`'; } - if ($this->isColumnModified(ProductPeer::STOCK)) { - $modifiedColumns[':p' . $index++] = '`stock`'; + if ($this->isColumnModified(ProductPeer::QUANTITY)) { + $modifiedColumns[':p' . $index++] = '`quantity`'; } if ($this->isColumnModified(ProductPeer::VISIBLE)) { $modifiedColumns[':p' . $index++] = '`visible`'; @@ -1751,8 +1751,8 @@ abstract class BaseProduct extends BaseObject implements Persistent case '`promo`': $stmt->bindValue($identifier, $this->promo, PDO::PARAM_INT); break; - case '`stock`': - $stmt->bindValue($identifier, $this->stock, PDO::PARAM_INT); + case '`quantity`': + $stmt->bindValue($identifier, $this->quantity, PDO::PARAM_INT); break; case '`visible`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); @@ -2037,7 +2037,7 @@ abstract class BaseProduct extends BaseObject implements Persistent return $this->getPromo(); break; case 8: - return $this->getStock(); + return $this->getQuantity(); break; case 9: return $this->getVisible(); @@ -2100,7 +2100,7 @@ abstract class BaseProduct extends BaseObject implements Persistent $keys[5] => $this->getEcotax(), $keys[6] => $this->getNewness(), $keys[7] => $this->getPromo(), - $keys[8] => $this->getStock(), + $keys[8] => $this->getQuantity(), $keys[9] => $this->getVisible(), $keys[10] => $this->getWeight(), $keys[11] => $this->getPosition(), @@ -2206,7 +2206,7 @@ abstract class BaseProduct extends BaseObject implements Persistent $this->setPromo($value); break; case 8: - $this->setStock($value); + $this->setQuantity($value); break; case 9: $this->setVisible($value); @@ -2264,7 +2264,7 @@ abstract class BaseProduct extends BaseObject implements Persistent if (array_key_exists($keys[5], $arr)) $this->setEcotax($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setNewness($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setPromo($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setStock($arr[$keys[8]]); + if (array_key_exists($keys[8], $arr)) $this->setQuantity($arr[$keys[8]]); if (array_key_exists($keys[9], $arr)) $this->setVisible($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setWeight($arr[$keys[10]]); if (array_key_exists($keys[11], $arr)) $this->setPosition($arr[$keys[11]]); @@ -2292,7 +2292,7 @@ abstract class BaseProduct extends BaseObject implements Persistent if ($this->isColumnModified(ProductPeer::ECOTAX)) $criteria->add(ProductPeer::ECOTAX, $this->ecotax); if ($this->isColumnModified(ProductPeer::NEWNESS)) $criteria->add(ProductPeer::NEWNESS, $this->newness); if ($this->isColumnModified(ProductPeer::PROMO)) $criteria->add(ProductPeer::PROMO, $this->promo); - if ($this->isColumnModified(ProductPeer::STOCK)) $criteria->add(ProductPeer::STOCK, $this->stock); + if ($this->isColumnModified(ProductPeer::QUANTITY)) $criteria->add(ProductPeer::QUANTITY, $this->quantity); if ($this->isColumnModified(ProductPeer::VISIBLE)) $criteria->add(ProductPeer::VISIBLE, $this->visible); if ($this->isColumnModified(ProductPeer::WEIGHT)) $criteria->add(ProductPeer::WEIGHT, $this->weight); if ($this->isColumnModified(ProductPeer::POSITION)) $criteria->add(ProductPeer::POSITION, $this->position); @@ -2371,7 +2371,7 @@ abstract class BaseProduct extends BaseObject implements Persistent $copyObj->setEcotax($this->getEcotax()); $copyObj->setNewness($this->getNewness()); $copyObj->setPromo($this->getPromo()); - $copyObj->setStock($this->getStock()); + $copyObj->setQuantity($this->getQuantity()); $copyObj->setVisible($this->getVisible()); $copyObj->setWeight($this->getWeight()); $copyObj->setPosition($this->getPosition()); @@ -5923,7 +5923,7 @@ abstract class BaseProduct extends BaseObject implements Persistent $this->ecotax = null; $this->newness = null; $this->promo = null; - $this->stock = null; + $this->quantity = null; $this->visible = null; $this->weight = null; $this->position = null; @@ -6382,7 +6382,7 @@ abstract class BaseProduct extends BaseObject implements Persistent $version->setEcotax($this->getEcotax()); $version->setNewness($this->getNewness()); $version->setPromo($this->getPromo()); - $version->setStock($this->getStock()); + $version->setQuantity($this->getQuantity()); $version->setVisible($this->getVisible()); $version->setWeight($this->getWeight()); $version->setPosition($this->getPosition()); @@ -6438,7 +6438,7 @@ abstract class BaseProduct extends BaseObject implements Persistent $this->setEcotax($version->getEcotax()); $this->setNewness($version->getNewness()); $this->setPromo($version->getPromo()); - $this->setStock($version->getStock()); + $this->setQuantity($version->getQuantity()); $this->setVisible($version->getVisible()); $this->setWeight($version->getWeight()); $this->setPosition($version->getPosition()); diff --git a/core/lib/Thelia/Model/om/BaseProductPeer.php b/core/lib/Thelia/Model/om/BaseProductPeer.php index 975e77501..599bfc672 100644 --- a/core/lib/Thelia/Model/om/BaseProductPeer.php +++ b/core/lib/Thelia/Model/om/BaseProductPeer.php @@ -79,8 +79,8 @@ abstract class BaseProductPeer /** the column name for the promo field */ const PROMO = 'product.promo'; - /** the column name for the stock field */ - const STOCK = 'product.stock'; + /** the column name for the quantity field */ + const QUANTITY = 'product.quantity'; /** the column name for the visible field */ const VISIBLE = 'product.visible'; @@ -139,11 +139,11 @@ abstract class BaseProductPeer * e.g. ProductPeer::$fieldNames[ProductPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('Id', 'TaxRuleId', 'Ref', 'Price', 'Price2', 'Ecotax', 'Newness', 'Promo', 'Stock', 'Visible', 'Weight', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxRuleId', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - BasePeer::TYPE_COLNAME => array (ProductPeer::ID, ProductPeer::TAX_RULE_ID, ProductPeer::REF, ProductPeer::PRICE, ProductPeer::PRICE2, ProductPeer::ECOTAX, ProductPeer::NEWNESS, ProductPeer::PROMO, ProductPeer::STOCK, ProductPeer::VISIBLE, ProductPeer::WEIGHT, ProductPeer::POSITION, ProductPeer::CREATED_AT, ProductPeer::UPDATED_AT, ProductPeer::VERSION, ProductPeer::VERSION_CREATED_AT, ProductPeer::VERSION_CREATED_BY, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_RULE_ID', 'REF', 'PRICE', 'PRICE2', 'ECOTAX', 'NEWNESS', 'PROMO', 'STOCK', 'VISIBLE', 'WEIGHT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'tax_rule_id', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), + BasePeer::TYPE_PHPNAME => array ('Id', 'TaxRuleId', 'Ref', 'Price', 'Price2', 'Ecotax', 'Newness', 'Promo', 'Quantity', 'Visible', 'Weight', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxRuleId', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'quantity', 'visible', 'weight', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), + BasePeer::TYPE_COLNAME => array (ProductPeer::ID, ProductPeer::TAX_RULE_ID, ProductPeer::REF, ProductPeer::PRICE, ProductPeer::PRICE2, ProductPeer::ECOTAX, ProductPeer::NEWNESS, ProductPeer::PROMO, ProductPeer::QUANTITY, ProductPeer::VISIBLE, ProductPeer::WEIGHT, ProductPeer::POSITION, ProductPeer::CREATED_AT, ProductPeer::UPDATED_AT, ProductPeer::VERSION, ProductPeer::VERSION_CREATED_AT, ProductPeer::VERSION_CREATED_BY, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_RULE_ID', 'REF', 'PRICE', 'PRICE2', 'ECOTAX', 'NEWNESS', 'PROMO', 'QUANTITY', 'VISIBLE', 'WEIGHT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'tax_rule_id', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'quantity', 'visible', 'weight', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) ); @@ -154,11 +154,11 @@ abstract class BaseProductPeer * e.g. ProductPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Price' => 3, 'Price2' => 4, 'Ecotax' => 5, 'Newness' => 6, 'Promo' => 7, 'Stock' => 8, 'Visible' => 9, 'Weight' => 10, 'Position' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, 'VersionCreatedAt' => 15, 'VersionCreatedBy' => 16, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, 'versionCreatedAt' => 15, 'versionCreatedBy' => 16, ), - BasePeer::TYPE_COLNAME => array (ProductPeer::ID => 0, ProductPeer::TAX_RULE_ID => 1, ProductPeer::REF => 2, ProductPeer::PRICE => 3, ProductPeer::PRICE2 => 4, ProductPeer::ECOTAX => 5, ProductPeer::NEWNESS => 6, ProductPeer::PROMO => 7, ProductPeer::STOCK => 8, ProductPeer::VISIBLE => 9, ProductPeer::WEIGHT => 10, ProductPeer::POSITION => 11, ProductPeer::CREATED_AT => 12, ProductPeer::UPDATED_AT => 13, ProductPeer::VERSION => 14, ProductPeer::VERSION_CREATED_AT => 15, ProductPeer::VERSION_CREATED_BY => 16, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'PRICE' => 3, 'PRICE2' => 4, 'ECOTAX' => 5, 'NEWNESS' => 6, 'PROMO' => 7, 'STOCK' => 8, 'VISIBLE' => 9, 'WEIGHT' => 10, 'POSITION' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, 'VERSION_CREATED_AT' => 15, 'VERSION_CREATED_BY' => 16, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, 'version_created_at' => 15, 'version_created_by' => 16, ), + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Price' => 3, 'Price2' => 4, 'Ecotax' => 5, 'Newness' => 6, 'Promo' => 7, 'Quantity' => 8, 'Visible' => 9, 'Weight' => 10, 'Position' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, 'VersionCreatedAt' => 15, 'VersionCreatedBy' => 16, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'quantity' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, 'versionCreatedAt' => 15, 'versionCreatedBy' => 16, ), + BasePeer::TYPE_COLNAME => array (ProductPeer::ID => 0, ProductPeer::TAX_RULE_ID => 1, ProductPeer::REF => 2, ProductPeer::PRICE => 3, ProductPeer::PRICE2 => 4, ProductPeer::ECOTAX => 5, ProductPeer::NEWNESS => 6, ProductPeer::PROMO => 7, ProductPeer::QUANTITY => 8, ProductPeer::VISIBLE => 9, ProductPeer::WEIGHT => 10, ProductPeer::POSITION => 11, ProductPeer::CREATED_AT => 12, ProductPeer::UPDATED_AT => 13, ProductPeer::VERSION => 14, ProductPeer::VERSION_CREATED_AT => 15, ProductPeer::VERSION_CREATED_BY => 16, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'PRICE' => 3, 'PRICE2' => 4, 'ECOTAX' => 5, 'NEWNESS' => 6, 'PROMO' => 7, 'QUANTITY' => 8, 'VISIBLE' => 9, 'WEIGHT' => 10, 'POSITION' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, 'VERSION_CREATED_AT' => 15, 'VERSION_CREATED_BY' => 16, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'quantity' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, 'version_created_at' => 15, 'version_created_by' => 16, ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) ); @@ -241,7 +241,7 @@ abstract class BaseProductPeer $criteria->addSelectColumn(ProductPeer::ECOTAX); $criteria->addSelectColumn(ProductPeer::NEWNESS); $criteria->addSelectColumn(ProductPeer::PROMO); - $criteria->addSelectColumn(ProductPeer::STOCK); + $criteria->addSelectColumn(ProductPeer::QUANTITY); $criteria->addSelectColumn(ProductPeer::VISIBLE); $criteria->addSelectColumn(ProductPeer::WEIGHT); $criteria->addSelectColumn(ProductPeer::POSITION); @@ -259,7 +259,7 @@ abstract class BaseProductPeer $criteria->addSelectColumn($alias . '.ecotax'); $criteria->addSelectColumn($alias . '.newness'); $criteria->addSelectColumn($alias . '.promo'); - $criteria->addSelectColumn($alias . '.stock'); + $criteria->addSelectColumn($alias . '.quantity'); $criteria->addSelectColumn($alias . '.visible'); $criteria->addSelectColumn($alias . '.weight'); $criteria->addSelectColumn($alias . '.position'); diff --git a/core/lib/Thelia/Model/om/BaseProductQuery.php b/core/lib/Thelia/Model/om/BaseProductQuery.php index 1030bcedc..90ccbf69b 100644 --- a/core/lib/Thelia/Model/om/BaseProductQuery.php +++ b/core/lib/Thelia/Model/om/BaseProductQuery.php @@ -41,7 +41,7 @@ use Thelia\Model\TaxRule; * @method ProductQuery orderByEcotax($order = Criteria::ASC) Order by the ecotax column * @method ProductQuery orderByNewness($order = Criteria::ASC) Order by the newness column * @method ProductQuery orderByPromo($order = Criteria::ASC) Order by the promo column - * @method ProductQuery orderByStock($order = Criteria::ASC) Order by the stock column + * @method ProductQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column * @method ProductQuery orderByVisible($order = Criteria::ASC) Order by the visible column * @method ProductQuery orderByWeight($order = Criteria::ASC) Order by the weight column * @method ProductQuery orderByPosition($order = Criteria::ASC) Order by the position column @@ -59,7 +59,7 @@ use Thelia\Model\TaxRule; * @method ProductQuery groupByEcotax() Group by the ecotax column * @method ProductQuery groupByNewness() Group by the newness column * @method ProductQuery groupByPromo() Group by the promo column - * @method ProductQuery groupByStock() Group by the stock column + * @method ProductQuery groupByQuantity() Group by the quantity column * @method ProductQuery groupByVisible() Group by the visible column * @method ProductQuery groupByWeight() Group by the weight column * @method ProductQuery groupByPosition() Group by the position column @@ -131,7 +131,7 @@ use Thelia\Model\TaxRule; * @method Product findOneByEcotax(double $ecotax) Return the first Product filtered by the ecotax column * @method Product findOneByNewness(int $newness) Return the first Product filtered by the newness column * @method Product findOneByPromo(int $promo) Return the first Product filtered by the promo column - * @method Product findOneByStock(int $stock) Return the first Product filtered by the stock column + * @method Product findOneByQuantity(int $quantity) Return the first Product filtered by the quantity column * @method Product findOneByVisible(int $visible) Return the first Product filtered by the visible column * @method Product findOneByWeight(double $weight) Return the first Product filtered by the weight column * @method Product findOneByPosition(int $position) Return the first Product filtered by the position column @@ -149,7 +149,7 @@ use Thelia\Model\TaxRule; * @method array findByEcotax(double $ecotax) Return Product objects filtered by the ecotax column * @method array findByNewness(int $newness) Return Product objects filtered by the newness column * @method array findByPromo(int $promo) Return Product objects filtered by the promo column - * @method array findByStock(int $stock) Return Product objects filtered by the stock column + * @method array findByQuantity(int $quantity) Return Product objects filtered by the quantity column * @method array findByVisible(int $visible) Return Product objects filtered by the visible column * @method array findByWeight(double $weight) Return Product objects filtered by the weight column * @method array findByPosition(int $position) Return Product objects filtered by the position column @@ -261,7 +261,7 @@ abstract class BaseProductQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT `id`, `tax_rule_id`, `ref`, `price`, `price2`, `ecotax`, `newness`, `promo`, `stock`, `visible`, `weight`, `position`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by` FROM `product` WHERE `id` = :p0'; + $sql = 'SELECT `id`, `tax_rule_id`, `ref`, `price`, `price2`, `ecotax`, `newness`, `promo`, `quantity`, `visible`, `weight`, `position`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by` FROM `product` WHERE `id` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -676,17 +676,17 @@ abstract class BaseProductQuery extends ModelCriteria } /** - * Filter the query on the stock column + * Filter the query on the quantity column * * Example usage: * - * $query->filterByStock(1234); // WHERE stock = 1234 - * $query->filterByStock(array(12, 34)); // WHERE stock IN (12, 34) - * $query->filterByStock(array('min' => 12)); // WHERE stock >= 12 - * $query->filterByStock(array('max' => 12)); // WHERE stock <= 12 + * $query->filterByQuantity(1234); // WHERE quantity = 1234 + * $query->filterByQuantity(array(12, 34)); // WHERE quantity IN (12, 34) + * $query->filterByQuantity(array('min' => 12)); // WHERE quantity >= 12 + * $query->filterByQuantity(array('max' => 12)); // WHERE quantity <= 12 * * - * @param mixed $stock The value to use as filter. + * @param mixed $quantity 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. @@ -694,16 +694,16 @@ abstract class BaseProductQuery extends ModelCriteria * * @return ProductQuery The current query, for fluid interface */ - public function filterByStock($stock = null, $comparison = null) + public function filterByQuantity($quantity = null, $comparison = null) { - if (is_array($stock)) { + if (is_array($quantity)) { $useMinMax = false; - if (isset($stock['min'])) { - $this->addUsingAlias(ProductPeer::STOCK, $stock['min'], Criteria::GREATER_EQUAL); + if (isset($quantity['min'])) { + $this->addUsingAlias(ProductPeer::QUANTITY, $quantity['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($stock['max'])) { - $this->addUsingAlias(ProductPeer::STOCK, $stock['max'], Criteria::LESS_EQUAL); + if (isset($quantity['max'])) { + $this->addUsingAlias(ProductPeer::QUANTITY, $quantity['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -714,7 +714,7 @@ abstract class BaseProductQuery extends ModelCriteria } } - return $this->addUsingAlias(ProductPeer::STOCK, $stock, $comparison); + return $this->addUsingAlias(ProductPeer::QUANTITY, $quantity, $comparison); } /** diff --git a/core/lib/Thelia/Model/om/BaseProductVersion.php b/core/lib/Thelia/Model/om/BaseProductVersion.php index 9f7d8f1ce..341966473 100644 --- a/core/lib/Thelia/Model/om/BaseProductVersion.php +++ b/core/lib/Thelia/Model/om/BaseProductVersion.php @@ -98,11 +98,11 @@ abstract class BaseProductVersion extends BaseObject implements Persistent protected $promo; /** - * The value for the stock field. + * The value for the quantity field. * Note: this column has a database default value of: 0 * @var int */ - protected $stock; + protected $quantity; /** * The value for the visible field. @@ -189,7 +189,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent { $this->newness = 0; $this->promo = 0; - $this->stock = 0; + $this->quantity = 0; $this->visible = 0; $this->version = 0; } @@ -285,13 +285,13 @@ abstract class BaseProductVersion extends BaseObject implements Persistent } /** - * Get the [stock] column value. + * Get the [quantity] column value. * * @return int */ - public function getStock() + public function getQuantity() { - return $this->stock; + return $this->quantity; } /** @@ -637,25 +637,25 @@ abstract class BaseProductVersion extends BaseObject implements Persistent } // setPromo() /** - * Set the value of [stock] column. + * Set the value of [quantity] column. * * @param int $v new value * @return ProductVersion The current object (for fluent API support) */ - public function setStock($v) + public function setQuantity($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } - if ($this->stock !== $v) { - $this->stock = $v; - $this->modifiedColumns[] = ProductVersionPeer::STOCK; + if ($this->quantity !== $v) { + $this->quantity = $v; + $this->modifiedColumns[] = ProductVersionPeer::QUANTITY; } return $this; - } // setStock() + } // setQuantity() /** * Set the value of [visible] column. @@ -849,7 +849,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent return false; } - if ($this->stock !== 0) { + if ($this->quantity !== 0) { return false; } @@ -891,7 +891,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent $this->ecotax = ($row[$startcol + 5] !== null) ? (double) $row[$startcol + 5] : null; $this->newness = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; $this->promo = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; - $this->stock = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; + $this->quantity = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; $this->visible = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null; $this->weight = ($row[$startcol + 10] !== null) ? (double) $row[$startcol + 10] : null; $this->position = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null; @@ -1156,8 +1156,8 @@ abstract class BaseProductVersion extends BaseObject implements Persistent if ($this->isColumnModified(ProductVersionPeer::PROMO)) { $modifiedColumns[':p' . $index++] = '`promo`'; } - if ($this->isColumnModified(ProductVersionPeer::STOCK)) { - $modifiedColumns[':p' . $index++] = '`stock`'; + if ($this->isColumnModified(ProductVersionPeer::QUANTITY)) { + $modifiedColumns[':p' . $index++] = '`quantity`'; } if ($this->isColumnModified(ProductVersionPeer::VISIBLE)) { $modifiedColumns[':p' . $index++] = '`visible`'; @@ -1218,8 +1218,8 @@ abstract class BaseProductVersion extends BaseObject implements Persistent case '`promo`': $stmt->bindValue($identifier, $this->promo, PDO::PARAM_INT); break; - case '`stock`': - $stmt->bindValue($identifier, $this->stock, PDO::PARAM_INT); + case '`quantity`': + $stmt->bindValue($identifier, $this->quantity, PDO::PARAM_INT); break; case '`visible`': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); @@ -1409,7 +1409,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent return $this->getPromo(); break; case 8: - return $this->getStock(); + return $this->getQuantity(); break; case 9: return $this->getVisible(); @@ -1472,7 +1472,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent $keys[5] => $this->getEcotax(), $keys[6] => $this->getNewness(), $keys[7] => $this->getPromo(), - $keys[8] => $this->getStock(), + $keys[8] => $this->getQuantity(), $keys[9] => $this->getVisible(), $keys[10] => $this->getWeight(), $keys[11] => $this->getPosition(), @@ -1545,7 +1545,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent $this->setPromo($value); break; case 8: - $this->setStock($value); + $this->setQuantity($value); break; case 9: $this->setVisible($value); @@ -1603,7 +1603,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent if (array_key_exists($keys[5], $arr)) $this->setEcotax($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setNewness($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setPromo($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setStock($arr[$keys[8]]); + if (array_key_exists($keys[8], $arr)) $this->setQuantity($arr[$keys[8]]); if (array_key_exists($keys[9], $arr)) $this->setVisible($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setWeight($arr[$keys[10]]); if (array_key_exists($keys[11], $arr)) $this->setPosition($arr[$keys[11]]); @@ -1631,7 +1631,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent if ($this->isColumnModified(ProductVersionPeer::ECOTAX)) $criteria->add(ProductVersionPeer::ECOTAX, $this->ecotax); if ($this->isColumnModified(ProductVersionPeer::NEWNESS)) $criteria->add(ProductVersionPeer::NEWNESS, $this->newness); if ($this->isColumnModified(ProductVersionPeer::PROMO)) $criteria->add(ProductVersionPeer::PROMO, $this->promo); - if ($this->isColumnModified(ProductVersionPeer::STOCK)) $criteria->add(ProductVersionPeer::STOCK, $this->stock); + if ($this->isColumnModified(ProductVersionPeer::QUANTITY)) $criteria->add(ProductVersionPeer::QUANTITY, $this->quantity); if ($this->isColumnModified(ProductVersionPeer::VISIBLE)) $criteria->add(ProductVersionPeer::VISIBLE, $this->visible); if ($this->isColumnModified(ProductVersionPeer::WEIGHT)) $criteria->add(ProductVersionPeer::WEIGHT, $this->weight); if ($this->isColumnModified(ProductVersionPeer::POSITION)) $criteria->add(ProductVersionPeer::POSITION, $this->position); @@ -1718,7 +1718,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent $copyObj->setEcotax($this->getEcotax()); $copyObj->setNewness($this->getNewness()); $copyObj->setPromo($this->getPromo()); - $copyObj->setStock($this->getStock()); + $copyObj->setQuantity($this->getQuantity()); $copyObj->setVisible($this->getVisible()); $copyObj->setWeight($this->getWeight()); $copyObj->setPosition($this->getPosition()); @@ -1849,7 +1849,7 @@ abstract class BaseProductVersion extends BaseObject implements Persistent $this->ecotax = null; $this->newness = null; $this->promo = null; - $this->stock = null; + $this->quantity = null; $this->visible = null; $this->weight = null; $this->position = null; diff --git a/core/lib/Thelia/Model/om/BaseProductVersionPeer.php b/core/lib/Thelia/Model/om/BaseProductVersionPeer.php index cf9d5111f..648e5696a 100644 --- a/core/lib/Thelia/Model/om/BaseProductVersionPeer.php +++ b/core/lib/Thelia/Model/om/BaseProductVersionPeer.php @@ -69,8 +69,8 @@ abstract class BaseProductVersionPeer /** the column name for the promo field */ const PROMO = 'product_version.promo'; - /** the column name for the stock field */ - const STOCK = 'product_version.stock'; + /** the column name for the quantity field */ + const QUANTITY = 'product_version.quantity'; /** the column name for the visible field */ const VISIBLE = 'product_version.visible'; @@ -115,11 +115,11 @@ abstract class BaseProductVersionPeer * e.g. ProductVersionPeer::$fieldNames[ProductVersionPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('Id', 'TaxRuleId', 'Ref', 'Price', 'Price2', 'Ecotax', 'Newness', 'Promo', 'Stock', 'Visible', 'Weight', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxRuleId', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - BasePeer::TYPE_COLNAME => array (ProductVersionPeer::ID, ProductVersionPeer::TAX_RULE_ID, ProductVersionPeer::REF, ProductVersionPeer::PRICE, ProductVersionPeer::PRICE2, ProductVersionPeer::ECOTAX, ProductVersionPeer::NEWNESS, ProductVersionPeer::PROMO, ProductVersionPeer::STOCK, ProductVersionPeer::VISIBLE, ProductVersionPeer::WEIGHT, ProductVersionPeer::POSITION, ProductVersionPeer::CREATED_AT, ProductVersionPeer::UPDATED_AT, ProductVersionPeer::VERSION, ProductVersionPeer::VERSION_CREATED_AT, ProductVersionPeer::VERSION_CREATED_BY, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_RULE_ID', 'REF', 'PRICE', 'PRICE2', 'ECOTAX', 'NEWNESS', 'PROMO', 'STOCK', 'VISIBLE', 'WEIGHT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'tax_rule_id', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), + BasePeer::TYPE_PHPNAME => array ('Id', 'TaxRuleId', 'Ref', 'Price', 'Price2', 'Ecotax', 'Newness', 'Promo', 'Quantity', 'Visible', 'Weight', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxRuleId', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'quantity', 'visible', 'weight', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), + BasePeer::TYPE_COLNAME => array (ProductVersionPeer::ID, ProductVersionPeer::TAX_RULE_ID, ProductVersionPeer::REF, ProductVersionPeer::PRICE, ProductVersionPeer::PRICE2, ProductVersionPeer::ECOTAX, ProductVersionPeer::NEWNESS, ProductVersionPeer::PROMO, ProductVersionPeer::QUANTITY, ProductVersionPeer::VISIBLE, ProductVersionPeer::WEIGHT, ProductVersionPeer::POSITION, ProductVersionPeer::CREATED_AT, ProductVersionPeer::UPDATED_AT, ProductVersionPeer::VERSION, ProductVersionPeer::VERSION_CREATED_AT, ProductVersionPeer::VERSION_CREATED_BY, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_RULE_ID', 'REF', 'PRICE', 'PRICE2', 'ECOTAX', 'NEWNESS', 'PROMO', 'QUANTITY', 'VISIBLE', 'WEIGHT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'tax_rule_id', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'quantity', 'visible', 'weight', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) ); @@ -130,11 +130,11 @@ abstract class BaseProductVersionPeer * e.g. ProductVersionPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Price' => 3, 'Price2' => 4, 'Ecotax' => 5, 'Newness' => 6, 'Promo' => 7, 'Stock' => 8, 'Visible' => 9, 'Weight' => 10, 'Position' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, 'VersionCreatedAt' => 15, 'VersionCreatedBy' => 16, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, 'versionCreatedAt' => 15, 'versionCreatedBy' => 16, ), - BasePeer::TYPE_COLNAME => array (ProductVersionPeer::ID => 0, ProductVersionPeer::TAX_RULE_ID => 1, ProductVersionPeer::REF => 2, ProductVersionPeer::PRICE => 3, ProductVersionPeer::PRICE2 => 4, ProductVersionPeer::ECOTAX => 5, ProductVersionPeer::NEWNESS => 6, ProductVersionPeer::PROMO => 7, ProductVersionPeer::STOCK => 8, ProductVersionPeer::VISIBLE => 9, ProductVersionPeer::WEIGHT => 10, ProductVersionPeer::POSITION => 11, ProductVersionPeer::CREATED_AT => 12, ProductVersionPeer::UPDATED_AT => 13, ProductVersionPeer::VERSION => 14, ProductVersionPeer::VERSION_CREATED_AT => 15, ProductVersionPeer::VERSION_CREATED_BY => 16, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'PRICE' => 3, 'PRICE2' => 4, 'ECOTAX' => 5, 'NEWNESS' => 6, 'PROMO' => 7, 'STOCK' => 8, 'VISIBLE' => 9, 'WEIGHT' => 10, 'POSITION' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, 'VERSION_CREATED_AT' => 15, 'VERSION_CREATED_BY' => 16, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, 'version_created_at' => 15, 'version_created_by' => 16, ), + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Price' => 3, 'Price2' => 4, 'Ecotax' => 5, 'Newness' => 6, 'Promo' => 7, 'Quantity' => 8, 'Visible' => 9, 'Weight' => 10, 'Position' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, 'VersionCreatedAt' => 15, 'VersionCreatedBy' => 16, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'quantity' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, 'versionCreatedAt' => 15, 'versionCreatedBy' => 16, ), + BasePeer::TYPE_COLNAME => array (ProductVersionPeer::ID => 0, ProductVersionPeer::TAX_RULE_ID => 1, ProductVersionPeer::REF => 2, ProductVersionPeer::PRICE => 3, ProductVersionPeer::PRICE2 => 4, ProductVersionPeer::ECOTAX => 5, ProductVersionPeer::NEWNESS => 6, ProductVersionPeer::PROMO => 7, ProductVersionPeer::QUANTITY => 8, ProductVersionPeer::VISIBLE => 9, ProductVersionPeer::WEIGHT => 10, ProductVersionPeer::POSITION => 11, ProductVersionPeer::CREATED_AT => 12, ProductVersionPeer::UPDATED_AT => 13, ProductVersionPeer::VERSION => 14, ProductVersionPeer::VERSION_CREATED_AT => 15, ProductVersionPeer::VERSION_CREATED_BY => 16, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'PRICE' => 3, 'PRICE2' => 4, 'ECOTAX' => 5, 'NEWNESS' => 6, 'PROMO' => 7, 'QUANTITY' => 8, 'VISIBLE' => 9, 'WEIGHT' => 10, 'POSITION' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, 'VERSION_CREATED_AT' => 15, 'VERSION_CREATED_BY' => 16, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'quantity' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, 'version_created_at' => 15, 'version_created_by' => 16, ), BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, ) ); @@ -217,7 +217,7 @@ abstract class BaseProductVersionPeer $criteria->addSelectColumn(ProductVersionPeer::ECOTAX); $criteria->addSelectColumn(ProductVersionPeer::NEWNESS); $criteria->addSelectColumn(ProductVersionPeer::PROMO); - $criteria->addSelectColumn(ProductVersionPeer::STOCK); + $criteria->addSelectColumn(ProductVersionPeer::QUANTITY); $criteria->addSelectColumn(ProductVersionPeer::VISIBLE); $criteria->addSelectColumn(ProductVersionPeer::WEIGHT); $criteria->addSelectColumn(ProductVersionPeer::POSITION); @@ -235,7 +235,7 @@ abstract class BaseProductVersionPeer $criteria->addSelectColumn($alias . '.ecotax'); $criteria->addSelectColumn($alias . '.newness'); $criteria->addSelectColumn($alias . '.promo'); - $criteria->addSelectColumn($alias . '.stock'); + $criteria->addSelectColumn($alias . '.quantity'); $criteria->addSelectColumn($alias . '.visible'); $criteria->addSelectColumn($alias . '.weight'); $criteria->addSelectColumn($alias . '.position'); diff --git a/core/lib/Thelia/Model/om/BaseProductVersionQuery.php b/core/lib/Thelia/Model/om/BaseProductVersionQuery.php index f4e8b5319..9d3e71a40 100644 --- a/core/lib/Thelia/Model/om/BaseProductVersionQuery.php +++ b/core/lib/Thelia/Model/om/BaseProductVersionQuery.php @@ -30,7 +30,7 @@ use Thelia\Model\ProductVersionQuery; * @method ProductVersionQuery orderByEcotax($order = Criteria::ASC) Order by the ecotax column * @method ProductVersionQuery orderByNewness($order = Criteria::ASC) Order by the newness column * @method ProductVersionQuery orderByPromo($order = Criteria::ASC) Order by the promo column - * @method ProductVersionQuery orderByStock($order = Criteria::ASC) Order by the stock column + * @method ProductVersionQuery orderByQuantity($order = Criteria::ASC) Order by the quantity column * @method ProductVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column * @method ProductVersionQuery orderByWeight($order = Criteria::ASC) Order by the weight column * @method ProductVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column @@ -48,7 +48,7 @@ use Thelia\Model\ProductVersionQuery; * @method ProductVersionQuery groupByEcotax() Group by the ecotax column * @method ProductVersionQuery groupByNewness() Group by the newness column * @method ProductVersionQuery groupByPromo() Group by the promo column - * @method ProductVersionQuery groupByStock() Group by the stock column + * @method ProductVersionQuery groupByQuantity() Group by the quantity column * @method ProductVersionQuery groupByVisible() Group by the visible column * @method ProductVersionQuery groupByWeight() Group by the weight column * @method ProductVersionQuery groupByPosition() Group by the position column @@ -77,7 +77,7 @@ use Thelia\Model\ProductVersionQuery; * @method ProductVersion findOneByEcotax(double $ecotax) Return the first ProductVersion filtered by the ecotax column * @method ProductVersion findOneByNewness(int $newness) Return the first ProductVersion filtered by the newness column * @method ProductVersion findOneByPromo(int $promo) Return the first ProductVersion filtered by the promo column - * @method ProductVersion findOneByStock(int $stock) Return the first ProductVersion filtered by the stock column + * @method ProductVersion findOneByQuantity(int $quantity) Return the first ProductVersion filtered by the quantity column * @method ProductVersion findOneByVisible(int $visible) Return the first ProductVersion filtered by the visible column * @method ProductVersion findOneByWeight(double $weight) Return the first ProductVersion filtered by the weight column * @method ProductVersion findOneByPosition(int $position) Return the first ProductVersion filtered by the position column @@ -95,7 +95,7 @@ use Thelia\Model\ProductVersionQuery; * @method array findByEcotax(double $ecotax) Return ProductVersion objects filtered by the ecotax column * @method array findByNewness(int $newness) Return ProductVersion objects filtered by the newness column * @method array findByPromo(int $promo) Return ProductVersion objects filtered by the promo column - * @method array findByStock(int $stock) Return ProductVersion objects filtered by the stock column + * @method array findByQuantity(int $quantity) Return ProductVersion objects filtered by the quantity column * @method array findByVisible(int $visible) Return ProductVersion objects filtered by the visible column * @method array findByWeight(double $weight) Return ProductVersion objects filtered by the weight column * @method array findByPosition(int $position) Return ProductVersion objects filtered by the position column @@ -194,7 +194,7 @@ abstract class BaseProductVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT `id`, `tax_rule_id`, `ref`, `price`, `price2`, `ecotax`, `newness`, `promo`, `stock`, `visible`, `weight`, `position`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by` FROM `product_version` WHERE `id` = :p0 AND `version` = :p1'; + $sql = 'SELECT `id`, `tax_rule_id`, `ref`, `price`, `price2`, `ecotax`, `newness`, `promo`, `quantity`, `visible`, `weight`, `position`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by` FROM `product_version` WHERE `id` = :p0 AND `version` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -621,17 +621,17 @@ abstract class BaseProductVersionQuery extends ModelCriteria } /** - * Filter the query on the stock column + * Filter the query on the quantity column * * Example usage: * - * $query->filterByStock(1234); // WHERE stock = 1234 - * $query->filterByStock(array(12, 34)); // WHERE stock IN (12, 34) - * $query->filterByStock(array('min' => 12)); // WHERE stock >= 12 - * $query->filterByStock(array('max' => 12)); // WHERE stock <= 12 + * $query->filterByQuantity(1234); // WHERE quantity = 1234 + * $query->filterByQuantity(array(12, 34)); // WHERE quantity IN (12, 34) + * $query->filterByQuantity(array('min' => 12)); // WHERE quantity >= 12 + * $query->filterByQuantity(array('max' => 12)); // WHERE quantity <= 12 * * - * @param mixed $stock The value to use as filter. + * @param mixed $quantity 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. @@ -639,16 +639,16 @@ abstract class BaseProductVersionQuery extends ModelCriteria * * @return ProductVersionQuery The current query, for fluid interface */ - public function filterByStock($stock = null, $comparison = null) + public function filterByQuantity($quantity = null, $comparison = null) { - if (is_array($stock)) { + if (is_array($quantity)) { $useMinMax = false; - if (isset($stock['min'])) { - $this->addUsingAlias(ProductVersionPeer::STOCK, $stock['min'], Criteria::GREATER_EQUAL); + if (isset($quantity['min'])) { + $this->addUsingAlias(ProductVersionPeer::QUANTITY, $quantity['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($stock['max'])) { - $this->addUsingAlias(ProductVersionPeer::STOCK, $stock['max'], Criteria::LESS_EQUAL); + if (isset($quantity['max'])) { + $this->addUsingAlias(ProductVersionPeer::QUANTITY, $quantity['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -659,7 +659,7 @@ abstract class BaseProductVersionQuery extends ModelCriteria } } - return $this->addUsingAlias(ProductVersionPeer::STOCK, $stock, $comparison); + return $this->addUsingAlias(ProductVersionPeer::QUANTITY, $quantity, $comparison); } /** diff --git a/install/faker.php b/install/faker.php index b6f803b05..3981e3ebf 100644 --- a/install/faker.php +++ b/install/faker.php @@ -8,6 +8,15 @@ $faker = Faker\Factory::create(); $con = \Propel::getConnection(Thelia\Model\ProductPeer::DATABASE_NAME); $con->beginTransaction(); try { + + $category = Thelia\Model\CategoryQuery::create() + ->find(); + $category->delete(); + + $product = Thelia\Model\ProductQuery::create() + ->find(); + $product->delete(); + //first category $sweet = new Thelia\Model\Category(); $sweet->setParent(0); @@ -33,7 +42,7 @@ try { $product->addCategory($sweet); $product->setTitle($faker->bs); $product->setDescription($faker->text(250)); - $product->setStock($faker->randomNumber(1,50)); + $product->setQuantity($faker->randomNumber(1,50)); $product->setPrice($faker->randomFloat(2, 20, 2500)); $product->setVisible(1); $product->setPosition($i); @@ -47,7 +56,7 @@ try { $product->addCategory($jeans); $product->setTitle($faker->bs); $product->setDescription($faker->text(250)); - $product->setStock($faker->randomNumber(1,50)); + $product->setQuantity($faker->randomNumber(1,50)); $product->setPrice($faker->randomFloat(2, 20, 2500)); $product->setVisible(1); $product->setPosition($i); diff --git a/local/config/schema.xml b/local/config/schema.xml index 7cfd83230..f9063c614 100644 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -28,7 +28,7 @@ - +