Then you need to create ActiveRecord that will be representing this view:
```php
namespaceapp\models\views\grid;
useyii\db\ActiveRecord;
classUserViewextendsActiveRecord
{
/**
* @inheritdoc
*/
publicstaticfunctiontableName()
{
return'vw_user_info';
}
publicstaticfunctionprimaryKey()
{
return['id'];
}
}
```
After that you can youse this UserView active record with search models, without additional specifying of sorting and filtering attributes.
All attributes will be working out of the box. Note that this approach has several pros and cons:
- you dont need to specify different sorting and filtering conditions and other things. Everything works out of the box;
- it can be much faster because of data size, count of sql queries performed (for each relation you will need additional query);
- since this is a just simple mupping UI on sql view it lacks of some domain logic that is in your entities, so if you will have some methods like `isActive`,
`isDeleted` or other that will influence on UI you will need to duplicate them in this class too.
### Multiple GridViews on one page
### Multiple GridViews on one page
You can use more than one GridView on a single page but some additional configuration is needed so that
You can use more than one GridView on a single page but some additional configuration is needed so that