From: Guillermo Roditi Date: Tue, 16 Dec 2008 22:52:12 +0000 (+0000) Subject: minor typo and style change X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3feaaa7de65ab99d36319c53f545e6a06095fe15;p=dbsrgits%2FDBIx-Class-Historic.git minor typo and style change --- diff --git a/Changes b/Changes index 9725474..55a45ee 100644 --- a/Changes +++ b/Changes @@ -3,7 +3,7 @@ Revision history for DBIx::Class - Classes submitted as result_class for a resultsource are now automatically loaded via ensure_loaded() - 'result_class' resultset attribute, identical to result_class() - - add 'null_on_fk' option for relationship accessors of type 'single'. + - add 'undef_on_null_fk' option for relationship accessors of type 'single'. This will prevent DBIC from querying the database if one or more of the key columns IS NULL. Tests + docs (groditi) - for 'belongs_to' rels, 'null_on_fk' defaults to true. diff --git a/lib/DBIx/Class/Relationship/Accessor.pm b/lib/DBIx/Class/Relationship/Accessor.pm index ef38ff8..dcb906e 100644 --- a/lib/DBIx/Class/Relationship/Accessor.pm +++ b/lib/DBIx/Class/Relationship/Accessor.pm @@ -30,8 +30,7 @@ sub add_relationship_accessor { my $cond = $self->result_source->resolve_condition( $rel_info->{cond}, $rel, $self ); - if( exists $rel_info->{attrs}->{undef_on_null_fk} - && $rel_info->{attrs}->{undef_on_null_fk} ){ + if ($rel_info->{attrs}->{undef_on_null_fk}){ return if grep { not defined } values %$cond; } my $val = $self->find_related($rel, {}, {});