Skip to content

Commit

Permalink
Show totalCount for total instead of page count
Browse files Browse the repository at this point in the history
  • Loading branch information
cnizzardini committed Feb 18, 2024
1 parent 023e630 commit 80d92c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/collection-view/src/Serializer.php
Expand Up @@ -136,7 +136,7 @@ private function collection(mixed $resultSet): array
$return[$collection][$first] = $this->paginator->first();
$return[$collection][$last] = $this->paginator->last();
$return[$collection][$pages] = $this->paginator->total();
$return[$collection][$total] = intval($this->paginator->param('count'));
$return[$collection][$total] = intval($this->paginator->param('totalCount'));
}

if (empty($return[$collection][$first]) && !empty($return[$collection][$url])) {
Expand Down
2 changes: 2 additions & 0 deletions plugins/collection-view/tests/TestCase/SerializerTest.php
Expand Up @@ -85,6 +85,8 @@ public function test_as_json(): void

$obj = json_decode($json);
$this->assertIsObject($obj);
$this->assertEquals(20, $obj->collection->count);
$this->assertEquals(60, $obj->collection->total);
$this->assertEquals('/', $obj->collection->url);
$this->assertCount(1, (array) $obj->data);
}
Expand Down

0 comments on commit 80d92c2

Please sign in to comment.