This blows my mind.

Let's say you create a content type. You add a field collection to it, that has several fields. In this particular case, I'm tallying voting results. So each node in the content type is for one particular precinct for one particular election. For the field collection, there are fields for:

1) The particular seat, like a city council seat, that there are votes for
2) The candidate name
3) Votes received on election day
4) Votes received through absentee ballot.

So, for a given election, there might be thirty precinct nodes. For each node, the field collection will contain the same items, since each precinct is voting on the candidates. What should vary is simply the votes for each item in the field collection.

However, what happens is that if I enter the votes for precinct A, precinct B will automatically have the same votes as well. If I change the votes for precinct B, they also get changed for precinct A.

I imagine that it would work if I added a precinct field to the field collection. But that is, quite frankly, insane.

My expectation is that a field collection will be able to have values unique to each node. To me, this is a serious, serious flaw in the way that field collection is currently working.

Comments

rainbowarray’s picture

Well, this is even crazier than I thought.

Even if I add a precinct field to the field collection, that still carries over from one node to another.

This is nuts. I don't see how field collection is possibly usable if this is the case.

rainbowarray’s picture

Priority: Major » Normal

Ok, so I figured out the source of this bug: it's actually the interaction of field collection with node clone.

What happened was that when I set up the first precinct node, and entered the candidates in the field collection, I proceeded to use node clone to create each additional precinct. What must be happening is that while cloning is creating a new unique node, it is not creating a new unique set of entities in the field collection.

This is not intuitive, however: I wouldn't have expected this to happen when cloning a node. So it would be better if node clone handled entities in a field collection the same way it handles nodes: create a duplicate copy of that entity with the same data and connect it to the parent field collection in the newly cloned node.

This issue might need to be moved over to the node clone module: I'm not sure. I downgraded this to normal.

Funksmaname’s picture

I'm getting cross node duplication of field collection data and i've never used node clone... going to open a new issue

jmuzz’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)

Yes it will be good when the issues with cloning nodes are resolved.

#1304214: Doesn't clone properly