Magento helper class is a singleton desin pattern

Magento did not mention this (or hide somewhere I could not find), so I’d like to mention it:

Magento helper class is a singleton desin pattern. Whether a helper class is called in a format as

Mage::helper('mymodule')->helperMethod();

or as (in a block class or a template),

$this->helper('mymodule')->helperMethod();

the helper class is only initialised once.

Which means Magento puts a singleton desin pattern on helpers.

One Reply to “Magento helper class is a singleton desin pattern”

Leave a Reply

Your email address will not be published. Required fields are marked *