Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/ORM/ListDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,19 @@ public function last()
return $this->list->last();
}

public function getTotalItems()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't use int as the return type because that would require changing it in PaginatedList::getTotalItems() as well, which is a breaking change

{
return $this->list->count();
}

/**
* @return int
* @depreated 5.4.0 Use getTotalItems() instead.
*/
public function TotalItems()
{
return $this->list->count();
Deprecation::notice('5.4.0', 'Use getTotalItems() instead.');
return $this->getTotalItems();
}

public function Count(): int
Expand Down
2 changes: 2 additions & 0 deletions src/ORM/PaginatedList.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,11 @@ public function PrevLink()

/**
* Returns the total number of items in the list
* @depreated 5.4.0 Use getTotalItems() instead.
*/
public function TotalItems()
{
Deprecation::notice('5.4.0', 'Use getTotalItems() instead.');
return $this->getTotalItems();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/php/ORM/GroupedListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,6 @@ public function testTotalItems()
)
);

$this->assertEquals(4, $list->TotalItems());
$this->assertEquals(4, $list->getTotalItems());
}
}
2 changes: 1 addition & 1 deletion tests/php/ORM/ListDecoratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function testLimit()
public function testTotalItems()
{
$this->list->expects($this->once())->method('count')->willReturn(5);
$this->assertSame(5, $this->decorator->TotalItems());
$this->assertSame(5, $this->decorator->getTotalItems());
}

public function testAdd()
Expand Down