Is it safe to clone a EntityMetadataWrapper Object? I want to clone an entity for multiple users, But some fields for each of them is different, Some fields are the same.

One way is to create the Entity for each:

// Doing in this in a loop for each user.
$e = entity_create('type', $info);
$e-&gt;{$same_field_for_all1}-&gt;set($value1);
$e-&gt;{$same_field_for_all2}-&gt;set($value2);
$e-&gt;{$same_field_for_all3}-&gt;set($value3);
$e-&gt;{$same_field_for_all4}-&gt;set($value4);
$e-&gt;{$fieldName}-&gt;set($this-&gt;getUserValue($user1, $fieldName));
// Set author and title for user here...
$e-&gt;save();


Another way is:

// Doing this only once
$e entity_create('type', $info);
$e-&gt;{$same_field_for_all1}-&gt;set($value1);
$e-&gt;{$same_field_for_all2}-&gt;set($value2);
$e-&gt;{$same_field_for_all3}-&gt;set($value3);
$e-&gt;{$same_field_for_all4}-&gt;set($value4);

// And doing this in a loop:
$clone = clone $e;
$clone-&gt;{$fieldName}-&gt;set($this-&gt;getUserValue($currntUser, $fieldName));
// Set author and title for user here...
$clone-&gt;save();


Is this sort of shallow cloning of EntityMetadataWrapper safe?
Well, It's not safe/ I don't know why yet, But, Sometimes it result in saving only last cloned entity.

It's not a good answer till it says why!