Is there an easy way to load an entity through something like entity_load or an EntityFieldQuery?
Couldn't find any infos on that...

Comments

derMatze’s picture

I thought it should be something like
entity_load('field_collection_item', array(1, 2));
But that is throwing the Exception: Invalid field name given...

Even this
field_collection_item_load(1);
throws an exception:
Exception: Invalid field name given. in FieldCollectionItemEntity->__construct() (Line 107 in .../sites/all/modules/contrib/field_collection/field_collection.module).

derMatze’s picture

Ok, it's the same problem that was mentioned here:
http://drupal.org/node/1084268

nerdcore’s picture

I am not receiving the errors mentioned in either this nor the other Issue mentioned in #2, but I am unable to load entities of type 'field_collection_item'.

I am trying to use entity_load as such:

$entities = entity_load('field_collection_item', array(1));

But $entities is empty. I've also tried the extended

$entities = entity_load('field_collection_item', array(1), array(), FALSE);

As entity_load is called by field_collection_item_load_multiple(...), but both methods result in an empty array.

EDIT: The ID I am using exists, but there may be revisions of this ID. What is the process for loading revised entities?

jmuzz’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

I looked at the linked issue and I believe this should be working now.