Skip to content

Commit bafc48f

Browse files
committed
Make oldFields mapping hardcoded to speed up system
The mapping came with Magneto 1.6 to provide a backward compatibility for old (pre 1.6) db field names. Now the mapping is hardcoded in the class instead of saved in the configuration. This improves performance as Magento will not create tons of objects for every new product/order/... entities. Related: #920
1 parent 9b539e3 commit bafc48f

File tree

16 files changed

+20
-30
lines changed

16 files changed

+20
-30
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Do not use 20.x.x if you need IE support.
8787
- add redis as a valid option for `global/session_save` #1513
8888
- possibility to disable global search in backend #1532
8989
- reduce needless saves by avoiding setting `_hasDataChanges` flag #2066
90+
- removed support for `global/sales/old_fields_map` defined in XML #921
9091

9192
For full list of changes, you can [compare tags](https://github.com/OpenMage/magento-lts/compare/1.9.4.x...20.0).
9293

app/code/core/Mage/Catalog/Model/Product.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ protected function _construct()
362362
*/
363363
protected function _initOldFieldsMap()
364364
{
365-
$this->_oldFieldsMap = Mage::helper('catalog')->getOldFieldMap();
366365
return $this;
367366
}
368367

app/code/core/Mage/CatalogInventory/Model/Stock/Item.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ protected function _construct()
177177
*/
178178
protected function _initOldFieldsMap()
179179
{
180+
// pre 1.6 fields names, old => new
180181
$this->_oldFieldsMap = array(
181182
'stock_status_changed_automatically' => 'stock_status_changed_auto',
182183
'use_config_enable_qty_increments' => 'use_config_enable_qty_inc'

app/code/core/Mage/Sales/Model/Order.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,12 @@ protected function _construct()
526526
*/
527527
protected function _initOldFieldsMap()
528528
{
529-
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order');
529+
// pre 1.6 fields names, old => new
530+
$this->_oldFieldsMap = [
531+
'payment_authorization_expiration' => 'payment_auth_expiration',
532+
'forced_do_shipment_with_invoice' => 'forced_shipment_with_invoice',
533+
'base_shipping_hidden_tax_amount' => 'base_shipping_hidden_tax_amnt',
534+
];
530535
return $this;
531536
}
532537

app/code/core/Mage/Sales/Model/Order/Address.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ protected function _construct()
112112
*/
113113
protected function _initOldFieldsMap()
114114
{
115-
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order_address');
116115
return $this;
117116
}
118117

app/code/core/Mage/Sales/Model/Order/Creditmemo.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ protected function _construct()
224224
*/
225225
protected function _initOldFieldsMap()
226226
{
227-
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order_creditmemo');
228227
return $this;
229228
}
230229

app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ public function setCreditmemo(Mage_Sales_Model_Order_Creditmemo $creditmemo)
153153
*/
154154
protected function _initOldFieldsMap()
155155
{
156-
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('creditmemo_item');
156+
// pre 1.6 fields names, old => new
157+
$this->_oldFieldsMap = [
158+
'base_weee_tax_applied_row_amount' => 'base_weee_tax_applied_row_amnt',
159+
];
157160
return $this;
158161
}
159162

app/code/core/Mage/Sales/Model/Order/Invoice.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ protected function _construct()
223223
*/
224224
protected function _initOldFieldsMap()
225225
{
226-
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order_invoice');
227226
return $this;
228227
}
229228

app/code/core/Mage/Sales/Model/Order/Invoice/Item.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ public function _construct()
125125
*/
126126
protected function _initOldFieldsMap()
127127
{
128-
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('invoice_item');
128+
// pre 1.6 fields names, old => new
129+
$this->_oldFieldsMap = [
130+
'base_weee_tax_applied_row_amount' => 'base_weee_tax_applied_row_amnt',
131+
];
129132
return $this;
130133
}
131134
/**

app/code/core/Mage/Sales/Model/Order/Item.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ protected function _construct()
246246
*/
247247
protected function _initOldFieldsMap()
248248
{
249-
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order_item');
249+
// pre 1.6 fields names, old => new
250+
$this->_oldFieldsMap = [
251+
'base_weee_tax_applied_row_amount' => 'base_weee_tax_applied_row_amnt',
252+
];
250253
return $this;
251254
}
252255

0 commit comments

Comments
 (0)