I'm working on a view for a blog that mixes blog posts, comments, and uploaded media items into one large grid layout. I've set up the individual models in CakePHP and the associations, some of which are as follows:
Comment BelongsTo Post or Media
Post HasMany Media
What I'm working with is trying to sort all three models (Comment, Media, Post
) into one large array of data which I can then paginate.
I've got a 'created' datetime field in the database already. I understand how to paginate each of the individual database calls using the CakePHP PaginationHelper
. I also have merged the arrays. However, mixing individual database calls and then merging the arrays seems to break the pagination as it doesn't work with the PaginationHelper
(as I understand).
Do you have any suggestions for doing this?
Also, I'd like to keep the number of database calls down, so any suggestions along those lines would be great. Thanks!
~Andrew