From: David Schmidt Date: Mon, 30 Dec 2013 08:46:40 +0000 (+0100) Subject: better explanation for optional fk values in rels (2nd try) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21b5fecd86b603109f1e8ab565267efb75012846;p=dbsrgits%2FDBIx-Class-Historic.git better explanation for optional fk values in rels (2nd try) --- diff --git a/lib/DBIx/Class/Relationship.pm b/lib/DBIx/Class/Relationship.pm index 8098342..979630f 100644 --- a/lib/DBIx/Class/Relationship.pm +++ b/lib/DBIx/Class/Relationship.pm @@ -191,14 +191,13 @@ more info see L. # To retrieve the plain id if you used the ugly version: $book->get_column('author_id'); - -If the the column containin the foreign key of a relationship -can be NULL the belongs_to relationship still does the -right thing. Thus, in the example above C<< $obj->author >> would -return C. However you probably want to set the +If the column containing the foreign key of a relationship +is nullable, the belongs_to relationship still does the +right thing. (i.e. C<< $obj->author >> would return C). +However you probably want to set the L attribute so that -a C is done, which makes relationship traversal in complex -resultsets work correctly. (i.e. resultsets involving C or +a C is done. This ensures that relationship traversal works +consistently in all situations. (i.e. resultsets involving C or C operations). The modified declaration is shown below: # in a Book class (where Author has_many Books)