core
core copied to clipboard
[RFC] Allow multiple relations to the same content type
Currently, relations are added to a content type by their slug / content_type name. This only allows one content type of relation to be created from a content type. By changing the definition of relations will allow multiple relations to the same content type. This is important because relations are a proper reference to a item of a content type, rather than defining it in an array in one field that a select does, thus making it more searchable and faster.
This is a big limitation to bolt.
I'd like to suggest that relations are defined by a name of the relation, rather than the name of the content type:
relations:
upsell_products:
content_type: products
label: "Related Products"
... rest of relation code...
crosssell_products:
content_type: products
label: "Cross Sell Products"
... rest of relation code...
How can you help?
I could probably code this myself. Not a newbie to symfony development
This has been asked before, and i'm sure it'll be asked again. :-)
I wonder though how hard it'd be to make, and what the Backwards Compatibility impact will be. 🤔
I had a quick go at doing it once and it was relatively easy because it's only really changing the yaml processing. Backwards compat would be broken of course, but you could monkey patch code until a certain version is hit so that it doesn't, e.g. if no content_type is defined in the data, then use the key name as the content_type.