Posted by John Pitcairn on September 19, 2012 at 3:55am
5 followers
Jump to:
| Project: | Entity API |
| Version: | 7.x-1.x-dev |
| Component: | Entity property wrapper |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Latest dev of entity_api and field_collection.
I have a node containing a field collection, with revisions enabled.
function mymodule_node_view($node, &$view_mode, $langcode) {
print 'NODE<br />';
print 'vid: ' . $node->vid . '<br />';
foreach ($node->field_field_collection[LANGUAGE_NONE] as $key => $collection) {
print $collection['revision_id'] . '<br />';
}
print '<br />WRAPPER<br />';
$wrapper = entity_metadata_wrapper('node', $node);
print 'vid: ' . $wrapper->vid->value() . '<br />';
foreach ($wrapper->field_field_collection as $key => $collection) {
print $collection->revision_id->value() . '<br />';
}
die;
}Output:
When viewing the latest node revision:
NODE
vid: 273
255
256
257
WRAPPER
vid: 273
255
256
257When viewing an older node revision:
NODE
vid: 271
221
222
223
WRAPPER
vid: 271
255
256
257entity_metadata_wrapper is loading the latest revisions for the field collection, not the field collection revisions specified by the wrapped node entity.
Comments
#1
Am running into this too with an entityreference field when used with #1837650: Allow referencing a specific revision ID.