Understanding Magento Core Override and reference

As a practice in Magento Development, all custom code/modification need to be made via local or community by overriding convention.

However sometime, you can’t override some Magento core classes and there is no available document explaining this problem clearly. I have decided to get deep into this issue and I found that only classes that are instantiated using Mage::getModel() can be overloaded.

Therefore, all classes instantiated directly with new operator are not possible to override. For example you can’t rewrite “Mage_Core_Model_App”, it is initialed on line 712 in Mage.php
self::$_app = new Mage_Core_Model_App();

Here is the short list of such classes

Please notice about difference between Overriden and Inheritance. “Overriden” is referred to cases when you want to modify a behavior of classes when they are called and used somewhere else in the system. While “Inheritance” meaning you want to reuse some methods from existing classes and just need to extend them for your modules. Then you can do it as usually.

Keyword : Magento, Magento Overriden, Magento Programming Practice, Magento Reference, Magento Override Problem

Leave a Reply

Your email address will not be published.

19 − 14 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>