yii2-redis
yii2-redis copied to clipboard
Restful resources pagination with [yii\redis\ActiveRecord] + [yii\data\ActiveDataProvider] problem
This issue has originally been reported by @phuczeero at https://github.com/yiisoft/yii2/issues/12961. Moved here by @samdark.
What steps will reproduce the problem?
Token.php
namespace app\models;
class Token extends \yii\redis\ActiveRecord
{
public function attributes()
{
return ['id', 'token', 'user_id'];
}
}
TokenController.php
namespace app\modules\v2\controllers;
use app\models\Token;
class TransferController extends \yii\rest\Controller
{
public function actionIndex()
{
return new \yii\data\ActiveDataProvider([
'query' => Token::find()->where([
'user_id' => Yii::$app->user->id,
]),
]);
}
}
What is the expected result?
X-Pagination-Current-Page →1
X-Pagination-Page-Count →2
X-Pagination-Per-Page →20
X-Pagination-Total-Count →30
What do you get instead?
X-Pagination-Current-Page →1
X-Pagination-Page-Count →0
X-Pagination-Per-Page →20
X-Pagination-Total-Count →0
Additional info
Q | A |
---|---|
Yii version | 2.0.10, master |
PHP version | 7.0.0 |
Operating system | 64-bit Windows 7 Professional SP1 |
up
Am also facing the same issue, anyone with a solution for it?