database - Pagination in CakePHP omits fields existing in model, coincident with Datatable Component? -
there behavior don't understand.
$test1 = $this->post->find('all'); debug($test1);
it delivers expected array of posts fields of model each post in array:
id, field 1, field 2, field 3 ...
if i´m using following syntax:
$test2 = $this->paginate('post'); debug($test2);
it shows expected array of posts fields of model each post in array:
id, field 2, field 5, field 14
why output occur when using paginate()-method
? how same output paginate()-method
find()-method
?
if further code needed, please tell me.
any appreciated.
update 1:
i found out datatable-component loaded here: https://github.com/cnizzdotcom/cakephp-datatable have influence on weird behaviour. didn´t find out how yet ...
i got solution. assumed problem datatable-component. in controller multiple paginate() calls , last 1 field-assignments saved in ´$this->paginate´ variable. when run cakes normal pagination without setting fields, variable used , sets fields gave datatable. solution set
$this->paginate = array( 'fields' => array('post.*') );
in fron of paginate()-calls. scrappy cocco giving hint asterisk.
Comments
Post a Comment