PHP警告 - yii \ base \ ErrorException缺少yii \ db \ Query :: join()的参数2,

时间:2017-06-09 15:47:43

标签: php mysql yii2

PHP警告 - yii \ base \ ErrorException缺少yii \ db \ Query :: join()的参数2,

代码中的错误是什么?请帮帮我

     $query = new Query; 
     $dataProvider = new ActiveDataProvider([
             'query'=> $query
                        ->select(['vchr_name','vchr_actual_hours','vchr_worked_hours','fk_int_payroll_month','fk_int_payroll_year'])
                        ->from('tbl_payroll')
                         ->join(['INNER JOIN','tbl_employee', 'TblEmployee.pk_int_emp_id=TblPayroll.fk_int_emp_id'])
                        ->where(['pk_int_payroll_id'=> $id])
                        ->One(),       

         ]);

1 个答案:

答案 0 :(得分:1)

根据http://www.yiiframework.com/doc-2.0/yii-db-query.html#join()-detail的文档,应该有4个join()参数。在你的情况下它应该是     ->join('INNER JOIN','tbl_employee', 'TblEmployee.pk_int_emp_id=TblPayroll.fk_int_emp_id', [])或者您可以省略最后的第4个非强制性参数。