Advanced multiplicity with multiple form associations per form

In the earlier multiplicity example, one FormPattern created multiple form instances each with one inference class instance and a single form association. The form was duplicated for each entity returned from getEntities, but each form linked to only one vehicle. This approach works for most cases in which you might need multiplicity on a form.

In the data model, the Form entity supports multiple form associations by having form associations on the Form entity stored in an array (not a single property) called FormAssociations. However, in the reference implementation the FormData and AbstractMultipleCopiesForm classes support only a one-to-one mapping of Form instance to FormAssociation. It is possible to support one-to-many mappings of Form to FormAssociation. Supporting one-to-many mappings requires subclassing the built-in Gosu classes to manage multiple FormAssociation objects. Your subclasses set their values and set the _entity variable before calling the XML export method. Refer to the source code for the AbstractMultipleCopiesForm class to see how the multiplicity code is implemented.