gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 19:37:44 26 4
gpt4 key购买 nike

我需要传递 ActiveDataProvider 对象来查看,但我不明白为什么会这样:

$query = Incarico::find();

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

有效,而这个:

$query = Incarico::find()
->joinWith('allegatos')
->all();

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

给我以下错误:

Call to a member function andFilterWhere() on array

最佳答案

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

关于php - Yii 2 ActiveDataProvider 查询 ->all() 给出 "Call to a member function andFilterWhere() on array"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30257838/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com