4

I just wanted to know what is major difference between

Entity Reference: Referenced Entity

A bridge to the Content entity that is referenced via field_FIELD_NAME

AND

Entity Reference: Referencing entity

A bridge to the Content entity that is referencing Content via field_FIELD_NAME

While using relationship in views or when I prefer to Entity Reference: Referencing entity

1 Answer 1

6

Say you have a content type called course that has a entity reference field that targets a content type called school.

In views you could now add a relationship using "Entity Reference: Referenced Entity" and fetch values from the school that the course belongs to.

You list of courses could now show something like: Course X - School X

So far so good.

Now let's say you want to list schools and which courses they provide. Since the entity reference field points from course to school you need to fetch the reference the other way. Now you can instead use "Entity Reference: Referencing entity". This way you could list schools and courses:

School X - Course X.

You will end up with duplicate rows in some cases if several courses points to the same school, but that's another story :)

Hope this made the relationship bit clearer.

0

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.