Skip to content

Commit e56742b

Browse files
authored
Show totalCount for total instead of page count (#152)
1 parent 023e630 commit e56742b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

plugins/collection-view/src/Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private function collection(mixed $resultSet): array
136136
$return[$collection][$first] = $this->paginator->first();
137137
$return[$collection][$last] = $this->paginator->last();
138138
$return[$collection][$pages] = $this->paginator->total();
139-
$return[$collection][$total] = intval($this->paginator->param('count'));
139+
$return[$collection][$total] = intval($this->paginator->param('totalCount'));
140140
}
141141

142142
if (empty($return[$collection][$first]) && !empty($return[$collection][$url])) {

plugins/collection-view/tests/TestCase/SerializerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public function test_as_json(): void
8585

8686
$obj = json_decode($json);
8787
$this->assertIsObject($obj);
88+
$this->assertEquals(20, $obj->collection->count);
89+
$this->assertEquals(60, $obj->collection->total);
8890
$this->assertEquals('/', $obj->collection->url);
8991
$this->assertCount(1, (array) $obj->data);
9092
}

0 commit comments

Comments
 (0)