From: Matt S Trout Date: Mon, 2 Jan 2006 18:08:32 +0000 (+0000) Subject: And the extra main classes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8973b6f1370f83172ea74243b0a5acde98d172ce;p=dbsrgits%2FDBIx-Class-Historic.git And the extra main classes --- diff --git a/lib/DBIx/Class/Relationship/Helpers.pm b/lib/DBIx/Class/Relationship/Helpers.pm new file mode 100644 index 0000000..e4a28d7 --- /dev/null +++ b/lib/DBIx/Class/Relationship/Helpers.pm @@ -0,0 +1,15 @@ +package DBIx::Class::Relationship::Helpers; + +use strict; +use warnings; + +use base qw/DBIx::Class/; + +__PACKAGE__->load_components(qw/ + Relationship::HasMany + Relationship::HasOne + Relationship::BelongsTo + Relationship::ManyToMany +/); + +1; diff --git a/lib/DBIx/Class/Relationship/ManyToMany.pm b/lib/DBIx/Class/Relationship/ManyToMany.pm new file mode 100644 index 0000000..09fd212 --- /dev/null +++ b/lib/DBIx/Class/Relationship/ManyToMany.pm @@ -0,0 +1,19 @@ +package DBIx::Class::Relationship::ManyToMany; + +use strict; +use warnings; + +sub many_to_many { + my ($class, $meth, $rel_class, $f_class) = @_; + + eval "require $f_class"; + + { + no strict 'refs'; + no warnings 'redefine'; + *{"${class}::${meth}"} = + sub { shift->search_related($rel_class)->search_related($f_class, @_); }; + } +} + +1;