Hi, I'm trying to set up a ticket system and need to be able to have one ticket have multiple 'related tickets' which are organized in a specific order. My basic idea was to create an 'OrderedSupportTicket' object which just has one field for sort order, along with as has_one relationship to a specific ticket. The problem is that it also needs a has_one to the parent ticket. Since it's clearer to understand what I'm saying in code, here's the relevant parts:
class SupportTicket extends DataObject {
...
static $has_many = array(
'OrderedTickets' => 'OrderedSupportTicket.ParentTicket',
'OrderingTickets' => 'OrderedSupportTicket.SubTicket',
);
...
}
and
class OrderedSupportTicket extends DataObject {
...
static $has_one = array(
'ParentTicket' => 'SupportTicket',
'SubTicket' => 'SupportTicket',
);
...
}
All of that works fine for the database, but cannot be managed via a HasMany(CTF/DOM) field. As soon as I set one of the 'SupportTicket' relationships on the OrderedSupportTicket object, it becomes un 'checkable' in the hasmany field, and as soon as I save it it's marked as no longer belonging to the ParentTicket.
I realize that if need be I can just create my own 'SubTicketID' field and write a getter/setting combo to take care of that, but ideally I'd prefer to use the sapphire framework as it's supposed to be. Thanks for any and all suggestions,
Alex