DBIx::Class::IntrospectableM2M(3pm)

DBIx::Class::IntrospectableM2M3pm

Introspect many-to-many shortcuts

Usage

In your DBIx::Class Result class (sometimes erroneously referred to as the 'table' class):

  __PACKAGE__->load_components(qw/IntrospectableM2M ... Core/);
  #Digest encoder with hex format and SHA-1 algorithm
  __PACKAGE__->many_to_many(roles => user_roles => 'role);

When you want to introspect this data

   my $metadata = $result_class->_m2m_metadata->{roles};
   #  $metadata->{accessor} method name e.g. 'roles'
   #  $metadata->{relation} maping relation e.g. 'user_roles'
   #  $metadata->{foreign_relation} far-side relation e.g. 'role
   #  $metadata->{attrs}  relationship attributes, if any
   # Convenience methods created by DBIx::Class
   #  $metadata->{rs_method}     'roles_rs'
   #  $metadata->{add_method}    'add_to_roles',
   #  $metadata->{set_method}    'set_roles',
   #  $metadata->{remove_method} 'remove_from_roles'

Note: The component needs to be loaded before Core.

Compatibility notice

This module is fairly esoteric and, unless you are dynamically creating something out of a DBIC Schema, is probably the wrong solution for whatever it is you are trying to do. Please be advised that compatibility is not guaranteed for DBIx::Class 0.09000+. We will try to manitain all compatibility, but internal changes might make it impossible.

Overview

Because the many-to-many relationships are not real relationships, they can not be introspected with DBIx::Class. Many-to-many relationships are actually just a collection of convenience methods installed to bridge two relationships. This DBIx::Class component can be used to store all relevant information about these non-relationships so they can later be introspected and examined.

Methods

many_to_many

Extended to store all relevant information in the "_m2m_metadata" HASH ref.

_m2m_metadata

Accessor to a HASH ref where the keys are the names of m2m relationships and the value is a HASH ref as described in the SYNOPSIS.

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 3 times.

  1. 6.0–8
  2. 9–10
  3. 11
  4. 12–13

Author

Guillermo Roditi (groditi) <[email protected]>

From libdbix-class-introspectablem2m-perl 0.001002-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.