Welcome Guest, Not a member yet? Register   Sign In
Get image url from model good practice?

In the world of MVC each request is routed to a Controller. You could ignore the M and V completely and do everything in your controller. But you will quickly see that this means duplicating a lot of code. So you start to use Models for Database communication. In your models you perform some logic to the DB results and return it to your controller. Again you will start to notice code duplication. So you start using helpers for common functions and libraries for more complex data handling. And thus you may start to use a business layer for your models.

I would say your Product class is a library and you pass a data package to this class. So how you call this could be
1. Controller --> request data from your model and return to Controller
2. Controller --> pass the data to the Product class and return to Controller
3. Controller --> pass the data to the view

Hopes this helps you out

Messages In This Thread
RE: Get image url from model good practice? - by Martin7483 - 11-10-2015, 01:16 AM

Theme © iAndrew 2016 - Forum software by © MyBB