Thanks Chris for the link. I've read that one too. And now, I may
conclude that I must rewrite the query for pagination purpose. Here's
the changed query:

$conditions = array( "Faculty.id" => $activeUser["faculty_id"],
"Document.created_date IN" => "-! ( SELECT created_date FROM ( SELECT
course_id, year, semester, max( created_date ) AS created_date FROM
documents GROUP BY course_id, year, semester ) AS A )", "1 = 1 GROUP
BY Document.id, Document.status, Document.year, Document.semester,
Course.id, Course.name, Major.id, Major.name" );
$this->paginate["fields"] = array( "Document.id", "Document.status",
"Document.year", "Document.semester", "Course.id", "Course.name",
"Major.id", "Major.name", "count( Document.id ) AS rev" );
$this->set( "data", $this->paginate( "Document", $conditions ) );

Btw, If I want to unbind the model just for specific function in
controller, can I use unbindModel function? Should I bind it again
after I use that one? I need that because, those snippet code above
still can't get the data I want because of the db schema have cycles.

And the last thing: is there a replacement for '-!' ? because the cake
told that it's deprecated.

Thanks in advance.
Roby.

On Jul 2, 11:57 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 2, 2008 at 11:41 AM,roby<[EMAIL PROTECTED]> wrote:
> > I know it's ridiculous but I don't know how to make it work with
> > paginate function in controller. I've read the bakery's Pagination 1.2
> > and still don't get how to make that query suitable for pagination.
>
> > Should I re-write the query? Anyone can help me how to make it fit
> > with findAll function/paginate function? Thanks in advance.
>
> I did a blog post about creating custom queries for pagination.  It
> might help you out:
>
> http://www.littlehart.net/atthekeyboard/2008/03/04/custom-cakephp-12-...
>
> --
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard:http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to