diff --git a/includes/entity.property.inc b/includes/entity.property.inc index 58acd29..bb225db 100644 --- a/includes/entity.property.inc +++ b/includes/entity.property.inc @@ -251,8 +251,11 @@ function entity_property_verify_data_type($data, $type) { * The entity type to create an entity for. * @param $values * An array of values as described by the entity's property info. All entity - * properties of the given entiy type that are marked as required, are - * required. + * properties of the given entity type that are marked as required, must be + * present. + * If the passed values have no matching property, their value will be + * assigned to the entity directly, without the user of the metadata-wrapper + * property. * * @return EntityDrupalWrapper * An EntityDrupalWrapper wrapping the newly created entity or FALSE, if @@ -269,7 +272,12 @@ function entity_property_values_create_entity($entity_type, $values = array()) { $wrapper = entity_metadata_wrapper($entity_type, $entity); foreach ($values as $key => $value) { if (!in_array($key, $info['entity keys'])) { - $wrapper->$key->set($value); + if (isset($wrapper->$key)) { + $wrapper->$key->set($value); + } + else { + $entity->$key = $value; + } } } return $wrapper;