Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2. $entity_type = "field_collection_item";
  3. $blueprint_obj = entity_create($entity_type, array('field_name' => "field_blueprints") );
  4. $blueprint_obj->setHostEntity('node', $order);
  5. $blueprint_entity = entity_metadata_wrapper($entity_type, $blueprint_obj);
  6. date_default_timezone_set("UTC");
  7. $blueprint_entity->field_blueprint_file->file->set((array)$file);
  8. $blueprint_entity->field_blueprint_comment = (string) $file->filename;
  9. $blueprint_obj->save();
  10. node_save($order);
  11.  
  12. EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityDrupalWrapper->set() (line 736 of /sites/masterprint/public_html/sites/all/modules/entity/includes/entity.wrapper.inc).
  13.  
  14. $blueprint_entity->field_blueprint_file->set((array)$file)
  15. $blueprint_entity->field_blueprint_file->set(array('fid'=>$file->fid))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement