Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP Pagination - how do I see the Paginator values from within the Controller?

Tags:

cakephp

I am using the CakePHP pagination helper within my controller as such

$this->paginate = array(
                    'Entity'    => array(
                            'limit'    => $limit,
                            'order'    => $order
                        )
                );

$entities = $this->paginate('Entity', $conditions);

Within my view, I am not using the $paginator variable to display the pagination navigation elements (ie total count, current page, total page...)

My question is: how do I access the $paginator variable from within the controller? I'm assuming it is set after the controller calls the $this->paginate method. I would like to see within the controller the total count of records that the paginate found.

like image 386
tomwag Avatar asked Aug 19 '11 14:08

tomwag


1 Answers

after calling the paginate() method, the results are stored in $this->params['paging'][YOUR_MODEL_NAME]

To see them:

pr($this->params['paging']);

Cheers

like image 189
pleasedontbelong Avatar answered Nov 10 '22 22:11

pleasedontbelong