I'm having field collections in nodetype1, synchronizing them with another node type (nodetype2). These field collections and nodetype2 are having mostly the same fields.

When I create a nodetype1 node, it's working fine so that through hook_node_insert, I create and save a new nodetype2 node from the fields in the collection. I have also configured reference fields to both the field collection and nodetype2, so that they both always know where synchronization should happen.

Now when I update a nodetype2 node, I'm trying to set the new field values to the field collection in hook_node_update(), and then saving it like $field_collection->save(). This save() function works fine for the same field collection in other places. However, in this particular case I always get a memory timeout from running the function.

I've troubleshooted it, and if I add a die(); right before the row return entity_save($this->hostEntityType, $host_entity); in the field collection save() function, the script cuts short like it should. However, if I add die(); as the FIRST row in the function entity_save(), I keep getting the memory exhaustion error. I don't understand how this is possible, since to my understanding nothing should happen between those two rows. This error keeps coming even if I only do the following in hook_node_update() in addition to getting the $fc_id from the node being updated:

$fc = entity_load('field_collection_item', array($fc_id));

Any help is greatly appreciated.


umarzaffer’s picture

Any luck so far on this?

umarzaffer’s picture

Issue summary: View changes

mistake in function name

jmuzz’s picture

Status: Active » Closed (outdated)

I don't believe this happens in the latest versions.

If it is still a problem feel free to reopen with more specific steps to reproduce.