From: Gerda Shank Date: Fri, 5 Feb 2010 21:29:24 +0000 (+0000) Subject: add doc on 'where' attribute X-Git-Tag: v0.08118~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=406734bb5c45f5f97208e5ffb323903ca06a9852;p=dbsrgits%2FDBIx-Class.git add doc on 'where' attribute --- diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 7cd3214..d7d59ba 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -30,6 +30,8 @@ methods, for predefined ones, look in L. __PACKAGE__->add_relationship('relname', 'Foreign::Class', $cond, $attrs); +=head3 condition + The condition needs to be an L-style representation of the join between the tables. When resolving the condition for use in a C, keys using the pseudo-table C are resolved to mean "the Table on the @@ -67,9 +69,18 @@ Each key-value pair provided in a hashref will be used as Ced conditions. To add an Ced condition, use an arrayref of hashrefs. See the L documentation for more details. -In addition to the -L, -the following attributes are also valid: +=head3 attributes + +The L 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