문제

I want to know why are the steps to extend magento controller different from model or block. Why cant a controller be extended like other magento classes are overridden? Why do we have to include the class file in the file which is extending it in case of controller?

도움이 되었습니까?

해결책

In short: This is how Magento was designed (not to allow override the controller as with Model, Helper and Block). I mean they are free to design the whatever they want.

In long: You can always instantiate Model, Block, Helper via Factory method, usually, Mage::getModel('your/model'), Mage::getBlock('your/block') and Mage::getHelper('module/helper'). However, it is not possible to instantiate controller this way.

The factory method Mage::getModel() checks all configurations files (usually files in et/config.xml of all modules) to determine overloading. However, Controller class are determined by Router based on complex, multi-level system routing.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top