'Test::More' => 0,
'version' => 0,
'DBIx::Class' => 0,
+ 'DBIx::Class::IntrospectableM2M' => 0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'DBIx-Class-ResultSet-RecursiveUpdate-*' },
sub is_m2m {
my( $self, $relation ) = @_;
+ my $rclass = $self->result_class;
+ # DBIx::Class::IntrospectableM2M
+ if( $rclass->can( '_m2m_metadata' ) ){
+ return $rclass->_m2m_metadata->{$relation};
+ }
my $object = $self->new({});
if ( $object->can($relation) and
- !$object->result_source->has_relationship($relation) and
+ !$self->result_source->has_relationship($relation) and
$object->can( 'set_' . $relation)
){
return 1;
sub get_m2m_source {
my( $self, $relation ) = @_;
+ my $rclass = $self->result_class;
+ # DBIx::Class::IntrospectableM2M
+ if( $rclass->can( '_m2m_metadata' ) ){
+ return $self->result_source
+ ->related_source(
+ $rclass->_m2m_metadata->{$relation}{relation}
+ )
+ ->related_source(
+ $rclass->_m2m_metadata->{$relation}{foreign_relation}
+ );
+ }
my $object = $self->new({});
my $r = $object->$relation;
return $r->result_source;
use overload '""' => sub {$_[0]->name}, fallback => 1;
use lib '../../DBIx-Class-HTML-FormFu/lib/';
-__PACKAGE__->load_components('Core');
+__PACKAGE__->load_components(qw/IntrospectableM2M Core/);
__PACKAGE__->table('dvd');
__PACKAGE__->add_columns(
'id' => {