Best way to create multiple compositions on init

Looking for some advice that has multiple applications.

Assuming three entities:

  1. Project
  2. Milestone
  3. ProjectMilestone

with ProjectMilestone as a composition of Project

What is the best way to populate a list of ProjectMilestones, one for each entry into Milestone, when a new Project is initiated?

The concept being, every project has the same milestones, however, this list of milestones could change.

This same problem would exist for things like surveys as well, where you would want a list of predefined entities to automatically populate.

There is a special event: InitEntityEvent that you can subscribe on in the Project editor screen and create the whole object graph for the new Project.
In order for all new entities to be saved on the editor commit, create entities using DataContext.create() method.

1 Like