Skip to content

Commit 20e9fd2

Browse files
committed
Fix failing code in PaginatorComponent.
Instead of execute(), all() should be used now.
1 parent 2af4166 commit 20e9fd2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Cake/Controller/Component/PaginatorComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function paginate($object, array $settings = []) {
164164
$parameters = compact('conditions', 'fields', 'order', 'limit', 'page');
165165
$query = $object->find($type, array_merge($parameters, $extra));
166166

167-
$results = $query->execute();
167+
$results = $query->all();
168168
$numResults = count($results);
169169

170170
$defaults = $this->getDefaults($alias, $settings);

Cake/Test/TestCase/Controller/Component/PaginatorComponentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,15 +722,15 @@ protected function _getMockPosts($methods = []) {
722722
* @return Query
723723
*/
724724
protected function _getMockFindQuery() {
725-
$query = $this->getMock('Cake\ORM\Query', ['total', 'execute'], [], '', false);
725+
$query = $this->getMock('Cake\ORM\Query', ['total', 'all'], [], '', false);
726726

727727
$results = $this->getMock('Cake\ORM\ResultSet', [], [], '', false);
728728
$results->expects($this->any())
729729
->method('count')
730730
->will($this->returnValue(2));
731731

732732
$query->expects($this->any())
733-
->method('execute')
733+
->method('all')
734734
->will($this->returnValue($results));
735735

736736
$query->expects($this->any())

0 commit comments

Comments
 (0)