I have read so many documentation about MVC. But I am still confused regarding the business logic in Magento. Can you please help me to explain business login in Magento with an example ?
1 Answer
Magento is configurational based MVC approach based on xml related files.XML file is entry point for any module.
MVC stand for Model view Controller and Magento contains both Controller and Model.
Business logic means Data related save(insert),update,delete,edit operations. In Magento All the data CRUD(create,read,update,delete) related operations are handle using model file.
Controller
is used for redirect url to proper place. its used for url management of sites.If you put domain logic in a controller, it's not as easy to share between different apps, or even between different controllers.
Controllers should be responsible for the data passing between model and view. Other than that it there should not be any unnecessary code. For example if you are logging it should be done at model level rather than controller.
You can get details information using example given by magento documntation. Refer link for Business logic
Hope this will help.
-
Rakesh, Controller is two way procedure ? I mean to say it is send/receive process ? Commented Apr 29, 2016 at 5:09
-
yes, its receive your post data and send to specific url using redirect management. Commented Apr 29, 2016 at 5:12
-
Actually, M2 moved away from MVC (just slightly): pmjones.io/adr Commented May 1, 2016 at 20:20