I need to make a CakePHP helper which involves making some HTML dynamically. But the part of the code is to make 1-2 database queries. These queries are very essential for this helper as all the text it populates is inside the database.
According to MVC pattern, i should not be making the DB queries in the View (Helper). I am wondering what the best design would be for this case as i want it to align with PHPUnit testing also.
Any ideas would be welcome...
Since the
View
job is purely to display the (already available) information passed to it from theController
, I think it would be something like this:Your controller:
Your view: