I want to use hook_query_alter to alter a query constructed by a module. This is the code I use:
function MYMODULE_query_alter($query) {
if ($query->hasTag('agent')) {
$query->fieldCondition('field_area', 'tid', 10, '=');
}
}
The code above gives a 500 error: Call to undefined method SelectQuery::fieldCondition()
What is the proper way to add a field condition to the query?
fieldCondition()
is a method from theEntityFieldQuery
class, it's not part of a standard database query.