I understand how to query a table with Yii's active record environment. I can't find documentation for calling a mysql view. Also, I know how to model a table in active record with the gii tool, but is there a way to do this for a database view?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
It should work fine in the same way as with tables. Just use the view name when you generate the model.
Please read Joshua's answer and learn how to add primary Key into the OOP model for views.
I am not having the same experience and this comment is for those who are having trouble.
Using a mysql view with some joins and calculations I get the following error..
app\\models\\db\\WarComplete must have a primary key.
I resolved this by adding...
... to my model override.