Hi,
I have the Silverstripe book, which describes the Object Relational Model (ORM). While it's very clear what a "has one" relation is, or "one to many," how would you implement an "up to one" relation? Or, for that matter, a relation with 0 to many objects?
Why would someone want this? Well, let's assume that you have an online store, and some products have a downloadable demo, but others don't. An "up to one" relation would be the easiest way to implement this. Likewise, some products may have one or more user reviews, but others might not.
I'm not familiar with SQL, but I have read that not all databases allow NULL keys, and you have to explicitly ask for a database column to allow null entries. So, how would "up to one" type relations be implemented? And can this be done in Silverstripe without resorting to direct SQL queries?
Hans