Managing many-to-many relationships (RelationService/RelationType) within the backoffice
Hi,
I have a list of Articles that can be related to multiple Categories, e.g. a many-to-many relationship. When viewing an Article in the backoffice, I would like to display all Categories (something like a checkbox list) so that content editors can check/uncheck which Categories the Article relates to.
This would need to work the other way (bidirectional) when viewing a Category in the backoffice - list all Articles that are assigned to it and allow them to be managed.
My first thought was to use the RelationType and RelationService...
...but there seems to be very little documentation/use cases for this context, especially for v8. I can understand how to override the save event to update the relations but not sure how this would work in the UI:
The UI relation service documentation seems to be very limited.
If I'm overwriting the save event it seems like I'm bypassing the RelationService so is it even required/the best route? I'm now wondering whether using a Content Picker on the Article and Category would be better to store the relation?
If anyone has done anything similar or has any advice to point me in the right direction that would be very helpful.
Managing many-to-many relationships (RelationService/RelationType) within the backoffice
Hi,
I have a list of Articles that can be related to multiple Categories, e.g. a many-to-many relationship. When viewing an Article in the backoffice, I would like to display all Categories (something like a checkbox list) so that content editors can check/uncheck which Categories the Article relates to.
This would need to work the other way (bidirectional) when viewing a Category in the backoffice - list all Articles that are assigned to it and allow them to be managed.
My first thought was to use the RelationType and RelationService...
https://our.umbraco.com/Documentation/Reference/Management/Models/RelationType
https://our.umbraco.com/Documentation/Reference/Management/Services/RelationService/Index/
...but there seems to be very little documentation/use cases for this context, especially for v8. I can understand how to override the save event to update the relations but not sure how this would work in the UI:
https://our.umbraco.com/apidocs/v8/ui/#/api/umbraco.resources.relationResource
The UI relation service documentation seems to be very limited.
If I'm overwriting the save event it seems like I'm bypassing the RelationService so is it even required/the best route? I'm now wondering whether using a Content Picker on the Article and Category would be better to store the relation?
If anyone has done anything similar or has any advice to point me in the right direction that would be very helpful.
Thanks
is working on a reply...