[-] CORE : fixed bug #PSCFV-5261 - No easy way to associate xxx_shop table for an object => added Shop:: addTableAssociation($table_name, $table_details)
This commit is contained in:
+23
-2
@@ -141,7 +141,8 @@ class ShopCore extends ObjectModel
|
|||||||
protected static function init()
|
protected static function init()
|
||||||
{
|
{
|
||||||
Shop::$id_shop_default_tables = array('product', 'category');
|
Shop::$id_shop_default_tables = array('product', 'category');
|
||||||
Shop::$asso_tables = array(
|
|
||||||
|
$asso_tables = array(
|
||||||
'carrier' => array('type' => 'shop'),
|
'carrier' => array('type' => 'shop'),
|
||||||
'carrier_lang' => array('type' => 'fk_shop'),
|
'carrier_lang' => array('type' => 'fk_shop'),
|
||||||
'category' => array('type' => 'shop'),
|
'category' => array('type' => 'shop'),
|
||||||
@@ -179,6 +180,10 @@ class ShopCore extends ObjectModel
|
|||||||
'manufacturer' => array('type' => 'shop'),
|
'manufacturer' => array('type' => 'shop'),
|
||||||
'supplier' => array('type' => 'shop'),
|
'supplier' => array('type' => 'shop'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
foreach($asso_tables as $table_name => $table_details)
|
||||||
|
Shop::addTableAssociation($table_name, $table_details);
|
||||||
|
|
||||||
Shop::$initialized = true;
|
Shop::$initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +539,23 @@ class ShopCore extends ObjectModel
|
|||||||
Shop::init();
|
Shop::init();
|
||||||
return Shop::$asso_tables;
|
return Shop::$asso_tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add table associated to shop
|
||||||
|
*
|
||||||
|
* @param string $table_name
|
||||||
|
* @param array $table_details
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function addTableAssociation($table_name, $table_details)
|
||||||
|
{
|
||||||
|
if (!isset(Shop::$asso_tables[$table_name]))
|
||||||
|
Shop::$asso_tables[$table_name] = $table_details;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if given table is associated to shop
|
* Check if given table is associated to shop
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user