2017-06-09 62 views
0

PHP Warning - yii \ base \ ErrorException缺少yii \ db \ Query :: join()的參數2,

代碼錯誤是什麼?請幫我PHP Warning - 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

根據文檔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個非必需參數。

+0

謝謝你的工作.. –

+0

我如何加入3個表格 –

+0

只需使用一個 - >加入後你有 –