1

I am in desperate need of help.

I have a custom entity called Question which has a bundle called data. Within the data bundle, I have a collection field called options with two subfields called correct_option & misc_option.

-Question
 -Data
  -options
   -correct_options
   -misc_options

I am desperately trying to programmatically write data into those 2 option fields but the following code is not working:

$field_collection_item_value = 1596; // Get field collection item value.

$field_collection_item = entity_load('field_collection_item', array($field_collection_item_value)); // Load that field collection item.

$field_collection_item->save(); // Save field-collection item.

The 1569 is the ID of an existing question entity.

Whenever the code is executed I get the following error:

Fatal error: Call to a member function save() on array

I would appreciate any help. I'm at a loss and not sure how to get this working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.