I have a custom entity with a file field accepting multiple values. I would like to set file values according to https://www.drupal.org/docs/7/api/entity-api/entity-metadata-wrappers#example-value-set-save but none of the two methods are working here. I always get this error
error php Error: Call to a member function set() on null in include().
I am running Drupal 7, file_entity
module enabled. Here follows the code:
$file = file_load(8172);
$wrapper = entity_metadata_wrapper('sys_ind', 13718);
$wrapper->field_allegati->file->set( $file );
$wrapper->save();