2

In a Drupal 7 website I would like to create an "is similar to" relation between nodes of the same content type. The nodes are vessels (ships) and a vessel can be similar to several others.

Think of the similarity as a Volkswagen Golf I is similar to the VW Golf II, Golf III and so on. The relation is symmatric, because the VW Golf IV is similar to the Golf VII and vice versa.

In the current custom made website, which will be migrated to Drupal 7, there are over 6500 relations between vessels.

I've tried several modules, but I can not create what I intend:

  • the Relation module can not create relations between endpoints of the same entity type (e.g. nodes of the same content type);
  • the module Entity reference only creates directional relations. This would mean creating two references per relation, ending up with over 13000 references;
  • the References module also only creates directional relations, again ending up with over 13000 references.

So the question is: how do I create non-directional/symmetric relations between nodes of the same content type?

  • I think I've seen my answer getting accepted and un-accepted. If it does not meet your needs, please explain why, and I'll try to update it. – Mołot Aug 22 '14 at 9:48
  • 1
    that's correct; I accepted it but realised I haven't tested it yet. I think your answer is correct, but I want to be sure, so others can benefit from it as well. Thanks for your swift anser, btw! – Tony Reynolds Aug 22 '14 at 9:59
  • OK, sounds fair. I was afraid you unaccepted because you found it somehow faulty, but if it was the case of accepting too soon, you did exactly what you should. – Mołot Aug 22 '14 at 10:00
0

Corresponding entity references fixes this for you:

CER keeps reference fields in sync. If you have two entities that refer to each other using Entity Reference (or some other kind of reference field), it saves you the trouble of double-editing your entities in order to have them point at each other. If entity Alice references entity Bob, CER will make Bob reference Alice, and keep the references up-to-date when either entity is updated or deleted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.