From: David Schmidt Date: Mon, 23 Dec 2013 14:43:27 +0000 (+0100) Subject: better explanation for optional fk values in rels X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1120eafb56694be4c270547c5587a56c5a129a90;p=dbsrgits%2FDBIx-Class-Historic.git better explanation for optional fk values in rels --- diff --git a/lib/DBIx/Class/Relationship.pm b/lib/DBIx/Class/Relationship.pm index 26a07ef..8098342 100644 --- a/lib/DBIx/Class/Relationship.pm +++ b/lib/DBIx/Class/Relationship.pm @@ -192,14 +192,14 @@ more info see L. $book->get_column('author_id'); -If the relationship is optional -- i.e. the column containing the -foreign key can be NULL -- then the belongs_to relationship does the +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 in this case you would probably want to set -the L attribute so that -a C is done, which makes complex resultsets involving -C or C operations work correctly. The modified -declaration is shown below: +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 +C operations). The modified declaration is shown below: # in a Book class (where Author has_many Books) __PACKAGE__->belongs_to( @@ -209,7 +209,6 @@ declaration is shown below: { join_type => 'left' } ); - Cascading deletes are off by default on a C relationship. To turn them on, pass C<< cascade_delete => 1 >> in the $attr hashref.