Monday, December 12, 2011

Paginator issue resolved: Incorrect documentation

Hi again,

Here's what I found out. Looking at the main Controller class in lib/
Cake/Controller, the phpdoc for the method paginate() says:

@deprecated Use PaginatorComponent instead

So, I changed my code to read:

$this->Paginator->settings = array(
'recursive' => 0,
'conditions' => array('Article.reporter_id' => 1)
);

$this->set('articles', $this->Paginator->paginate());

And now everything is working fine.

This is not mentioned in the documentation! Here:

http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html

It specifically recommends using the $paginate property and paginate()
method of the controller, but this does not work when setting
conditions and, as aforementioned, is deprecated. Moreover, the cake
baking process will generate controllers using the deprecated code.

Hope that info is helpful. Cheers,
-Brian

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate