2
我想用一個數組我已經建立了自己養活CakePHP的paginate()
功能,像這樣:CakePHP的:餵養PAGINATE()使用自定義數組
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));
}
}
我怎麼做最簡單的方法?