What model do I need for siimple reporting?

Hi

I am new to Yii and more or less to the MVC pattern. I am trying to port a simple reporting web application. Most of the pages have a small form with 3-4 report parameters and then a table with the report itself (coming from a database). The user can change the parameters and then re-submit the report.

What would be the proper model to use for this? Do I need both a form model and a data model? Or one that combines both? I don’t think I need an ActiveRecord as there are no record level operations, right?

Any advice will be appreciated. Thanks in advance.

E

If you have to collect imput from user that will not be saved on database, like the parameters of the report, use CFormModel.

For the report, if is something of similar to db structure you can use the models of the table with proper condition.

Pay attention that active record are expensive in term of mermory, so use it only if you use paging and so you will not display many record in a page, otherways use direct connection to database.

So, the action will use first a CFormModel to validate the input and then another model (direct descendant of CModel) to get the report data, possibly with a CSqlDataProvider. And one view to render both the form and the report (the report in a CGridView?).

Am I getting the idea right?

Yeah, that is the idea.

If you want to use model, use model that extend CActiveRecord and that are based on some table, if not don’t use at allo model and use sqlDataProvider.