【发布时间】:2015-07-05 14:45:06
【问题描述】:
我在数据库中有一个表Have_Schedule(多对多关系),其中包含来自表的外键:
表学生:student_id,student_name
表时间表:sch_id、sch_day、sch_time
和
表 Have_Schedule : student_id, sch_id
我想像这样使用SqlDataProvider 创建DataProvider
$dataProvider = new SqlDataProvider([
'sql' => $sql,
'totalCount' => $n,
'key' => '', // <--------- the key
'sort' => [
'attributes' => [
'student_name',
'sch_day',
'sch_time',
],
],
'pagination' => [
'pageSize' => 20,
],
]);
密钥将用于ActionColumn,例如:/view?student_id=1&sch_id=2。
如何使用student_id 和sch_id 设置键值?
【问题讨论】:
标签: key yii2 dataprovider