Association - abstract base class for Association types
my $assoc = Oryx::Association->new($meta, $source); $assoc->source; # association from $assoc->class; # association to $assoc->role; # name of association accessor $assoc->type; # Array, Hash, Reference etc. $assoc->constraint; # Aggregate or Composition $assoc->is_weak; $assoc->update_backrefs; $assoc->link_table;
This module represents an abstract base class for Oryx association types.
The constructor returns the correct instance of the correct subclass based on the type field of the $meta hashref passed as an argument. The $source argument is the name of the class in which this association is defined (see Oryx::Class)
type
$meta
$source
Abstract (see implementing subclasses)
Simple accessor to the source class in which this association is defined.
Simple accessor to the target class with which the source class has an associtation.
Simple accessor to the association accessor name defined in the source class. Defaults to the target class' table name.
Reference, Array or Hash... defaults to Reference.
Simple accessor to the is_weak meta-attribute. This is used for stopping Reference association types from creating a column in the target class for storing a reverse association.
is_weak
Simple accessor to the constraint meta-attribute. Values are: Aggregate or Composition ... Aggregate is the default, Composition causes deletes to cascade.
constraint
Updates reverse Reference associations.
NOTE: Currently, reverse associations are made up of two unidirectional associations... link tables are therefore not shared. This will be fixed.
Returns a name for the link table for this association. Not relevant for Reference associations as these don't require a link table.
This is just a shortcut for:
$self->source->table.'_'.$self->role.'_'.$self->class->table
Override for custom association types as needed.
Richard Hundt <richard NO SPAM AT protea-systems.com>
Andrew Sterling Hanencamp
This module is free software and may be used under the same terms as Perl itself.
To install Oryx, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Oryx
CPAN shell
perl -MCPAN -e shell install Oryx
For more information on module installation, please visit the detailed CPAN module installation guide.