Yii2 ActiveDataProvider find()->all()

Maybe i miss understand something about ActiveDataProvider, when i want to join table with ->joinWith('user_display')->all(); I've got error: The "query" property must be an instance of a class that implements the QueryInterface e.g. yii\db\Query or its subclasses.

public function search($params)
{
    $query = FinanceSettingsCheckoutcounter::find()->joinWith('user_display')->all();


    $dataProvider = new ActiveDataProvider([
        'query' => $query,
    ]);
    $this->load($params);

    if (!$this->validate()) {
        return $dataProvider;
    }

        return $dataProvider;
}

Upvotes: 1

Views: 3589

Answers (1)

ActivedataProvider needs a query. In your case you send the result of the query (all())

$query = FinanceSettingsCheckoutcounter::find()->joinWith('user_display');

Upvotes: 4

Related Questions