I am trying to set up the following relation, but I am doubtful as to whether it is going to work:
class AvailabilityPage extends SiteTree {
static $has_many = array(
"HighSeasonIntervals" => "DateInterval",
"FullyBookedIntervals" => "DateInterval"
);
}
class DateInterval extends DataObject {
static $db = array(
"StartDate" => "Date",
"EndDate" => "Date"
);
static $has_one = array(
"AvailabilityPage" => "AvailabilityPage"
);
}
The resulting database schema does not seem to distinguish between a DateInterval belonging either to the HighSeasonIntervals set on AvailabilityPage, or to the FullyBookedIntervals set. Does anyone know whether or not this is going to work?
If (as I suspect), it is not going to work directly, could anyone give me some pointers on how to implement such a relation? There is nothing on this topic in the Silverstripe documentation, unfortunately.
Many thanks in advance!