Made many_to_many throw an exception if its not provided with a $f_rel
Ash Berlin [Thu, 21 Dec 2006 21:04:33 +0000 (21:04 +0000)]
lib/DBIx/Class/Relationship/ManyToMany.pm

index e294a8c..d8d50de 100644 (file)
@@ -6,6 +6,15 @@ use warnings;
 
 sub many_to_many {
   my ($class, $meth, $rel, $f_rel, $rel_attrs) = @_;
+
+  $class->throw_exception(
+    "missing relation in many-to-many"
+  ) unless $rel;
+
+  $class->throw_exception(
+    "missing foreign relation in many-to-many"
+  ) unless $f_rel;
+
   {
     no strict 'refs';
     no warnings 'redefine';