The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Association - abstract base class for Association types

DESCRIPTION

The key difference between Attributes and Associations is that Associations use Reference types. Associations with One multiplicity have a single reference, otherwise you get an Array of Reference types or a Hash of Reference types depending on the schema definition. Reference types are distinguished by the fact that they always point to instances of the same (target) class. The constraint MetaAttribute (Aggregate or Composition) determines whether updates and deletes cascade or not.

The 'role' meta-attribute is optional for Associations. If not present, an accessor is created with the name set to that of the target Class' table name (which is a simple automatic pluralisation of the Class' name by the 'table' accessor in the target Class). If the Association is a 'Reference' type and the 'role' meta-attribute is not present, then an accessor is created for the Association by sigularising (stripping a trailing 's' off) the target Class's table name.