Score:0

Read reverse-relationship from a view programatically

in flag

Alright, this is taking so much time than expected. I'm having a comment type "Default comment". The comments under this comment type is published and created as nodes under "level3" content type. The content types look as below:

enter image description here

I have related the Level3 content type with Default comments using "comment ID" field. So every time when the comment is published under level3, the comment ID will also be updated with the ID of the comment. Now, I have a view that reads the data from both Level3 content type and Default comment type. My view looks as below:

enter image description here

so I'm trying to read the comment fields and Level3 fields using the "field_comment_id" relationship. it is a reverse relationship and I can see the view output correctly on the grid. I want to read the fields from the view grid and tried the below queries:

$entity->field_level2->getValue() 

$entity->field_comment_id->referencedEntities();

none of them are working. any clue on how to read the fields based on reverse relationship?

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.