public function actions()
{
$actions = parent::actions();
unset($actions['create'], $actions['delete'], $actions['index']);
$actions['index']['prepareDataProvider'] = [$this, 'prepareDataProvider'];
// echo "<pre>";
// var_dump('aaaaaaaa');
// echo "</pre>";
// die;
return $actions;
}
public function prepareDataProvider()
{
$query = FavoriteBook::find()
->andWhere(['user_id' => Yii::$app->user->id]);
return new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => Yii::$app->request->get('per-page', 10),
],
'sort' => [
'params' => Yii::$app->request->get(),
]
]);
}
When Accessing my local server: http://ecommerce-book-backend.test/favorite-book
I got Object configuration must be an array containing a “class” or “__class” element.
I followed the documentation in that phase what am I doing wrong that is causing that?