title: Modifying a field collection programmatically missing hostEntity fields
body: <p>I am trying to modify a field collection in a node that already exists so I can change an image on the first element in an array of 3. The problem is, the hostEntity info is not set when I do a entity_load or entity_load_single so when I do a: </p>
  
  <pre><code>$field_collection_item-&gt;save(true); // with or without the true
  // OR
  $fc_wrapper-&gt;save(true); // with or without the true
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>Exception: Unable to save a field collection item without a valid reference to a host entity. in FieldCollectionItemEntity-&gt;save()
  </code></pre>
  
  <p>When i print_r the field collection entity the hostEntity:protected fields are indeed empty. My field collection is setup as follows:</p>
  
  <ul>
  <li>field_home_experts
  <ol>
  <li>Expert Image &lt;--- Want to change this data only and keep the rest below
  <ul>
  <li>field_expert_image    </li>
  <li>Image</li>
  </ul></li>
  <li>Expert Name
  <ul>
  <li>field_expert_name </li>
  <li>Text</li>
  </ul></li>
  <li>Expert Title
  <ul>
  <li>field_expert_title</li>
  <li>Text</li>
  </ul></li>
  </ol></li>
  </ul>
  
  <p>Here is the code I am trying to use to modify the existing nodes field collection:</p>
  
  <pre><code>$node = getNode(1352); // Get the node I want to modify
  
  // There can be up to 3 experts, and I want to modify the image of the first expert
  $updateItem = $node-&gt;field_home_experts[LANGUAGE_NONE][0];
  
  if ($updateItem) { // Updating
      // Grab the field collection that currently exists in the 0 spot
      $fc_item = reset(entity_load('field_collection_item', array($updateItem)));
  
      // Wrap the field collection entity in the field API wrapper
      $fc_wrapper = entity_metadata_wrapper('field_collection_item', $fc_item);
  
      // Set the new image in place of the current
      $fc_wrapper-&gt;field_expert_image-&gt;set((array)file_load(4316));
  
      // Save the field collection
      $fc_wrapper-&gt;save(true);
  
      // Save the node with the new field collection (not sure this is needed)
      node_save($node);
  }       
  </code></pre>
  
  <p>Any help would be greatly appreciated, I am still quite new to Drupal as a whole (end-user or developer)</p>