EntityMetadataWrapperException: Unable to set the data property value as the parent data structure is not set. in EntityStructureWrapper->setProperty() (line 456 of /home/****/workspace/drupal/community/entity/includes/entity.wrapper.inc).
when using wrapper to set an empty node entity text (sub part of struct 'text_with_summary') you get this error.
it's because 'auto creation' is not set at this point...
in entity_metadata_field_text_property_callback() of field.info.inc you have some code to add 'auto creation' in some condition...
if (empty($instance['settings']['text_processing'])) {
$property['property info'] = entity_property_field_item_textsummary_info();
// Enable auto-creation of the item, so that it is possible to just set
// the textual or summary value.
$property['auto creation'] = 'entity_property_create_array';
}
else {
// For formatted text we use the type name 'text_formatted'.
$property['type'] = ($field['cardinality'] != 1) ? 'list<text_formatted>' : 'text_formatted';
$property['property info'] = entity_property_text_formatted_info();
}
It seams to me that both part of "if" are array structs so $property['auto creation'] = 'entity_property_create_array'; could be put outside the "if"...
Comments
Comment #1
quazardous commentedPS : i m working on http://drupal.org/node/1033642 that is somewhat linked...
Comment #2
quazardous commentedmaybe it's more in entity_metadata_node_entity_property_info_alter()
Comment #3
fagoExactly for that to be supported, we need to add an auto-creation callback. Best, just use an callback that set ups the $item as usual but just with empty (NULL) values for the keys.
Comment #4
quazardous commentedsorry my english is so bad that i don't understand your point....
Comment #5
quazardous commentedI put a patch for this bug and #1033642.
Comment #6
quazardous commentedComment #7
fagoPatch looks good to me, but has some tabs in there. Please make sure to only use spaces for indention.
Comment #8
quazardous commentedI ve done a quick sed...
Comment #9
quazardous commentedComment #10
quazardous commentedup
Comment #11
fagothanks, committed.