The fields() method doesn't produce any useful mapping destination for entity properties that are in its base table, unless the custom entity provides entity info, either through its own hook_entity_property_info() or indirectly via EntityAPI and a custom metadata controller class.

Would be very handy if the class docs for MigrateDestinationEntityAPI mentioned this!

Comments

joachim’s picture

Status: Active » Needs review
StatusFileSize
new646 bytes

Yup, this is because EntityDefaultMetadataController doesn't add getter or setter callbacks to the entity property info it produces.

Here's a docs patch.

joachim’s picture

Status: Needs review » Needs work

Patch needs work.

Still working this out....

From entity.api.php:

 *     - getter callback: (optional) A callback used to retrieve the value of
 *       the property. Defaults to entity_property_verbatim_get().
 *       It is important that your data is represented, as documented for your
 *       data type, e.g. a date has to be a timestamp. Thus if necessary, the
 *       getter callback has to do the necessary conversion. In case of an empty
 *       or not set value, the callback has to return NULL.
 *     - setter callback: (optional) A callback used to set the value of the
 *       property. In many cases entity_property_verbatim_set() can be used.

Entity API provides a default getter callback, but not a setter, it would seem. Hence the text in my patch needs tweaking to just mention setters, not getters.

joachim’s picture

Status: Needs work » Needs review
StatusFileSize
new805 bytes

Here's an updated patch.

mikeryan’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

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