Best Practice - Searches that span multiple models

Hi,

I was wondering if the best practice to make an advanced search that spans many models is through a custom search model that extends CFormModel and then to deserialize the search object into a session variable to set on $crit across various controllers? This is a closed system with few users so I’m not so worried about saving an object to memory.

Many thanks for any insights or a better way.

Hi, this wiki covers CGridView searching (filtering) across models. Is this what you need?

http://www.yiiframework.com/wiki/323/dynamic-parent-and-child-cgridciew-on-single-view-using-ajax-to-update-child-gridview-via-controller-with-many_many-relation-after-row-in-parent-gridview-was-clicked/

thanks, that’s a great link that I haven’t seen yet… i’ll have a read…

just to clarify though, we’re really looking to make an advanced “search panel” view … not necessarily as interested in a dynamic “result view” … an advanced view with date ranges and fields and dropdowns from across all models… maybe even a collection of fields or search concepts that don’t tie down to one single model field… we were then thinking of using DAO inside the Search Model to build the sql statement and save the state of the search fields… something like a global search represented as a session object…

then we’d pass the result to a table structure (or grid) … we might even have several views for viewing the same data …

i’ll read the article as well but does anybody see any drawback to that method?

many thanks