Drupal 7 - Programmatically create field collection within field collection Example: Map (node) has unlimited areas (field collection field). Each area has unlimited layers (field collection field). The area fc. have normal fields and the layer fc. The layer fc. only have normal fields.

I can create a field collection on the node, but unable to figure out how to attach another field collection to it. I assume the 2nd fc. should use the 1st fc. id as HostEntity.

The code is running in a custom module, and it should create the Map node.

Any ideas, suggestions?
I just figured this out, please see field collection module issue:

http://drupal.org/node/1393552#comment-5428548