tableau-mkt-archived / entity_xliff

Drupal module that provides an API for entity serialization in the XLIFF format.
https://drupal.org/project/entity_xliff
2 stars 0 forks source link

Fatal error when importing translation which includes new embedded entities #80

Closed iamEAP closed 8 years ago

iamEAP commented 8 years ago

Suppose you have a set of nodes that are part of a translation set...

Suppose you then add a field collection or paragraph item field to the content type, and populate the field collection / paragraph on the source language node.

If you export an XLIFF file from the source language, then attempt to import a translation, you will get an error like the following:

Recoverable fatal error: Argument 1 passed to EntityXliff\Drupal\Translatable\Content\FieldCollectionTranslatable::getHostEntity()
must be an instance of FieldCollectionItemEntity, boolean given,
called in /path/to/src/Drupal/Translatable/Content/FieldCollectionTranslatable.php on line 57
and defined in EntityXliff\Drupal\Translatable\Content\FieldCollectionTranslatable->getHostEntity()
(line 118 of /path/to/src/Drupal/Translatable/Content/FieldCollectionTranslatable.php).

Because, when it attempts to set the new embedded entity content values on the existing translation, it has no entity to set against...

This is not a problem for net-new translations in a set because the original content of the embedded entities is first duplicated.

iamEAP commented 8 years ago

Further investigation reveals this to be true for entity references as well.