from multiple models and ordered by the same ORDER BY. But this means
probably that you have to use a custom query and I don't know if that
can be paginated!
Example:
(SELECT
a.id AS Result.id,
a.name AS Result.name,
a.created AS Result.created
FROM table_a AS a
WHERE xxx = yyy)
UNION
(SELECT
b.id AS Result.id,
b.name AS Result.name,
b.created AS Result.created
FROM table_b AS b
WHERE xxx = yyy)
UNION
(SELECT
c.id AS Result.id,
c.name AS Result.name,
c.created AS Result.created
FROM table_c AS c
WHERE xxx = yyy)
ORDER BY Result.created
I hope you get the idea :) Enjoy,
John
On Dec 24, 7:32 pm, Andrew <and...@websitesthatdostuff.com> wrote:
> Greetings, all,
> I know other people have worked on this before, but I haven't
> been able to find a solution so far. So, the long and short of it is
> that I've got multiple models that I want to mix into one view sorted
> by the date created.
>
> I've got a 'created' datetime field in the database already. I
> understand how to paginate each of the individual database calls and
> merging that info together, but that doesn't work with the core
> pagination stuff as I understand it. Do you have any suggestions for
> developing this?
>
> Also, I'd like to keep the number of database calls down, so any
> suggestions along those lines would be great. Thanks!
>
> ~Andrew
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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:
Post a Comment