Drupal 7 EntityFieldQuery OR Condition

drupal-7field

I've got a query going using EntityFieldQuery. I have two fields called field_tags and field_categories the column name I'm looking at in each is tid. I want to check each field for a matching tid. Each one is checking a separate array of tids.

Normally I would use something like:

$query->fieldCondition('field_tags', 'tid', $my_tags, 'IN');

But now, since I'm checking if there are any matches in the tags array for field_tags OR the categories array for field_categories, I don't know how to do it. The idea is that each row returned must match at least one tag or one category.

I know there has to be an OR condition in there somewhere…

Thanks,
Howie

Best Answer

Found this: http://treehouseagency.com/blog/fredric-mitchell/2012/02/21/or-queries-entityfieldquery which explains how to use a tag to later the query and incorporate an OR clause.

Related Topic