// There can be reverse relationships used. If so, Workspaces can't do
// anything with them. Detect this and skip.
if ($table_info['join'
]->field != 'entity_id'
) { continue;
} // Get the dedicated revision table name.
$new_table_name =
$table_mapping->
getDedicatedRevisionTableName($field_storage_definitions[$field_name]);
// Now add the workspace_association table.
$workspace_association_table =
$this->
ensureWorkspaceAssociationTable($entity_type->
id(),
$query,
$relationship);
// Update the join to use our COALESCE.
$revision_field =
$entity_type->
getKey('revision'
);
$table_info['join'
]->leftFormula = "COALESCE(
$workspace_association_table.target_entity_revision_id,
$relationship.
$revision_field)";
// Update the join and the table info to our new table name, and to join
// on the revision key.
$table_info['table'
] =
$new_table_name;
$table_info['join'
]->table =
$new_table_name;
$table_info['join'
]->field = 'revision_id';