diff --git a/src/ORM/ListDecorator.php b/src/ORM/ListDecorator.php index b350b994faa..9f3640e89f9 100644 --- a/src/ORM/ListDecorator.php +++ b/src/ORM/ListDecorator.php @@ -133,12 +133,19 @@ public function last() return $this->list->last(); } + public function getTotalItems() + { + 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 diff --git a/src/ORM/PaginatedList.php b/src/ORM/PaginatedList.php index e9b7546c6ad..554c1cb9b91 100644 --- a/src/ORM/PaginatedList.php +++ b/src/ORM/PaginatedList.php @@ -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(); } diff --git a/tests/php/ORM/GroupedListTest.php b/tests/php/ORM/GroupedListTest.php index 8b3ea9689af..51f214cc0b5 100644 --- a/tests/php/ORM/GroupedListTest.php +++ b/tests/php/ORM/GroupedListTest.php @@ -193,6 +193,6 @@ public function testTotalItems() ) ); - $this->assertEquals(4, $list->TotalItems()); + $this->assertEquals(4, $list->getTotalItems()); } } diff --git a/tests/php/ORM/ListDecoratorTest.php b/tests/php/ORM/ListDecoratorTest.php index e0c011a9009..cc67e3e6d58 100644 --- a/tests/php/ORM/ListDecoratorTest.php +++ b/tests/php/ORM/ListDecoratorTest.php @@ -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()