Firstly, many thanks for this module, which fixes a problem I struggled with (I can't code) a couple of years ago trying to build a site... Happy to find it now, and have immediate application to a new project.

Use Case 1
Content Type 1 = Project, NodeRef Field=Team (ie people who worked on the project)
Content type 2 = People (nothing fancy, not profiles or users, just nodes making a list of names and basic details), NodeRefField=Project

nodereference+CNR and bingo, I add a new Project and can select People who worked on it, and the Project shows up in the Person's node. and vice-versa. Perfect.

Use Case 2 - so having got it working as it is designed, I try and make it more complex...
Same Content Types, but more than one NR Field in Project
Content Type 1 = Project

  • NodeRef Field=Team (ie people who worked on the project)
  • NodeRef Field=Contacted(ie people who have been contacted about project)

Content type 2 = People (nothing fancy, not profiles or users, just a list of names and basic details)

  • NodeRefField=Project (ie project person has worked on)
  • NodeRef Field=Contacted(ie project which the People have been contacted about)

CNR is set nrfTeam<==>nrfProject and nrfContacted<==>nrfContacted

This works pretty much OK - IF the 'person' and the 'project' both are pre-existing - and subsequently cross-referenced by editing either the CT Project or CT People except that activating someone as a Team member during creation of a Project (and leaving nothing on the 'Contacted' field), ends up with them on the project as being activated for both. I tested this and got the following:

Existing Project, Existing Person
- editing either the Project (and activating the NodeRefField Team) or editing the Person (and activating the NodeRefField Project) - both cases work fine, no contamination of the 'Contacted' NRField.

Create New Project - Person does not exist in database, so
Create New Person - and during creation, activate the NodeRefField Project
Fail - the Contacted NRF is also set to the Person.

Create New Person - Project does not exist in database, so
Create New Project - and during creation, activate the NodeRefField Team
Fail - the Contacted NRF is also set to the Person.

To add to my confusion in /admin/settings/corresponding_node_references/references
I would expect to see 2 defined relationships
(corresponding to nrfTeam<==>nrfProject and nrfContacted<==>nrfContacted ),
but I see 4

Field instance:"field_proj_team" on Node type:"projects" Corresponds with Field instance:"field_p_project" on Node type:"people"

Field instance:"field_proj_team" on Node type:"projects" Corresponds with Field instance:"field_p_contacted" on Node type:"people"

Field instance:"field_p_project" on Node type:"people" Corresponds with Field instance:"field_proj_contacted" on Node type:"projects"

Field instance:"field_p_contacted" on Node type:"people" Corresponds with Field instance:"field_proj_contacted" on Node type:"projects"

I am not sure if I did something wrong to cause this, but as far as I can see the 1st and 4th are correct, and the 2nd and 3rd are causing the incorrect cross-referencing. I can deactiave them in CNR - but don't know where they came from.

As I noted at the top, this may not be a bug, but more of an inappropriate or incorrect usage. Sorry to be a bit long-winded, but was trying to be explicit about the problem and testing the various cases as I wrote the post!

Thanks for reading to the end, and any thoughts appreciated.

Comments

pisco23’s picture

I just tried adding an extra layer of complexity by adding a new NRF "Introduced by" to Project and "Introduced" to People. Now it gets very cross-referenced

  1. Field instance:"field_proj_team" on Node type:"projects" Corresponds with Field instance:"field_p_project" on Node type:"people"
  2. Field instance:"field_proj_team" on Node type:"projects" Corresponds with Field instance:"field_p_contacted" on Node type:"people"
  3. Field instance:"field_proj_team" on Node type:"projects" Corresponds with Field instance:"field_p_introduced" on Node type:"people"
  4. Field instance:"field_p_project" on Node type:"people" Corresponds with Field instance:"field_proj_contacted" on Node type:"projects"
  5. Field instance:"field_p_project" on Node type:"people" Corresponds with Field instance:"field_proj_introduced" on Node type:"projects"
  6. Field instance:"field_p_contacted" on Node type:"people" Corresponds with Field instance:"field_proj_contacted" on Node type:"projects"
  7. Field instance:"field_p_contacted" on Node type:"people" Corresponds with Field instance:"field_proj_introduced" on Node type:"projects"
  8. Field instance:"field_proj_contacted" on Node type:"projects" Corresponds with Field instance:"field_p_introduced" on Node type:"people"
  9. Field instance:"field_p_introduced" on Node type:"people" Corresponds with Field instance:"field_proj_introduced" on Node type:"projects"

it would appear that 1,6 and 9 are direct references, the rest are extraneous cross-references...