Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated DBIx::Class Result Class Files for many-to-many relations

  • Loading branch information...
commit f811188dcae9dbed6e294f6a3ef2ecc742092512 1 parent 5e316ee
Phillip Smith authored August 15, 2011
9  lib/Catalyst/Default/Schema/Result/Author.pm
@@ -80,5 +80,14 @@ __PACKAGE__->has_many(
80 80
 
81 81
 
82 82
 # You can replace this text with custom code or comments, and it will be preserved on regeneration
  83
+
  84
+    # many_to_many():
  85
+    #   args:
  86
+    #     1) Name of relationship bridge, DBIC will create accessor with this name
  87
+    #     2) Name of has_many() relationship this many_to_many() is shortcut for
  88
+    #     3) Name of belongs_to() relationship in model class of has_many() above
  89
+    #   You must already have the has_many() defined to use a many_to_many().
  90
+__PACKAGE__->many_to_many(books => 'book_authors', 'book');
  91
+
83 92
 __PACKAGE__->meta->make_immutable;
84 93
 1;
9  lib/Catalyst/Default/Schema/Result/Book.pm
@@ -80,5 +80,14 @@ __PACKAGE__->has_many(
80 80
 
81 81
 
82 82
 # You can replace this text with custom code or comments, and it will be preserved on regeneration
  83
+
  84
+# many_to_many():
  85
+    #   args:
  86
+    #     1) Name of relationship bridge, DBIC will create accessor with this name
  87
+    #     2) Name of has_many() relationship this many_to_many() is shortcut for
  88
+    #     3) Name of belongs_to() relationship in model class of has_many() above
  89
+    #   You must already have the has_many() defined to use a many_to_many().
  90
+__PACKAGE__->many_to_many(authors => 'book_authors', 'author');
  91
+
83 92
 __PACKAGE__->meta->make_immutable;
84 93
 1;

0 notes on commit f811188

Please sign in to comment.
Something went wrong with that request. Please try again.