Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
aa61a97b
Commit
aa61a97b
authored
Jun 10, 2014
by
Mark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed notes and guide
parent
9a8f6766
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
output-data-widgets.md
docs/guide/output-data-widgets.md
+24
-1
No files found.
docs/guide/output-data-widgets.md
View file @
aa61a97b
...
...
@@ -361,13 +361,15 @@ In `search()` you then just add another filter condition with `$query->andFilter
> Info: For more information on `joinWith` and the queries performed in the background, check the
> [active record docs on eager and lazy loading](active-record.md#lazy-and-eager-loading).
#### Using sql views for filtering, sorting and displaying data
There is also other approach that can be faster and more useful - sql views. So for example if we need to show gridview
with users and their profiles we can do it in this way:
```
php
CREATE
OR
REPLACE
VIEW
vw_user_info
AS
SELECT
user
.*
,
user_profile
.
lastname
,
user_profile
.
firstname
FROM
user
s
,
user_profile
FROM
user
,
user_profile
WHERE
user
.
id
=
user_profile
.
user_id
```
...
...
@@ -395,6 +397,27 @@ class UserView extends ActiveRecord
return
[
'id'
];
}
/**
* @inheritdoc
*/
public
function
rules
()
{
return
[
// define here your rules
];
}
/**
* @inheritdoc
*/
public
static
function
attributeLabels
()
{
return
[
// define here your attribute labels
];
}
}
```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment