2

How does Magento MVC differ from classical MVC or Zend Framework MVC? Any explanation will be appreciated.

7

While Magento's MVC uses the same base controller classes, almost everything else is custom. Off the top of my head.

  1. Module frontnames are defined in Magento's config.xml

  2. Since Magento has its own module structure, parsing the configuration to match a module front name with a module is completely custom, and is achieved in a match method in a series of custom router object

  3. The above mentioned routers have custom code for automatically requiring (vs. __autoload the base controller files.

  4. There's a configuration based and database based rewrite system for changing MVC routing logic

  5. Magento's event/observer system lets you inject your own router object which may change routing logic, or bypass it entirely

  6. The handoff from controller action to view is completly different — Magento has a view system/layout-object distinct from Zend Frameworks view system

| improve this answer | |
  • So basically Magento has configuration based MVC right? – Sukeshini Dec 4 '13 at 3:53
  • 1
    @Su123 In over simplified terms, yes — although an argument could be made that Magento's is a hybrid approach. – Alan Storm Dec 4 '13 at 4:31
  • 1
    :Exactly, due to observers/events Magento achieves the dynamic behavior and at the same time other MVC related stuff achieves continuous behavior. So in that case we can define Magento is a hybrid approach. Thanks a lot for the expalation. +1 – Sukeshini Dec 4 '13 at 4:47
  • Great analysis, thanks Alan! I know I often read similar oversimplifications regarding it being a Zend Framework, which is apparently "sort of" accurate...this helped me understand why :) – Bryan 'BJ' Hoffpauir Jr. Jul 30 '15 at 10:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.