- * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
- * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
- *
- *
- * @param string $locale 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 ChildNewsletterQuery The current query, for fluid interface
- */
- public function filterByLocale($locale = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($locale)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $locale)) {
- $locale = str_replace('*', '%', $locale);
- $comparison = Criteria::LIKE;
- }
- }
-
- return $this->addUsingAlias(NewsletterTableMap::LOCALE, $locale, $comparison);
- }
-
- /**
- * Filter the query on the created_at column
- *
- * Example usage:
- *
- * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
- * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
- * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
- *
- *
- * @param mixed $createdAt The value to use as filter.
- * Values can be integers (unix timestamps), DateTime objects, or strings.
- * Empty strings are treated as NULL.
- * 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 ChildNewsletterQuery The current query, for fluid interface
- */
- public function filterByCreatedAt($createdAt = null, $comparison = null)
- {
- if (is_array($createdAt)) {
- $useMinMax = false;
- if (isset($createdAt['min'])) {
- $this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($createdAt['max'])) {
- $this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
-
- return $this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt, $comparison);
- }
-
- /**
- * Filter the query on the updated_at column
- *
- * Example usage:
- *
- * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
- * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
- * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
- *
- *
- * @param mixed $updatedAt The value to use as filter.
- * Values can be integers (unix timestamps), DateTime objects, or strings.
- * Empty strings are treated as NULL.
- * 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 ChildNewsletterQuery The current query, for fluid interface
- */
- public function filterByUpdatedAt($updatedAt = null, $comparison = null)
- {
- if (is_array($updatedAt)) {
- $useMinMax = false;
- if (isset($updatedAt['min'])) {
- $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($updatedAt['max'])) {
- $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
-
- return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt, $comparison);
- }
-
/**
* Exclude object from result
*
@@ -567,70 +440,4 @@ abstract class NewsletterQuery extends ModelCriteria
}
}
- // timestampable behavior
-
- /**
- * Filter by the latest updated
- *
- * @param int $nbDays Maximum age of the latest update in days
- *
- * @return ChildNewsletterQuery The current query, for fluid interface
- */
- public function recentlyUpdated($nbDays = 7)
- {
- return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
- }
-
- /**
- * Filter by the latest created
- *
- * @param int $nbDays Maximum age of in days
- *
- * @return ChildNewsletterQuery The current query, for fluid interface
- */
- public function recentlyCreated($nbDays = 7)
- {
- return $this->addUsingAlias(NewsletterTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
- }
-
- /**
- * Order by update date desc
- *
- * @return ChildNewsletterQuery The current query, for fluid interface
- */
- public function lastUpdatedFirst()
- {
- return $this->addDescendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
- }
-
- /**
- * Order by update date asc
- *
- * @return ChildNewsletterQuery The current query, for fluid interface
- */
- public function firstUpdatedFirst()
- {
- return $this->addAscendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
- }
-
- /**
- * Order by create date desc
- *
- * @return ChildNewsletterQuery The current query, for fluid interface
- */
- public function lastCreatedFirst()
- {
- return $this->addDescendingOrderByColumn(NewsletterTableMap::CREATED_AT);
- }
-
- /**
- * Order by create date asc
- *
- * @return ChildNewsletterQuery The current query, for fluid interface
- */
- public function firstCreatedFirst()
- {
- return $this->addAscendingOrderByColumn(NewsletterTableMap::CREATED_AT);
- }
-
} // NewsletterQuery
diff --git a/core/lib/Thelia/Model/Base/ProductPrice.php b/core/lib/Thelia/Model/Base/ProductPrice.php
index 363244e07..e5c5b3f27 100644
--- a/core/lib/Thelia/Model/Base/ProductPrice.php
+++ b/core/lib/Thelia/Model/Base/ProductPrice.php
@@ -72,19 +72,21 @@ abstract class ProductPrice implements ActiveRecordInterface
/**
* The value for the price field.
+ * Note: this column has a database default value of: 0
* @var double
*/
protected $price;
/**
* The value for the promo_price field.
+ * Note: this column has a database default value of: 0
* @var double
*/
protected $promo_price;
/**
* The value for the from_default_currency field.
- * Note: this column has a database default value of: false
+ * Note: this column has a database default value of: true
* @var boolean
*/
protected $from_default_currency;
@@ -127,7 +129,9 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
public function applyDefaultValues()
{
- $this->from_default_currency = false;
+ $this->price = 0;
+ $this->promo_price = 0;
+ $this->from_default_currency = true;
}
/**
@@ -658,7 +662,15 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
public function hasOnlyDefaultValues()
{
- if ($this->from_default_currency !== false) {
+ if ($this->price !== 0) {
+ return false;
+ }
+
+ if ($this->promo_price !== 0) {
+ return false;
+ }
+
+ if ($this->from_default_currency !== true) {
return false;
}
diff --git a/core/lib/Thelia/Model/Map/AddressTableMap.php b/core/lib/Thelia/Model/Map/AddressTableMap.php
index 46e2be02d..ff9925d38 100644
--- a/core/lib/Thelia/Model/Map/AddressTableMap.php
+++ b/core/lib/Thelia/Model/Map/AddressTableMap.php
@@ -238,8 +238,8 @@ class AddressTableMap extends TableMap
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('CustomerTitle', '\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'RESTRICT', 'RESTRICT');
- $this->addRelation('CartRelatedByAddressDeliveryId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_delivery_id', ), null, null, 'CartsRelatedByAddressDeliveryId');
- $this->addRelation('CartRelatedByAddressInvoiceId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_invoice_id', ), null, null, 'CartsRelatedByAddressInvoiceId');
+ $this->addRelation('CartRelatedByAddressDeliveryId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_delivery_id', ), 'RESTRICT', 'RESTRICT', 'CartsRelatedByAddressDeliveryId');
+ $this->addRelation('CartRelatedByAddressInvoiceId', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'address_invoice_id', ), 'RESTRICT', 'RESTRICT', 'CartsRelatedByAddressInvoiceId');
} // buildRelations()
/**
diff --git a/core/lib/Thelia/Model/Map/CartItemTableMap.php b/core/lib/Thelia/Model/Map/CartItemTableMap.php
index c48d298e0..cf10165ed 100644
--- a/core/lib/Thelia/Model/Map/CartItemTableMap.php
+++ b/core/lib/Thelia/Model/Map/CartItemTableMap.php
@@ -199,9 +199,9 @@ class CartItemTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::MANY_TO_ONE, array('cart_id' => 'id', ), null, null);
- $this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), null, null);
- $this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::MANY_TO_ONE, array('product_sale_elements_id' => 'id', ), null, null);
+ $this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::MANY_TO_ONE, array('cart_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ $this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ $this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::MANY_TO_ONE, array('product_sale_elements_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
diff --git a/core/lib/Thelia/Model/Map/CartTableMap.php b/core/lib/Thelia/Model/Map/CartTableMap.php
index d839b4e91..2f81472cd 100644
--- a/core/lib/Thelia/Model/Map/CartTableMap.php
+++ b/core/lib/Thelia/Model/Map/CartTableMap.php
@@ -181,11 +181,11 @@ class CartTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), null, null);
- $this->addRelation('AddressRelatedByAddressDeliveryId', '\\Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('address_delivery_id' => 'id', ), null, null);
- $this->addRelation('AddressRelatedByAddressInvoiceId', '\\Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('address_invoice_id' => 'id', ), null, null);
- $this->addRelation('Currency', '\\Thelia\\Model\\Currency', RelationMap::MANY_TO_ONE, array('currency_id' => 'id', ), null, null);
- $this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'cart_id', ), null, null, 'CartItems');
+ $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ $this->addRelation('AddressRelatedByAddressDeliveryId', '\\Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('address_delivery_id' => 'id', ), 'RESTRICT', 'RESTRICT');
+ $this->addRelation('AddressRelatedByAddressInvoiceId', '\\Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('address_invoice_id' => 'id', ), 'RESTRICT', 'RESTRICT');
+ $this->addRelation('Currency', '\\Thelia\\Model\\Currency', RelationMap::MANY_TO_ONE, array('currency_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ $this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'cart_id', ), 'CASCADE', 'RESTRICT', 'CartItems');
} // buildRelations()
/**
@@ -200,6 +200,15 @@ class CartTableMap extends TableMap
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
+ /**
+ * Method to invalidate the instance pool of all tables related to cart * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CartItemTableMap::clearInstancePool();
+ }
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
diff --git a/core/lib/Thelia/Model/Map/CurrencyTableMap.php b/core/lib/Thelia/Model/Map/CurrencyTableMap.php
index 9c0e65296..3d4e6ebac 100644
--- a/core/lib/Thelia/Model/Map/CurrencyTableMap.php
+++ b/core/lib/Thelia/Model/Map/CurrencyTableMap.php
@@ -185,7 +185,7 @@ class CurrencyTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'RESTRICT', 'RESTRICT', 'Orders');
- $this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), null, null, 'Carts');
+ $this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'CASCADE', 'RESTRICT', 'Carts');
$this->addRelation('ProductPrice', '\\Thelia\\Model\\ProductPrice', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'CASCADE', null, 'ProductPrices');
$this->addRelation('CurrencyI18n', '\\Thelia\\Model\\CurrencyI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CurrencyI18ns');
} // buildRelations()
@@ -210,6 +210,7 @@ class CurrencyTableMap extends TableMap
{
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CartTableMap::clearInstancePool();
ProductPriceTableMap::clearInstancePool();
CurrencyI18nTableMap::clearInstancePool();
}
diff --git a/core/lib/Thelia/Model/Map/CustomerTableMap.php b/core/lib/Thelia/Model/Map/CustomerTableMap.php
index 2c1fdfae2..b3cc9d077 100644
--- a/core/lib/Thelia/Model/Map/CustomerTableMap.php
+++ b/core/lib/Thelia/Model/Map/CustomerTableMap.php
@@ -226,7 +226,7 @@ class CustomerTableMap extends TableMap
$this->addRelation('CustomerTitle', '\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Addresses');
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'RESTRICT', 'RESTRICT', 'Orders');
- $this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), null, null, 'Carts');
+ $this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Carts');
} // buildRelations()
/**
@@ -249,6 +249,7 @@ class CustomerTableMap extends TableMap
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AddressTableMap::clearInstancePool();
+ CartTableMap::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/Map/NewsletterTableMap.php b/core/lib/Thelia/Model/Map/NewsletterTableMap.php
index 192c8cfa6..1aed936b7 100644
--- a/core/lib/Thelia/Model/Map/NewsletterTableMap.php
+++ b/core/lib/Thelia/Model/Map/NewsletterTableMap.php
@@ -57,7 +57,7 @@ class NewsletterTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 7;
+ const NUM_COLUMNS = 4;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class NewsletterTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 7;
+ const NUM_HYDRATE_COLUMNS = 4;
/**
* the column name for the ID field
@@ -89,21 +89,6 @@ class NewsletterTableMap extends TableMap
*/
const LASTNAME = 'newsletter.LASTNAME';
- /**
- * the column name for the LOCALE field
- */
- const LOCALE = 'newsletter.LOCALE';
-
- /**
- * the column name for the CREATED_AT field
- */
- const CREATED_AT = 'newsletter.CREATED_AT';
-
- /**
- * the column name for the UPDATED_AT field
- */
- const UPDATED_AT = 'newsletter.UPDATED_AT';
-
/**
* The default string format for model objects of the related table
*/
@@ -116,12 +101,12 @@ class NewsletterTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Email', 'Firstname', 'Lastname', 'Locale', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(NewsletterTableMap::ID, NewsletterTableMap::EMAIL, NewsletterTableMap::FIRSTNAME, NewsletterTableMap::LASTNAME, NewsletterTableMap::LOCALE, NewsletterTableMap::CREATED_AT, NewsletterTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'EMAIL', 'FIRSTNAME', 'LASTNAME', 'LOCALE', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('Id', 'Email', 'Firstname', 'Lastname', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'email', 'firstname', 'lastname', ),
+ self::TYPE_COLNAME => array(NewsletterTableMap::ID, NewsletterTableMap::EMAIL, NewsletterTableMap::FIRSTNAME, NewsletterTableMap::LASTNAME, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'EMAIL', 'FIRSTNAME', 'LASTNAME', ),
+ self::TYPE_FIELDNAME => array('id', 'email', 'firstname', 'lastname', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, )
);
/**
@@ -131,12 +116,12 @@ class NewsletterTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Email' => 1, 'Firstname' => 2, 'Lastname' => 3, 'Locale' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
- self::TYPE_COLNAME => array(NewsletterTableMap::ID => 0, NewsletterTableMap::EMAIL => 1, NewsletterTableMap::FIRSTNAME => 2, NewsletterTableMap::LASTNAME => 3, NewsletterTableMap::LOCALE => 4, NewsletterTableMap::CREATED_AT => 5, NewsletterTableMap::UPDATED_AT => 6, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'EMAIL' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, 'LOCALE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'created_at' => 5, 'updated_at' => 6, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Email' => 1, 'Firstname' => 2, 'Lastname' => 3, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, ),
+ self::TYPE_COLNAME => array(NewsletterTableMap::ID => 0, NewsletterTableMap::EMAIL => 1, NewsletterTableMap::FIRSTNAME => 2, NewsletterTableMap::LASTNAME => 3, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'EMAIL' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, )
);
/**
@@ -159,9 +144,6 @@ class NewsletterTableMap extends TableMap
$this->addColumn('EMAIL', 'Email', 'VARCHAR', true, 255, null);
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', false, 255, null);
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', false, 255, null);
- $this->addColumn('LOCALE', 'Locale', 'VARCHAR', false, 45, null);
- $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
- $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
@@ -171,19 +153,6 @@ class NewsletterTableMap extends TableMap
{
} // buildRelations()
- /**
- *
- * Gets the list of behaviors registered for this table
- *
- * @return array Associative array (name => parameters) of behaviors
- */
- public function getBehaviors()
- {
- return array(
- 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
- );
- } // getBehaviors()
-
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
@@ -326,17 +295,11 @@ class NewsletterTableMap extends TableMap
$criteria->addSelectColumn(NewsletterTableMap::EMAIL);
$criteria->addSelectColumn(NewsletterTableMap::FIRSTNAME);
$criteria->addSelectColumn(NewsletterTableMap::LASTNAME);
- $criteria->addSelectColumn(NewsletterTableMap::LOCALE);
- $criteria->addSelectColumn(NewsletterTableMap::CREATED_AT);
- $criteria->addSelectColumn(NewsletterTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.EMAIL');
$criteria->addSelectColumn($alias . '.FIRSTNAME');
$criteria->addSelectColumn($alias . '.LASTNAME');
- $criteria->addSelectColumn($alias . '.LOCALE');
- $criteria->addSelectColumn($alias . '.CREATED_AT');
- $criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}
diff --git a/core/lib/Thelia/Model/Map/ProductPriceTableMap.php b/core/lib/Thelia/Model/Map/ProductPriceTableMap.php
index 7a80d2e12..81eed9609 100644
--- a/core/lib/Thelia/Model/Map/ProductPriceTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductPriceTableMap.php
@@ -157,9 +157,9 @@ class ProductPriceTableMap extends TableMap
// columns
$this->addForeignPrimaryKey('PRODUCT_SALE_ELEMENTS_ID', 'ProductSaleElementsId', 'INTEGER' , 'product_sale_elements', 'ID', true, null, null);
$this->addForeignPrimaryKey('CURRENCY_ID', 'CurrencyId', 'INTEGER' , 'currency', 'ID', true, null, null);
- $this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
- $this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null);
- $this->addColumn('FROM_DEFAULT_CURRENCY', 'FromDefaultCurrency', 'BOOLEAN', true, 1, false);
+ $this->addColumn('PRICE', 'Price', 'FLOAT', true, null, 0);
+ $this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', true, null, 0);
+ $this->addColumn('FROM_DEFAULT_CURRENCY', 'FromDefaultCurrency', 'BOOLEAN', true, 1, true);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
diff --git a/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php b/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php
index a4dc06d9f..f6de901ed 100644
--- a/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductSaleElementsTableMap.php
@@ -195,7 +195,7 @@ class ProductSaleElementsTableMap extends TableMap
{
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('AttributeCombination', '\\Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), 'CASCADE', 'RESTRICT', 'AttributeCombinations');
- $this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), null, null, 'CartItems');
+ $this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), 'CASCADE', 'RESTRICT', 'CartItems');
$this->addRelation('ProductPrice', '\\Thelia\\Model\\ProductPrice', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), 'CASCADE', null, 'ProductPrices');
} // buildRelations()
@@ -219,6 +219,7 @@ class ProductSaleElementsTableMap extends TableMap
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeCombinationTableMap::clearInstancePool();
+ CartItemTableMap::clearInstancePool();
ProductPriceTableMap::clearInstancePool();
}
diff --git a/core/lib/Thelia/Model/Map/ProductTableMap.php b/core/lib/Thelia/Model/Map/ProductTableMap.php
index 273ed7382..68a34a393 100644
--- a/core/lib/Thelia/Model/Map/ProductTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductTableMap.php
@@ -211,7 +211,7 @@ class ProductTableMap extends TableMap
$this->addRelation('ProductDocument', '\\Thelia\\Model\\ProductDocument', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductDocuments');
$this->addRelation('AccessoryRelatedByProductId', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByProductId');
$this->addRelation('AccessoryRelatedByAccessory', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByAccessory');
- $this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), null, null, 'CartItems');
+ $this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'CartItems');
$this->addRelation('ProductAssociatedContent', '\\Thelia\\Model\\ProductAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductAssociatedContents');
$this->addRelation('ProductI18n', '\\Thelia\\Model\\ProductI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductI18ns');
$this->addRelation('ProductVersion', '\\Thelia\\Model\\ProductVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductVersions');
@@ -247,6 +247,7 @@ class ProductTableMap extends TableMap
ProductImageTableMap::clearInstancePool();
ProductDocumentTableMap::clearInstancePool();
AccessoryTableMap::clearInstancePool();
+ CartItemTableMap::clearInstancePool();
ProductAssociatedContentTableMap::clearInstancePool();
ProductI18nTableMap::clearInstancePool();
ProductVersionTableMap::clearInstancePool();
diff --git a/install/thelia.sql b/install/thelia.sql
index 7fa114536..697db5bf0 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -1199,16 +1199,24 @@ CREATE TABLE `cart`
INDEX `idx_cart_currency_id` (`currency_id`),
CONSTRAINT `fk_cart_customer_id`
FOREIGN KEY (`customer_id`)
- REFERENCES `customer` (`id`),
+ REFERENCES `customer` (`id`)
+ ON UPDATE RESTRICT
+ ON DELETE CASCADE,
CONSTRAINT `fk_cart_address_delivery_id`
FOREIGN KEY (`address_delivery_id`)
- REFERENCES `address` (`id`),
+ REFERENCES `address` (`id`)
+ ON UPDATE RESTRICT
+ ON DELETE RESTRICT,
CONSTRAINT `fk_cart_address_invoice_id`
FOREIGN KEY (`address_invoice_id`)
- REFERENCES `address` (`id`),
+ REFERENCES `address` (`id`)
+ ON UPDATE RESTRICT
+ ON DELETE RESTRICT,
CONSTRAINT `fk_cart_currency_id`
FOREIGN KEY (`currency_id`)
REFERENCES `currency` (`id`)
+ ON UPDATE RESTRICT
+ ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -1237,13 +1245,19 @@ CREATE TABLE `cart_item`
INDEX `idx_cart_item_product_sale_elements_id` (`product_sale_elements_id`),
CONSTRAINT `fk_cart_item_cart_id`
FOREIGN KEY (`cart_id`)
- REFERENCES `cart` (`id`),
+ REFERENCES `cart` (`id`)
+ ON UPDATE RESTRICT
+ ON DELETE CASCADE,
CONSTRAINT `fk_cart_item_product_id`
FOREIGN KEY (`product_id`)
- REFERENCES `product` (`id`),
+ REFERENCES `product` (`id`)
+ ON UPDATE RESTRICT
+ ON DELETE CASCADE,
CONSTRAINT `fk_cart_item_product_sale_elements_id`
FOREIGN KEY (`product_sale_elements_id`)
REFERENCES `product_sale_elements` (`id`)
+ ON UPDATE RESTRICT
+ ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -1256,9 +1270,9 @@ CREATE TABLE `product_price`
(
`product_sale_elements_id` INTEGER NOT NULL,
`currency_id` INTEGER NOT NULL,
- `price` FLOAT NOT NULL,
- `promo_price` FLOAT,
- `from_default_currency` TINYINT(1) DEFAULT 0 NOT NULL,
+ `price` FLOAT DEFAULT 0 NOT NULL,
+ `promo_price` FLOAT DEFAULT 0 NOT NULL,
+ `from_default_currency` TINYINT(1) DEFAULT 1 NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`product_sale_elements_id`,`currency_id`),
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 61c4aabf5..91a16eb84 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -931,16 +931,16 @@