Magento 1.8 Registry – Updating the Mage Registry in Magento 1.8

magento-1magento-1.8registry

I was just wondering if it was possible to update the value of a key in the Mage::registry without unsetting and resetting the item in the registry.

e.g.

$ids = array('1', '2', '3');
Mage::register('testing-key', $ids);

$re_ids = Mage::registry('testing-key');
$re_ids[] = '4';

Mage::registry('testing-key') = $re_ids;

Best Answer

No, unfortunately, the Mage class only provides three different methods to deal with the registry:

  • register
  • unregister
  • registry

Thus, you will have to call unregister then register again if you want to update an entry in the registry.

Related Topic