This may or may not be the same issue as : http://drupal.org/node/571944

Given the following types and fields:

ParentType
- field_childtype1_reference
- field_childtype2_reference

ChildType1
- field_parenttype_reference

ChildType2
- field_parenttype_reference

Note the existence of the same field in both children. When attempting to use backreference with ParentType, it seems to get confused because it does not know if you mean the field in ChildType1 or 2.

The workaround appears to be to ensure that the reference fields have unique names ("field_parenttype_reference1", "field_parenttype_reference2") and are not used in any other type.

I did not have this issue with Corresponding Node References, where you must specify not only the field name but the content type. However as noted elsewhere, there are other reasons why Backreference may be preferred, thus I was testing it out to see how it worked (and it did work well).

Perhaps this behavior is as designed, or will not be fixed/changed -- even if so, I think it would be worth a note on the project page and README to make it clearly known that you should not use it with shared node reference fields. I set the Component in the issue report to be "Documentation", but if it should be different please do update it.

Thanks!

Comments

wojtha’s picture

I have same problem:

user warning: Duplicate entry 'field_services_reference' for key 'idx_backreference_field_symmetry_right' query: INSERT INTO backreference_field_symmetry (field_right, field_left) VALUES ('field_services_reference', 'field_dictionary_terms') in C:\Dev\workspace\h1\sites\all\modules\contrib\backreference\backreference.module on line 340.

This error/warning appears when I want to save instance of the second child node reference field.

I have two types of services ("childs") and one dictionary ("parent"). The settings of the Backreference field aren't saved (because of that error), but it seems that record in table is "sufficient" and relation between 1 parent and 2 childs is working properly.

My suggestion is set up backreference field value (at CCK nodereference field settings form) automatically when record exists in the 'backreference_field_symmetry' table and check the table before writing duplicate entry.

Thanks for the great module!

kimadactyl’s picture

I get this too. subscribing.

wojtha’s picture

Component: Documentation » Code
compsyguy’s picture

I get this as well. Subscribing.

In the mean time though, I think I'll try to do a workaround with rules.