Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove oldFields mapping to speed up system #6

Open
wants to merge 2 commits into
base: hardcode_old_fields_map
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions app/code/core/Mage/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,6 @@ protected function _construct()
$this->_init('catalog/product');
}

/**
* Init mapping array of short fields to
* its full names
*
* @return Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('catalog')->getOldFieldMap();
return $this;
}

/**
* Retrieve Store Id
*
Expand Down
14 changes: 0 additions & 14 deletions app/code/core/Mage/CatalogInventory/Model/Stock/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,6 @@ protected function _construct()
$this->_init('cataloginventory/stock_item');
}

/**
* Init mapping array of short fields to
* its full names
*
* @resturn Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = array(
'stock_status_changed_automatically' => 'stock_status_changed_auto',
'use_config_enable_qty_increments' => 'use_config_enable_qty_inc'
);
}

/**
* Retrieve stock identifier
*
Expand Down
12 changes: 0 additions & 12 deletions app/code/core/Mage/Sales/Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,18 +423,6 @@ protected function _construct()
$this->_init('sales/order');
}

/**
* Init mapping array of short fields to
* its full names
*
* @return Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order');
return $this;
}

/**
* Clear order object data
*
Expand Down
11 changes: 0 additions & 11 deletions app/code/core/Mage/Sales/Model/Order/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@ protected function _construct()
$this->_init('sales/order_address');
}

/**
* Init mapping array of short fields to its full names
*
* @return $this
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order_address');
return $this;
}

/**
* Set order
*
Expand Down
11 changes: 0 additions & 11 deletions app/code/core/Mage/Sales/Model/Order/Creditmemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,6 @@ protected function _construct()
$this->_init('sales/order_creditmemo');
}

/**
* Init mapping array of short fields to its full names
*
* @return $this
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order_creditmemo');
return $this;
}

/**
* Retrieve Creditmemo configuration model
*
Expand Down
12 changes: 0 additions & 12 deletions app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,6 @@ public function setCreditmemo(Mage_Sales_Model_Order_Creditmemo $creditmemo)
return $this;
}

/**
* Init mapping array of short fields to
* its full names
*
* @return Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('creditmemo_item');
return $this;
}

/**
* Retrieve creditmemo instance
*
Expand Down
12 changes: 0 additions & 12 deletions app/code/core/Mage/Sales/Model/Order/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,6 @@ protected function _construct()
$this->_init('sales/order_invoice');
}


/**
* Init mapping array of short fields to its full names
*
* @return $this
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order_invoice');
return $this;
}

/**
* Load invoice by increment id
*
Expand Down
11 changes: 0 additions & 11 deletions app/code/core/Mage/Sales/Model/Order/Invoice/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,6 @@ function _construct()
$this->_init('sales/order_invoice_item');
}

/**
* Init mapping array of short fields to
* its full names
*
* @return Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('invoice_item');
return $this;
}
/**
* Declare invoice instance
*
Expand Down
12 changes: 0 additions & 12 deletions app/code/core/Mage/Sales/Model/Order/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,6 @@ protected function _construct()
$this->_init('sales/order_item');
}

/**
* Init mapping array of short fields to
* its full names
*
* @return Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order_item');
return $this;
}

/**
* Prepare data before save
*
Expand Down
11 changes: 0 additions & 11 deletions app/code/core/Mage/Sales/Model/Order/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,6 @@ protected function _construct()
$this->_init('sales/order_shipment');
}

/**
* Init mapping array of short fields to its full names
*
* @return $this
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('order_shipment');
return $this;
}

/**
* Load shipment by increment id
*
Expand Down
13 changes: 0 additions & 13 deletions app/code/core/Mage/Sales/Model/Order/Shipment/Track.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,6 @@ function _construct()
$this->_init('sales/order_shipment_track');
}

/**
* Init mapping array of short fields to
* its full names
*
* @resturn Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = array(
'number' => 'track_number'
);
}

/**
* Back compatibility with old versions.
*
Expand Down
14 changes: 1 addition & 13 deletions app/code/core/Mage/Sales/Model/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,6 @@ protected function _construct()
$this->_init('sales/quote');
}

/**
* Init mapping array of short fields to
* its full names
*
* @return Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('quote');
return $this;
}

/**
* Get quote store identifier
*
Expand Down Expand Up @@ -839,7 +827,7 @@ public function getItemById($itemId)
if ($item->getId() == $itemId) {
$quoteItem = $item;
return $quoteItem;
}
}
}
}
return $quoteItem;
Expand Down
11 changes: 0 additions & 11 deletions app/code/core/Mage/Sales/Model/Quote/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,6 @@ protected function _construct()
$this->_init('sales/quote_address');
}

/**
* Init mapping array of short fields to its full names
*
* @return $this
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('quote_address');
return $this;
}

/**
* Initialize Quote identifier before save
*
Expand Down
12 changes: 0 additions & 12 deletions app/code/core/Mage/Sales/Model/Quote/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,6 @@ protected function _construct()
$this->_errorInfos = Mage::getModel('sales/status_list');
}

/**
* Init mapping array of short fields to
* its full names
*
* @return Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap('quote_item');
return $this;
}

/**
* Quote Item Before Save prepare data process
*
Expand Down
7 changes: 0 additions & 7 deletions app/code/core/Mage/Sales/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1198,13 +1198,6 @@
</product>
</catalog>
<sales>
<old_fields_map>
<order>
<payment_authorization_expiration>payment_auth_expiration</payment_authorization_expiration>
<forced_do_shipment_with_invoice>forced_shipment_with_invoice</forced_do_shipment_with_invoice>
<base_shipping_hidden_tax_amount>base_shipping_hidden_tax_amnt</base_shipping_hidden_tax_amount>
</order>
</old_fields_map>
<quote>
<totals>
<nominal>
Expand Down
11 changes: 0 additions & 11 deletions app/code/core/Mage/Weee/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,6 @@
</weee>
</totals>
</order_creditmemo>
<old_fields_map>
<order_item>
<base_weee_tax_applied_row_amount>base_weee_tax_applied_row_amnt</base_weee_tax_applied_row_amount>
</order_item>
<invoice_item>
<base_weee_tax_applied_row_amount>base_weee_tax_applied_row_amnt</base_weee_tax_applied_row_amount>
</invoice_item>
<creditmemo_item>
<base_weee_tax_applied_row_amount>base_weee_tax_applied_row_amnt</base_weee_tax_applied_row_amount>
</creditmemo_item>
</old_fields_map>
</sales>
</global>
<adminhtml>
Expand Down
14 changes: 0 additions & 14 deletions app/code/core/Mage/Widget/Model/Widget/Instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,6 @@ protected function _construct()
}
}

/**
* Init mapping array of short fields to
* its full names
*
* @return Varien_Object
*/
protected function _initOldFieldsMap()
{
$this->_oldFieldsMap = array(
'type' => 'instance_type',
);
return $this;
}

/**
* Processing object before save data
*
Expand Down
30 changes: 0 additions & 30 deletions lib/Varien/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ class Varien_Object implements ArrayAccess
*/
public function __construct()
{
$this->_initOldFieldsMap();
if ($this->_oldFieldsMap) {
$this->_prepareSyncFieldsMap();
}

$args = func_get_args();
if (empty($args[0])) {
$args[0] = array();
Expand All @@ -123,31 +118,6 @@ protected function _addFullNames()
}
}

/**
* Inits mapping array of object's previously used fields to new fields.
* Must be overloaded by descendants to set concrete fields map.
*
* @return Varien_Object
*/
protected function _initOldFieldsMap()
{

}

/**
* Called after old fields are inited. Forms synchronization map to sync old fields and new fields
* between each other.
*
* @return Varien_Object
*/
protected function _prepareSyncFieldsMap()
{
$old2New = $this->_oldFieldsMap;
$new2Old = array_flip($this->_oldFieldsMap);
$this->_syncFieldsMap = array_merge($old2New, $new2Old);
return $this;
}

/**
* Internal constructor not depended on params. Can be used for object initialization
*/
Expand Down