I have to make a view that shows unrelated data from multiple tables. I am new to cakePHP (and PHP in general) and as far as my understanding goes, each model is a depiction of just one table. I know that we can define associations with other tables, but in my case I need to give access to data that is no way related to the model who’s view will be opened.
Example:
Say there is a blogging platform and we are currently viewing a post. (Model – Post, function – Read). Now I want a list of (Say) subscribers of our newsletter. This data is not related to the model and hence, I don’t think the data will be accessible to the controller. Please tell me how to get this data in view directly.
In your controller, when defining the class, add a class attribute $uses to tell your controller which models to load.
And then, in your method, you just call that model: