This may fall into the category of - "...any complex or custom node type may not clone cleanly" but I felt it was worth documenting here, so people know this setup doesn't work.

If you clone a content type with a field collection, and the field collection contains an entity reference, the content appears to clone successfully, but, if you edit or remove anything from the entity reference field, those edits cascade to the piece of content that was originally cloned.

My guess is that instead of cloning the field collection, node clone is cloning the relationship to the field collection.

I haven't yet looked at the extra hook for post-clone cleanup mentioned in the module description. Not sure if that will work in this case or not.

This behavior was initially discovered in production, and has been reproduced on a clean install with node_clone, field collection and entity_reference installed.

Comments

sk2013’s picture

+1
Any Solution to this issue please?

selfuntitled’s picture

Unfortunately, no. I think the best option may be to write something that uses this modules post-clone cleanup hooks. If I have some time I'll take a hack at it. In absence of that, there's nothing that I know of.

bkno’s picture

Suggest you try https://drupal.org/project/field_collection_node_clone

Would be good to know if it solves the issue.

Leeteq’s picture

Version: 7.x-1.0-rc2 » 7.x-1.x-dev
Priority: Normal » Major

Ref. the https://drupal.org/project/field_collection_node_clone module - #2380675: Related open issue with node_clone module

Entities have matured and are not "edge case" integration anymore.

What is the best way forward?
IMHO this should all be in one (this) module.

If not, this module should integrate with the other and document it as an "entities compatibility requirement"
This module should not attempt to clone EntityReference fields if the other module is missing, but make such fields not selectable, and inform about the lacking dependency in the field description area.

In these "Entity times", this is major.

hefox’s picture

Category: Bug report » Feature request

Modules don't have to be compatible with each other, so as long it's not an actual bug in the module, asking the modules to work together is a feature request tmk.

Most entityreference fields, preserving the entity reference is desirable -- field collections (and pargraphs module) are the oddballs.

pwolanin’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.