I'm trying to build a doctrine database for a Symfony application, and I'm not sure of the correct way of assembling the schema.
From here on in I'll use the Symfony3 tutorial
use Doctrine\ORM\Mapping as ORM;
* @ORM\Column(type="string", length=100)
["car", "bike", "bus"]
Category:type = "car" -> Product:type = ["BMW" OR "Volvo"]
Category:type = "bike" -> Product:type = ["BMX" OR "Mountain Bike"]
I think you should create a separate product type table that stores the category relationship and is itself stored in the product instead of putting the category in the product.
So you would have
Category Product Type Product
Product type is many to one categories, a category may contain many product types, a Product is many to one product types, a product type may contain many products.
Category Type -> Product Type -> Product
Make sense, there is no need to store the category in the product because it is inferred by the product type and its relationship.