I am using Entity Query to select nodes of two different types. The fetching seems to be working, but I to sort the returned values. Both the content types have different date fields. I know I could do this with $query->addExpression('COALESCE( field_date_1, field_date_2)', 'Date'); $query->sort('Date', 'DESC');
but addExpression()
isn’t an existing method, and the code throws this exception.
Error: Call to undefined method DrupalCoreEntityQuerySqlQuery::addExpression()
How can I sort on more than 2 date fields?