Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#1 | exported-sharemessage-translation-incompatibility-2356427-1.patch | 594 bytes | pivica |
Comments
Comment #1
pivica CreditAttribution: pivica at MD Systems GmbH commentedHere 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.
Comment #2
BerdirMoving 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.