$translatedVersionFieldName = null;
$versionJoin = '';
if ($definition->
isVersionAware()) { // field of the translated definition
$rootVersionFieldName = 'version_id';
// field of the translationDefinition
$translatedVersionFieldName =
$definition->
getEntityName() . '_version_id';
} $query =
$this->
getTranslationQuery($definition,
$translationDefinition,
$context->
getPath(),
$context->
getContext(),
$translatedVersionFieldName);
if ($rootVersionFieldName &&
$translatedVersionFieldName) { $variables['#rootVersionField#'
] =
$rootVersionFieldName;
$variables['#translatedVersionField#'
] =
$translatedVersionFieldName;
$versionJoin = ' AND #alias#.#translatedVersionField# = #on#.#rootVersionField#';
} $context->
getQuery()->
leftJoin( EntityDefinitionQueryHelper::
escape($context->
getAlias()),
'(' .
$query->
getSQL() . ')',
EntityDefinitionQueryHelper::
escape($alias),