Friday, August 28, 2009

Pagination Complex Query

Hi Guys,

I think I got interesting question for you all.

I have to paginate this query and since I am using paginate in this
controller in several actions I can't even override paginate method in
my model class.

I have to achieve this using bindModel kinda methods.

Simple Many-to-Many relationship

Authors M-t-M Titles

I have three tables, authors, authors_titles and titles

In authors_titles I have an extra field to store authors ownership
order

For example

authors authors_titles titles
1 Andrew 1 1 1 1
Math
2 John 2 1 2 2
Science
3 Peter 3 2 1
2 2 2
1 2 3

Here it means, Andrew is the first author of title (1 Math) and John
Second.

Now, I have to run query to find all the authors and count the number
of times, with whom author (1 Andrew) have worked and as what capacity
(means first author, second author etc)

Any help will be appreciated.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: