Two-way Relationships
Last updated
Last updated
Two-way relationships are something that is not so intuitive, so let me explain here in detail.
As an example, we will have this setup:
Product
Name
Category (Relation to One)
Unit Price
Photos
Category
Name
Products (Relation to Many)
Product.Category is a two-way relationship to Category.Products, because when you change a Product.Category, it changes the Category.Products.
On products, we have Speaker and Headphone that belongs to the category Electronics.
In this case, the category form would look like this:
Now let's suppose we remove Speaker from the Electronics category.
If we go back to products, we see that only Headphone is related to the Electronics category, because changing the products field, also impacted on the Product.Category records.