I am working on a presentation for a blog that mixes blog posts, comments, and uploaded media elements into one large grid layout. I created separate models in CakePHP and 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 dataset, which I can then paginate.
I already have a "created" datetime field in the database. I understand how to split every single database call with CakePHP PaginationHelper. I also combined arrays. However, mixing the individual database queries and then joining the arrays seems to break the pagination, as it does not work with PaginationHelper(as I understand it).
Do you have any suggestions on this?
In addition, I would like the number of database calls to be reduced, so any suggestions on these lines would be great. Thank!
~ Andrew
source
share