Saving an unsaved id using RelationManager
Hi, I’m building a ticket booking website where each event can have multiple “ticket types.” A ticket type can either be Single or Bundle.
Single tickets: regular tickets.
Bundle tickets: depend on a “base ticket” (which must be a Single ticket), and when purchased, they multiply the base ticket.
I’m handling this with a Relation Manager: when creating an event, I can also create its related ticket types (Single or Bundle).
The problem is:
- When I create a new Single ticket and a new Bundle ticket at the same time, and I set the Bundle’s base_ticket_id to the new Single, it stores it as an unsaved ID. What I’d like is to save the Single ticket first and then use its fresh ID for the Bundle.
- If I delete a Single ticket, the Bundle still keeps the old base_ticket_id. Instead, I’d like the Bundle to also be deleted (or handled gracefully).
Has anyone dealt with a similar case and what would be the best approach here?
Thanks!
1 Reply
This is my approach and it has those problems