Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Model, View Controller (MVC)
 
gamelodge
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2007-08-31
Brisbane, Qld, Australia
 

This may be a silly question.

I am unsure about MVC pattern and placement of code especially with reference to:
http://www.magentocommerce.com/wiki/Designing-for-Magento/ (fixed)
there is mention of changing the model to manipulate actions and templates ie: 

Depending on our needs we can write custom functions in our Models and than assign a template depending on parameters returned by a function.

just before the addCss section

I am not sure how MVC is implemented here, my understanding is the the Model layer is mainly for Databse interaction which then hands info to the controller, also looking at the files the files under the Model folders do a lot of work.

what is the criteria for adding stuff to a model instad of a controller for magento?

this may be the wrong section of the forum, but i thought i would add it here as i am talking about how the model is related to the view based on the above wiki link.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

The actual link is here: http://www.magentocommerce.com/wiki/Designing-for-Magento/

Thank you for reading carefully the post. It should have been read as “blocks” not “models”.

The charts explaining the architecture of Magento will be posted as soon as we’ll get to it, but meanwhile here’s short overview:

- Model
To allow greater flexibility with backend implementations, we have splited these to Object Models and Resource Models. Object Models are responsible for abstract logic of the models and Resource Models are for engine specific logic.

- View
Here we have Layouts, Blocks and Templates. Layouts are XML files defining Blocks tree structure and specifying Templates for them to use.

- Controller
these are the Zend_Controller_Action compatible classes.

Let me know if you have more questions smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
gamelodge
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2007-08-31
Brisbane, Qld, Australia
 

Hi Moshe

Thank you, will wait for charts & architecture, for a better understanding, just want to know if this is a standard pattern that you guys decided to follow, or if its a new concept you have come up with ie is it a standard documentent pattern that i can read up on a litlte more at wikipedia or somewhere?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jrochman
Jr. Member
 
Total Posts:  24
Joined:  2007-09-05
 

Although related to another Open Source program, this article is an interesting read for describing how it relates to the MVC model:

http://modxcms.com/transforming-modx-oo-mvc-orm.html

Check out his references for even more in-depth discussions on elements of the MVC

Also, here is the Wiki article on MVC:

http://en.wikipedia.org/wiki/Model-view-controller

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top