[Bast-commits] r5202 - in
DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk: .
lib/DBIx/Class/ResultSet t/lib/DBSchema/Result t/var
zby at dev.catalyst.perl.org
zby at dev.catalyst.perl.org
Wed Nov 26 14:24:48 GMT 2008
Author: zby
Date: 2008-11-26 14:24:48 +0000 (Wed, 26 Nov 2008)
New Revision: 5202
Modified:
DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/Makefile.PL
DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm
DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/lib/DBSchema/Result/Dvd.pm
DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/var/dvdzbr.db
Log:
using Introspectable
Modified: DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/Makefile.PL
===================================================================
--- DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/Makefile.PL 2008-11-25 01:11:46 UTC (rev 5201)
+++ DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/Makefile.PL 2008-11-26 14:24:48 UTC (rev 5202)
@@ -12,6 +12,7 @@
'Test::More' => 0,
'version' => 0,
'DBIx::Class' => 0,
+ 'DBIx::Class::IntrospectableM2M' => 0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'DBIx-Class-ResultSet-RecursiveUpdate-*' },
Modified: DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm
===================================================================
--- DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm 2008-11-25 01:11:46 UTC (rev 5201)
+++ DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm 2008-11-26 14:24:48 UTC (rev 5202)
@@ -88,9 +88,14 @@
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;
@@ -100,6 +105,17 @@
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;
Modified: DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/lib/DBSchema/Result/Dvd.pm
===================================================================
--- DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/lib/DBSchema/Result/Dvd.pm 2008-11-25 01:11:46 UTC (rev 5201)
+++ DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/lib/DBSchema/Result/Dvd.pm 2008-11-26 14:24:48 UTC (rev 5202)
@@ -9,7 +9,7 @@
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' => {
Modified: DBIx-Class-ResultSet-RecursiveUpdate/1.000/trunk/t/var/dvdzbr.db
===================================================================
(Binary files differ)
More information about the Bast-commits
mailing list