@rodzzlessa Yeah, I also decided to go with the Sylius "Master Variant" architecture long ago. It just makes more sense. Think of it in terms of an SKU, to spell it out Single - Stock - Unit.
refers to a stock keeping unit, a unique identifier for each distinct product
Each variation of a product is really a product in itself. THAT is why I love the way Sylius addresses this issue. Even a Product with no options / variation still has one master variation, purely to make developing more consistent.
- every product has a variation
- every product has options
- every option has values
- every variation represents a combination of options and their values
For Example
Product:
* T-Shirt
Option:
* Size
* * Small
* * Medium
* * Large
* Colour
* * Red
* * Green
* * Blue
Variations:
* SKU: XXXX - Size: Small - Colour: Red
* SKU: XXXX - Size: Small - Colour: Green
* SKU: XXXX - Size: Small - Colour: Blue
* SKU: XXXX - Size: Medium - Colour: Red
* SKU: XXXX - Size: Medium - Colour: Green
* SKU: XXXX - Size: Medium - Colour: Blue
* SKU: XXXX - Size: Large - Colour: Red
* SKU: XXXX - Size: Green - Colour: Red
* SKU: XXXX - Size: Blue - Colour: Red
Therefore the Models, Entities, Repositories or whatever-you-want-to-call-them would be:
- Product
- Option
- OptionValue
- Variation
The project is up, its called Jiro. Although work has halted till L5 stabilises, https://github.com/Jiro-Commerce . Feel free to make some pull requests.