Hi people,
I'm building my first SilverStripe website. Things are going pretty well so far, but I've run into a design issue that has me momentarily stumped. I'm hoping some kind SilverStriper will help me out so I can get on with building the site.
I have a Page object (GymClass - which describes a certain type of class being run by the gym) for which I have defined a 1-m relationship to a ScheduledGymClass DataObject (describing the days and time slots a particular gym class occur on).
The ScheduledGymClass has a 1-1 relationship with a GymClass since for a particular timeslot only one occurance of a given gym class is permitted, but of course the gym class can occur on multiple days and at other times.
What I want to end up with is, for each GymClass, a list of the days and timeslots on which it occurs.
GymClass has a $has_many relationship with ScheduledGymClass which has a reciprocal $has_one relationship with GymClass.
Checking in the database I can see the ScheduledGymClass table has a column defining the $has_one relationship (PlannedGymClass).
However, when I add a new ScheduledGymClass entry for a defined GymClass Page (via a HasManyComplexTableField on GymClass) the value of the supposed $has_one field in ScheduledGymClass is set to 0 and not the ID of the related GymClass row.
Also if I add another GymClass Page, the ScheduledGymClass entries for any previously saved ScheduledGymClass entries also appear even though they don't relate to that particular GymClass.
Have I missed something in my design. Shouldn't saving the ScheduledGymClass object capture the ID of the related GymClass object because of the defined relationship.
Any help would be gratefully received.
Cheers, Innes