Problem: if you pass a stdClass Object to entity_save() some follow-up modules like Rules assume that they get a full object and invoke methods on it. This leads of course to a fatal error.

Call to undefined method stdClass::type() in modules/entity/includes/entity.property.inc

Here is a patch that uses either a newly created entity class or an existing loaded entity for saving. And I did a little code cleanup, removed totally useless lines.

CommentFileSizeAuthor
me-profile2-classes.patch2.3 KBklausi

Comments

mikeryan’s picture

Status: Needs review » Needs work

Can you explain a bit what is "totally useless" about the lines you're removing? Do you mean that they're now unnecessary due to the entity_create() call?

Thanks.

klausi’s picture

Status: Needs work » Needs review

Sure:
"created": this has been added only recently to profile2, so this should probably stay.
"vid": property does not exist in profile2
"status": property does not exist in profile2
"language": property does not exist in profile2
"revision": property does not exist in profile2

mikeryan’s picture

Status: Needs review » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

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