0

I went through some articles which describes Magento architecture.

As we all knows Magento uses MVC ( Model-View-Controller ) architecture. It separates the business logic, data access layer and user view.

Some articles say business logic resides in Block classes whereas some other articles say it is in Model classes (With respect to Magento modules). This is bit conflicting information.

Can anyone provide better explanation on this?

0

Magento controller is almost the same as other MVC design pattern

Magento Models includes business model and resource models, Each entity should have its business model, resource model and a collection. Business models talk to database entity through relative resource models. They do not talk directly to database.

Magento Views includes Blocks and Templates.

Each controller defines its relative blocks or load blocks dynamically according to layout xml configuration files.

Blocks ask for help from Business Models and Helpers for preparing data to Templates.

There are many more stuff inside magento but keep it simple like this helps me reading magento source more easily. I hope it helps you too.

0

MVC stands for Model-View-Controller. Any application that separates it’s data access, business logic and user interface is called MVC. There can be two types of MVC: convention-based and configuration-based.

Example, cakePHP is convention-based, i.e. you just need to follow the instructions of the core system to get your module ready in just few lines. Magento is configuration-based, i.e. you need to specify each and every thing to your module’s config file in order to get it work.

Blocks - Each Block object will render a specific bit of HTML. Block objects do this through a combination of PHP code, and including PHP .phtml template files. Blocks objects are meant to interact with the Magento system to retrieve data from Models, while the phtml template files will produce the HTML needed for a page

Models - Magento offers an Object Relational Mapping (ORM) system. ORMs get you out of the business of writing SQL and allow you to manipulate a datastore purely through PHP code (and other core business logics)

For more Information Magento for Developers: Part 1 - Introduction to Magento

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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