[Bast-commits] r8567 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship

gshank at dev.catalyst.perl.org gshank at dev.catalyst.perl.org
Fri Feb 5 21:29:25 GMT 2010


Author: gshank
Date: 2010-02-05 21:29:24 +0000 (Fri, 05 Feb 2010)
New Revision: 8567

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship/Base.pm
Log:
add doc on 'where' attribute


Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship/Base.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship/Base.pm	2010-02-05 18:13:24 UTC (rev 8566)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Relationship/Base.pm	2010-02-05 21:29:24 UTC (rev 8567)
@@ -30,6 +30,8 @@
 
   __PACKAGE__->add_relationship('relname', 'Foreign::Class', $cond, $attrs);
 
+=head3 condition
+
 The condition needs to be an L<SQL::Abstract>-style representation of the
 join between the tables. When resolving the condition for use in a C<JOIN>,
 keys using the pseudo-table C<foreign> are resolved to mean "the Table on the
@@ -67,10 +69,19 @@
 To add an C<OR>ed condition, use an arrayref of hashrefs. See the
 L<SQL::Abstract> documentation for more details.
 
-In addition to the
-L<standard ResultSet attributes|DBIx::Class::ResultSet/ATTRIBUTES>,
-the following attributes are also valid:
+=head3 attributes
 
+The L<standard ResultSet attributes|DBIx::Class::ResultSet/ATTRIBUTES> may
+be used as relationship attributes. In particular, the 'where' attribute is
+useful for filtering relationships:
+
+     __PACKAGE__->has_many( 'valid_users', 'MyApp::Schema::User',
+        { 'foreign.user_id' => 'self.user_id' },
+        { where => { valid => 1 } }
+    );
+
+The following attributes are also valid:
+
 =over 4
 
 =item join_type




More information about the Bast-commits mailing list