- Issue created by @edmund.dunn
- Status changed to Postponed
over 1 year ago 12:35pm 15 May 2023 - π¨πSwitzerland ayalon
For the moment we have other priorities on our projects that we have to implement first.
But we happily accept your patch or merge request. It should be fairly easy to write an extension and generate the related missing reverse entity lookups.
- π¨πSwitzerland dulnan
I gave this a try and it was pretty straight forward. I didn't want to make it work like in V3, because that created tons of overly specific fields (I counted 460 fields in one of our projects still using V3...)
Instead there is only a single field added to each entity type called *reverseReferences*. It returns a type called *ReverseReferenceContext* where a field *query* is available. This query field takes a parameter called *referenceFields*, where one can specify which fields should be used to look for references. This also allows to create reusable fragments for such reverse lookups.
query { entityById(entityType: TAXONOMY_TERM, id: 123) { reverseReferences { ...reverseOfficeLookup } } } fragment reverseOfficeLookup on ReverseReferenceContext { query( referenceFields: ["field_office"] entityType: NODE filter: { conditions: [ { field: "type", value: "news_story" } { field: "status", value: "1" } { field: "field_featured", value: "1" } ] } sort: { field: "created", direction: DESC } limit: 2 ) { entities: items { id } } }
This new schema extension is available in the dev branch.
- Status changed to Fixed
11 months ago 1:48pm 25 January 2024 - Status changed to Fixed
11 months ago 1:49pm 25 January 2024