Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Since the entity storage controller may support multilingual properties, there may be cases where different conditions on different languages may be needed. A new EntityFieldQuery::propertyLanguageCondition() has been added to address this need. The new method matches the existing EntityFieldQuery::fieldLanguageCondition() one, as it allows to specify which language a particular set of conditions and order settings should have. To exploit it an optional grouping parameter has been added to EntityFieldQuery::propertyCondition() and EntityFieldQuery::propertyOrderBy(). For example:

<?php
  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'entity_test');
  // Find all English entities.
  $query->entityCondition('langcode', 'en');
  // Having the specified English values for uid and name.
  $query->propertyCondition('uid', $uid, '=', 'original');
  $query->propertyCondition('name', $name, '=', 'original');
  $query->propertyLanguageCondition('en', '=', 'original');
  // And having the specified Italian value for name.
  $query->propertyCondition('name', $name_it, '=', 'translation');
  $query->propertyLanguageCondition('it', '=', 'translation');
  // Order the result set by the English name.
  $query->propertyOrderBy('name', 'ASC', 'original');
  $result = $query->execute();
?>

Without specifiying two different language groupings there would be no way to apply both name conditions, as they would mutually exclude each other.

Impacts: 
Module developers