Reputation: 54949
We are trying to profile accounts to build data that we want to compare against other accounts. For this we are using Mysql Views. I was wondering how to use the same using CakePHP
Upvotes: 1
Views: 3195
Reputation: 4856
A view in MySQL is much like a table. So you can get the data in a view by calling it with a query:
$this->AnyModelName->query("SELECT * FROM my_view_1 WHERE 1");
You can also try to write a model that initially has $this->useTable
set to false. Then if you define your own constructor for this class you may be able to initialize it with a different view every time. Check the Model documentation: API & Book.
Upvotes: 2