Get image url from model good practice? |
(11-10-2015, 01:16 AM)Martin7483 Wrote: 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. Thank you. Helped a lot, see my last post with my class and tell me if I can refactor something. Then in my controller I have: PHP Code: $best_offer = new Product($this->products->best_offer(), 270); Is this the best practice MVC and OOP? |
Welcome Guest, Not a member yet? Register Sign In |