Skip to content

Commit b0c39cb

Browse files
committed
WIP 2
1 parent fd50e64 commit b0c39cb

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

src/actions/ListForIdentityAction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ protected function prepareDataFilter($requestParams)
113113
protected function prepareParentQuery(ActiveQueryInterface $query):ActiveQueryInterface
114114
{
115115
$userId = Yii::$app->user->id;
116+
$condition = [];
116117
$condition[$this->modelTable().'.'.$this->userIdAttribute] = $userId;
117118
$query->where($condition);
118119
return $query;

src/providers/JsonApiActiveDataProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ public function setPagination($value):void
6363
if (!$this->_pagination instanceof JsonApiPaginator) {
6464
throw new InvalidArgumentException('Only JsonApiPaginator instance or false allowed');
6565
}
66+
$this->_pagination->totalCount = $this->getTotalCount();
6667
} elseif ($value instanceof JsonApiPaginator || $value === false) {
6768
$this->_pagination = $value;
69+
if ($value instanceof JsonApiPaginator) {
70+
$this->_pagination->totalCount = $this->getTotalCount();
71+
}
6872
} else {
6973
throw new InvalidArgumentException('Only JsonApiPaginator instance, configuration array or false is allowed.');
7074
}

tests/testapp/config/api.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@
5858
'validationErrorFormat' => JsonApiErrorHandler::ERROR_FORMAT_SPEC
5959
],
6060
'log' => [
61-
'traceLevel' => YII_DEBUG ? 3 : 0,
61+
'traceLevel' => 3,
6262
'targets' => [
6363
[
6464
'class' => yii\log\FileTarget::class,
65-
'levels' => ['error', 'warning'],
6665
'logFile' => '/tmp/yii2-fractal-test-error.log',
6766
'logVars' => ['_GET', '_POST']
6867
],
@@ -127,4 +126,4 @@
127126
],
128127
],
129128
],
130-
];
129+
];

tests/testapp/config/console.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,15 @@
2424
'password' => 'dbpass',
2525
'charset' => 'utf8',
2626
],
27+
'log' => [
28+
'traceLevel' => 3,
29+
'targets' => [
30+
[
31+
'class' => yii\log\FileTarget::class,
32+
'logFile' => '/tmp/yii2-fractal-test-error.log',
33+
'logVars' => ['_GET', '_POST']
34+
],
35+
],
36+
],
2737
],
28-
];
38+
];

0 commit comments

Comments
 (0)