View Model

I need to create the detail overview from 8 tables.

I have created model for all the 8 tables.

To achieve this, we need to make the custom function to get the data from these 8 models, also I feel it will take some time and looks bit complex to change the code again.

Is it possible to create the model for the view? any one tried?

I tried to create the model for the view instead of table , i am getting the following error

file_put_contents(/mypath/protected/runtime/gii-1.1.10/ModelCode.php): failed to open stream: Permission denied

Hi kumarkulandai,

Do you mean a CActiveRecord model for a database view?

The model generator of gii should create it when you select a database view instead of a table.

Hi Softark,

Thanks for your reply.

Do you mean a CActiveRecord model for a database view?

=> Yes I need to create the CActiveRecord model for a database view.

The model generator of gii should create it when you select a database view instead of a table.

=> In Model generator there is no option to select a database view, screenshot pasted below

currently I am using this version of gii

  • @author Qiang Xue <qiang.xue@gmail.com>

  • @version $Id: GiiModule.php 3426 2011-10-25 00:01:09Z alexander.makarow $

  • @package system.gii

  • @since 1.1.2

Just type the view name in the field for the table name. :)

Thanks Softark,

I tried in the same way got the following error

file_put_contents(/mypath/protected/runtime/gii-1.1.10/ModelCode.php): failed to open stream: Permission denied

to solve this permission 777 was set on the folder protected/runtime/gii-1.1.10, now was able to create the model for database view ;)