I noticed that the save() method of EntityDrupalWrapper stores the value returned from entity_save() but does nothing, instead it returns $this. I am unsure whether this was a deliberate decision or not.
However it would be useful if the method returned the return value of entity_save() in order to detect success/failure of the operation (and for that matter, whether it was a create or update operation).

Comments

tnightingale’s picture

Title: Wrapper save method doesn't return status » EntityDrupalWrapper's save method - return value

Updating with a clearer title.

fago’s picture

Status: Active » Fixed

Yes, it has been chose to return $this in order to allow chained usage. Just check whether the entity is new before calling save(), if you need to know whether it is an insert or an update. In case of failures the wrappers always throw exceptions.

I've improved the docs to clarify the exception point.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.