Dear all, I really need help for pagination feature in CakePHP 1.2
RC1. I have this query:
function findSAPDataByFaculty( $id )
{
return $this->query( "SELECT Document.id, Document.status,
Document.year, Document.semester, Course.id, Course.name, Major.id,
Major.name, B.rev AS rev FROM documents AS Document LEFT JOIN courses
AS Course ON Course.id = Document.course_id LEFT JOIN majors AS Major
ON Major.id = course.major_id LEFT JOIN faculties AS Faculty ON
Faculty.id = major.faculty_id INNER JOIN ( SELECT course_id, year,
semester, max( created_date ) AS created_date FROM documents GROUP BY
course_id, year, semester ) AS A ON A.created_date =
Document.created_date INNER JOIN ( SELECT course_id, year, semester,
count( id ) AS rev FROM documents GROUP BY course_id, year, semester )
AS B ON B.course_id = Document.course_id AND B.year = Document.year
AND B.semester = Document.semester WHERE Faculty.id = ".$id." ORDER BY
Document.year DESC, Document.semester DESC, Document.status,
Course.id" );
}
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.
Roby.
OOT: I don't know why but I remember that I was registered to this
group last time (about one-two weeks ago). And now, I should register/
join again. Anyone know why?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---