Add foreign key constraints for order_address

modifié:         core/lib/Thelia/Model/Base/Country.php
	modifié:         core/lib/Thelia/Model/Base/CountryQuery.php
	modifié:         core/lib/Thelia/Model/Base/CustomerTitle.php
	modifié:         core/lib/Thelia/Model/Base/CustomerTitleQuery.php
	modifié:         core/lib/Thelia/Model/Base/OrderAddress.php
	modifié:         core/lib/Thelia/Model/Base/OrderAddressQuery.php
	modifié:         core/lib/Thelia/Model/Map/CountryTableMap.php
	modifié:         core/lib/Thelia/Model/Map/CustomerTitleTableMap.php
	modifié:         core/lib/Thelia/Model/Map/OrderAddressTableMap.php
	modifié:         local/config/schema.xml
	modifié:         setup/thelia.sql
	modifié:         setup/update/2.0.3.sql
This commit is contained in:
Benjamin Perche
2014-07-29 14:14:46 +02:00
parent 6963754d62
commit c39e6bcf85
12 changed files with 1104 additions and 3 deletions

View File

@@ -194,6 +194,7 @@ class CountryTableMap extends TableMap
$this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'SET NULL', 'RESTRICT');
$this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountries');
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'RESTRICT', 'RESTRICT', 'Addresses');
$this->addRelation('OrderAddress', '\\Thelia\\Model\\OrderAddress', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'RESTRICT', 'RESTRICT', 'OrderAddresses');
$this->addRelation('CouponCountry', '\\Thelia\\Model\\CouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', null, 'CouponCountries');
$this->addRelation('OrderCouponCountry', '\\Thelia\\Model\\OrderCouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', null, 'OrderCouponCountries');
$this->addRelation('CountryI18n', '\\Thelia\\Model\\CountryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CountryI18ns');

View File

@@ -169,6 +169,7 @@ class CustomerTitleTableMap extends TableMap
{
$this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::ONE_TO_MANY, array('id' => 'title_id', ), 'RESTRICT', 'RESTRICT', 'Customers');
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'title_id', ), 'RESTRICT', 'RESTRICT', 'Addresses');
$this->addRelation('OrderAddress', '\\Thelia\\Model\\OrderAddress', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), 'RESTRICT', 'RESTRICT', 'OrderAddresses');
$this->addRelation('CustomerTitleI18n', '\\Thelia\\Model\\CustomerTitleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CustomerTitleI18ns');
} // buildRelations()

View File

@@ -192,7 +192,7 @@ class OrderAddressTableMap extends TableMap
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', false, null, null);
$this->addForeignKey('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', 'customer_title', 'ID', false, null, null);
$this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
@@ -202,7 +202,7 @@ class OrderAddressTableMap extends TableMap
$this->addColumn('ZIPCODE', 'Zipcode', 'VARCHAR', true, 10, null);
$this->addColumn('CITY', 'City', 'VARCHAR', true, 255, null);
$this->addColumn('PHONE', 'Phone', 'VARCHAR', false, 20, null);
$this->addColumn('COUNTRY_ID', 'CountryId', 'INTEGER', true, null, null);
$this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -212,6 +212,8 @@ class OrderAddressTableMap extends TableMap
*/
public function buildRelations()
{
$this->addRelation('CustomerTitle', '\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('customer_title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('OrderRelatedByInvoiceOrderAddressId', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'invoice_order_address_id', ), 'RESTRICT', 'RESTRICT', 'OrdersRelatedByInvoiceOrderAddressId');
$this->addRelation('OrderRelatedByDeliveryOrderAddressId', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'delivery_order_address_id', ), 'RESTRICT', 'RESTRICT', 'OrdersRelatedByDeliveryOrderAddressId');
} // buildRelations()