DBIx-DataModel
view release on metacpan or search on metacpan
lib/DBIx/DataModel/Meta/Association.pm view on Meta::CPAN
the path to the intermediate table, and the path from the intermediate
table to the remote end. Here is again the example from
L<DBIx::DataModel/SYNOPSIS> :
My::Schema->define_association(
kind => 'Association',
A => {
table => My::Schema::Department->metadm,
role => 'departments',
multiplicity => '*',
join_cols => [qw/activities department/],
},
B => {
table => My::Schema::Employee->metadm,
role => 'employees',
multiplicity => '*',
join_cols => [qw/activities employee/],
},
);
=back
=item B
A description of the second I<association end>, following exactly the
same principles as for the C<'A'> end.
=item name
Optional name for the association (otherwise an implicit name
will be built by default from the concatenation of the role names).
=item kind
A string describing the association kind, i.e. one of :
C<Association>, C<Aggregation> or C<Composition>.
Special behaviour is attached to the kind C<Composition> :
=over
=item *
the multiplicity must be 1-to-n or 1-to-0..1
=item *
the C<'B'> end of the association (the "component" part) must not
be component of another association (it can only be component of one
single composite table).
=item *
this association can be used for auto-expanding the composite object
(i.e. automatically fetching all component parts from the database)
-- see L<DBIx::DataModel::Source/expand>
and L<DBIx::DataModel::Source/auto_expand>
=item *
this association can be used for cascaded inserts like
$source->insert({
column1 => $val1,
...
$component_name1 => [{$sub_object1}, ...],
...
})
see L<DBIx::DataModel::Source/insert>
=back
=back
=head2 schema
returns the C<$meta_schema> to which this association belongs
=head2 A
hashref decribing the C<'A'> end of the association
=head2 B
hashref decribing the C<'B'> end of the association
=head2 path_AB
An instance of L<DBIx::DataModel::Meta::Path> for the path
from C<A> to C<B> within this association (if any).
=head2 path_BA
An instance of L<DBIx::DataModel::Meta::Path> for the path
from C<B> to C<A> within this association (if any).
=head2 name
The association name.
=head2 kind
The association kind.
=head1 PRIVATE METHODS
=head2 _parse_multiplicity
For multiplicities given as strings, parse into an arrayref
C<< [$min, $max] >>, including the rules for shorthands
C<'*'> and C<'1'>, as described above.
=head2 _install_path
Implementation for regular associations (1-to-n or 1-to-1):
create a L<DBIx::DataModel::Meta::Path> object from one side
to the other.
( run in 1.301 second using v1.01-cache-2.11-cpan-39bf76dae61 )