Search query on related fields

Discuss about Group-Office development here

Moderator: Developers

Posts: 28
Joined: Wed Aug 24, 2005 10:22 pm
Location: Venice, FL

Search query on related fields

Postby glemigh » Mon Jun 09, 2014 9:30 pm

Please forgive me since I have avoided ORM/ActiveRecord completely until GO6 beta arrived.

I seem to be having trouble getting the grid search to search a field in a relationship.

A prime example would be to go to the Presidents module and search for a party such as "whig" and you will see no results.

Any suggestions as to what I should be looking for, or missing?

Thank you,

Site Admin
Site Admin
Posts: 8354
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch

Re: Search query on related fields

Postby mschering » Tue Jun 10, 2014 1:44 pm


$findParams->joinRelation("somerelation')->select(t.*, somerelation.somecolumn AS somecolumn);

This will join the relation asn seleect somecolumn on which you can search.

Add the field as one of the search fields like this:

$searchFields = GO_Example_Model_SomeModel::model()->getFindSearchQueryParamFields();

Best regards,

Merijn Schering

Who is online

Users browsing this forum: No registered users and 5 guests