Yii 2 使用 ->all() 的 ActiveDataProvider 查询给出"Call to a member function andFilterWhere() on array"错误



我需要通过 ActiveDataProvider对象查看,我不明白为什么:

$query = Incarico::find();
$dataProvider = new ActiveDataProvider([
    'query' => $query,
]);

有效,而这是:

$query = Incarico::find()
    ->joinWith('allegatos')           
    ->all();
$dataProvider = new ActiveDataProvider([
    'query' => $query,
]);

给我以下错误:

在数组上致电成员函数和佛尔特where()

您不应将all()应用于$query,因为ActiveDataProvider CC_4属性期望有效的ActiveQuery实例在您传递该查询的结果时。

相关内容

最新更新