[Bast-commits] r5230 -
DBIx-Class/0.08/branches/belongs_to_null_col_fix/lib/DBIx/Class/Relationship
groditi at dev.catalyst.perl.org
groditi at dev.catalyst.perl.org
Wed Dec 10 01:28:10 GMT 2008
Author: groditi
Date: 2008-12-10 01:28:10 +0000 (Wed, 10 Dec 2008)
New Revision: 5230
Modified:
DBIx-Class/0.08/branches/belongs_to_null_col_fix/lib/DBIx/Class/Relationship/Accessor.pm
Log:
fix for bug. all tests seem to pass, we still need a new test and more research
Modified: DBIx-Class/0.08/branches/belongs_to_null_col_fix/lib/DBIx/Class/Relationship/Accessor.pm
===================================================================
--- DBIx-Class/0.08/branches/belongs_to_null_col_fix/lib/DBIx/Class/Relationship/Accessor.pm 2008-12-10 01:26:38 UTC (rev 5229)
+++ DBIx-Class/0.08/branches/belongs_to_null_col_fix/lib/DBIx/Class/Relationship/Accessor.pm 2008-12-10 01:28:10 UTC (rev 5230)
@@ -18,6 +18,7 @@
my ($class, $rel, $acc_type) = @_;
my %meth;
if ($acc_type eq 'single') {
+ my $rel_cond = $class->relationship_info($rel)->{cond};
$meth{$rel} = sub {
my $self = shift;
if (@_) {
@@ -26,6 +27,10 @@
} elsif (exists $self->{_relationship_data}{$rel}) {
return $self->{_relationship_data}{$rel};
} else {
+ my $cond = $self->result_source->resolve_condition(
+ $rel_cond, $rel, $self
+ );
+ return if grep { not defined } values %$cond;
my $val = $self->find_related($rel, {}, {});
return unless $val;
return $self->{_relationship_data}{$rel} = $val;
More information about the Bast-commits
mailing list