Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • Chad - thanks for the response. Neither worked however. I have added some additional information to make sure I'm setting up my entity correctly. Also, had a typo - entity_metadata_wrapper - you missed the 'a' in metadata. Commented Nov 20, 2014 at 19:27
  • Can you execute the second set of code in devel using execute php code and create an entity? Commented Nov 20, 2014 at 19:45
  • Nope got the following error - EntityMetadataWrapperException: Entity property uid doesn't support writing. in EntityStructureWrapper->setProperty() (line 493 of /var/www/drupal7/sites/all/modules/contrib/entity/includes/entity.wrapper.inc). Commented Nov 20, 2014 at 20:07
  • What is your uid property? Is that your incremental value? If so then remove that as it should automatically generate the id for you Commented Nov 20, 2014 at 20:26
  • The code below creates an entity but not the attached fields global $user; $entity_notes_array = array(); $entity_notes_array['uid'] = $user->uid; $entity_notes_array['field_people_reference'] = 1; // Using 1 to test the reference $entity_notes_array['field_signed'] = 1; $entity_notes = entity_create('people_notes', $entity_notes_array); $entity_notes->save(); Commented Nov 20, 2014 at 20:26