paginate()
我想用我自己构建的数组来提供 CakePHP 的函数,如下所示:
class SomeController extends AppController {
var $paginate = array(
'limit' => 25,
'order' => array(
'Post.title' => 'asc'
)
);
public function index(){
$theArray = array(
array(
'Entity1'=>
array('id'=>1, 'someField'=>'value1'),
'SecondEntity'=>
array('id'=>1, 'fieldTwo'=>'reallyInteresting')
),
array(
'Entity1'=>
array('id'=>2, 'someField'=>'value2'),
'SecondEntity'=>
array('id'=>2, 'fieldTwo'=>'displayedValue')
)
);
$this->set('data',$this->paginate($theArray));
}
}
我该怎么做最简单的方法?