-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: 1 | ||
* Date: 2016/9/6 | ||
* Time: 14:11 | ||
*/ | ||
|
||
namespace Home\Model; | ||
|
||
use Think\Model; | ||
use Think\Model\ViewModel; | ||
|
||
class ProductViewModel extends ViewModel | ||
{ | ||
//$viewFields 属性表示视图模型包含的字段,每个元素定义了某个数据表或者模型的字段 | ||
public $viewFields = array( | ||
'Blog'=>array('id','name','title'), | ||
'Category'=>array('title'=>'category_name', '_on'=>'Blog.category_id=Category.id'), | ||
'User'=>array('name'=>'username', '_on'=>'Blog.user_id=User.id'), | ||
); | ||
} |