I'm writing a plugin for migrating to entities based on the Entity API (commerce, og, all contrib around them).
Currently, Entity API promotes using their own controller, and placing custom logic (initializing defaults, pre/post load, save, etc) in an entity class.
So a custom_example entity is in fact an instance of it's class, for example EntityCustomExample.
Commerce doesn't use this pattern (yet), but Og, and the contribs do.

Since MigrateFieldsEntityHandler assumes $entity is an stdClass, I need to cast and recast the $entity several times (once for prepare, then back for save, then once again for complete), which is very ugly.

So, consider this patch.

CommentFileSizeAuthor
#3 1132034_followup.patch1.13 KBbojanz
fields.patch6.78 KBbojanz

Comments

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Seems reasonable to me.

mikeryan’s picture

Status: Reviewed & tested by the community » Fixed

Committed to D6 and D7 branches, and also made corresponding changes to migrate_extras. Anyone who has implemented field handlers will need to be sure to remove stdClass from the prepare() and complete() signatures.

Thanks!

bojanz’s picture

Status: Fixed » Needs review
StatusFileSize
new1.13 KB

Okay, I missed one, the path destination handler.
Here's a followup.

Thank you for the quick replies yesterday.

mikeryan’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

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