I’m new to Yii so forgive me if this is a stupid question.
I’m trying to perform a search on a list of blog posts in a blog I’m working on. In this system, it’s only possible to see blog posts that you either own, or subscribe to. So, I have the owner_id in the ‘posts’ table, and then a separate ‘subscriptions’ table linking user_ids with post_ids.
'posts' table structure:
post_id
post_name
post_content
post_owner
'post_subscribers' table structure:
id
subscriber_id (a users id)
post_id
First, I’m not sure how to best execute the query. I’ve got a custom query right now that’s returning a list of post objects. However, my main question is this:
How do I render the result? Do I put it in a CFormModel? Do I put it in the Posts model and not save it? I should be able to use the Posts view because the resulting data structure is identical, but I don’t know how to properly feed it into the view.
Any help here is much appreciated.