Hi,
I'm using UUID and entityreference in my project.

When an entity is loaded by entity_uuid_load, the target_id property of entityreference fields is automatically replaced with the UUID of the referenced object.

Using the entity wrapper is quite dangerous in this situation because it's not aware of the underlying change, and calling
$wrapper->field_my_reference->value() or ->label() may lead to unexpected results.

In fact, referenced entities are still loaded by ID and the UUID seems to be automatically parsed into an integer by the wrapper.
For instance, the target_id "5b8c6d24-c0de-4596-9feb-7bd9d67c07ce" loads a wrong entity with id 5.

Is there a way to deal with this problem?

Thank you very much

Comments

wodenx’s picture

Had a similar issue with named, exportable entities -- please see #2143171: Entity Metadata Wrapper support broken for named, exportable entities.. Does that approach get you anywhere?