Score:0

How do I create bidirectional entity references?

th flag

How can I create a bidirectional link in a drupal entity? Let me explain, I have a content type called "software" in which I have a field (entity reference) called "article". When I create my "software" content, Drupal automatically creates a link to my "article" content type, which is fine, but I would like a link to be created in the opposite direction from my "article" content type to my "software" content type. How can I do this?

4uk4 avatar
cn flag
The question is why you need a different database schema. It doesn't seem to be necessary for creating a link in the opposite direction. This is possible by querying the "article" id in the reference field of the "software" content type.
Laurent Gravez avatar
th flag
Thank you for the answer Cilefen, I followed the link but unfortunately the Entity Reference module that is specified is only usable for Drupal 7 and I work with Drupal 9. I saw that there was also a cnr module, but the problem is the same to make it work I need another module that works only in Drupal 7.
id flag
Nevertheless this question is the same question.
Laurent Gravez avatar
th flag
Thank you Cilefen, after having deepened the subject a little I finally found thanks to the cnr module. Your answer is correct.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.