When a sharemessage is exported into a feature it looks like this:

"rdf_mapping" : [],
  "translations" : {"original":"de","data":{"de":"entity_type":"sharemessage","entity_id":"16","language":"de","source":"","uid":"0","status":"1","translate":"0","created":"1411974632","changed":"1411974632"}

This is causing the following notices when clearing the cache:

Notice: Trying to get property of non-object in entity_translation_sync() (Zeile 985 von /home/data/businesscampaigning/businesscampaigning.staging.kampaweb.ch/www/profiles/kampatools/modules/contrib/entity_translation/entity_translation.module).
Warning: Attempt to modify property of non-object in EntityTranslationDefaultHandler->setTranslation() (Zeile 519 von /home/data/businesscampaigning/businesscampaigning.staging.kampaweb.ch/www/profiles/kampatools/modules/contrib/entity_translation/includes/translation.handler.inc).
Warning: Attempt to modify property of non-object in EntityTranslationDefaultHandler->setTranslation() (Zeile 521 von /home/data/businesscampaigning/businesscampaigning.staging.kampaweb.ch/www/profiles/kampatools/modules/contrib/entity_translation/includes/translation.handler.inc).
Warning: Attempt to assign property of non-object in EntityTranslationDefaultHandler->setOriginalLanguage() (Zeile 711 von /home/data/businesscampaigning/businesscampaigning.staging.kampaweb.ch/www/profiles/kampatools/modules/contrib/entity_translation/includes/translation.handler.inc).
Notice: Trying to get property of non-object in EntityTranslationDefaultHandler->saveTranslations() (Zeile 421 von /home/data/businesscampaigning/businesscampaigning.staging.kampaweb.ch/www/profiles/kampatools/modules/contrib/entity_translation/includes/translation.handler.inc).

Happened with the following module versions:

  • features 7.x-2.0
  • entity_translation 7.x-1.0-beta3
  • entity 7.x-1.5
  • sharemessage 7.x-1.x-dev of 2013-10-09
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pivica’s picture

Here is a first patch. Problem is that entity_translation is expecting that node->translations is object - and when sharemessages entities are rebuild from exported features we will get arrays by default.

This patch will fix this, i am just thinking that features or entity_translation modules should maybe handle this?

One other issue that had same problem https://www.drupal.org/node/2361489.

Berdir’s picture

Title: Export of sharemessage in features causes problems » Export of entity with translations metadata in features causes notices
Project: Share Message » Entity API
Component: Code » Core integration
Issue tags: +Needs issue summary update

Moving to entity module.

The problem is that translations is an object, but the default import method uses drupal_json_decode(), which converts everything to an array. I think should be fixed in the default import() method and converted back there. There is no generic hook for this, so entity_translation can't do this for all entity types, has to be in entity.module.