and
- $jfc ne DBIx::Class::_Util::UNRESOLVABLE_CONDITION
-
- and
-
grep { not defined $_ } values %%$jfc
);
my $rel_rset;
- if (
- ! $jfc
- and
- $relcond_is_freeform
- ) {
+ if( defined $jfc ) {
+
+ $rel_rset = $rsrc->related_source($rel)->resultset->search(
+ $jfc,
+ $rel_info->{attrs},
+ );
+ }
+ elsif( $relcond_is_freeform ) {
# A WHOREIFFIC hack to reinvoke the entire condition resolution
# with the correct alias. Another way of doing this involves a
}
else {
- # FIXME - this conditional doesn't seem correct - got to figure out
- # at some point what it does. Also the entire UNRESOLVABLE_CONDITION
- # business seems shady - we could simply not query *at all*
- my $attrs;
- if ( $jfc eq UNRESOLVABLE_CONDITION ) {
- $attrs = { %{$rel_info->{attrs}} };
- my $reverse = $rsrc->reverse_relationship_info($rel);
- foreach my $rev_rel (keys %$reverse) {
- if ($reverse->{$rev_rel}{attrs}{accessor} && $reverse->{$rev_rel}{attrs}{accessor} eq 'multi') {
- weaken($attrs->{related_objects}{$rev_rel}[0] = $self);
- } else {
- weaken($attrs->{related_objects}{$rev_rel} = $self);
- }
- }
- }
+ my $attrs = { %{$rel_info->{attrs}} };
+ my $reverse = $rsrc->reverse_relationship_info($rel);
+
+ # FIXME - this loop doesn't seem correct - got to figure out
+ # at some point what exactly it does.
+ ( ( $reverse->{$_}{attrs}{accessor}||'') eq 'multi' )
+ ? weaken( $attrs->{related_objects}{$_}[0] = $self )
+ : weaken( $attrs->{related_objects}{$_} = $self )
+ for keys %$reverse;
$rel_rset = $rsrc->related_source($rel)->resultset->search(
- $jfc,
- $attrs || $rel_info->{attrs},
+ UNRESOLVABLE_CONDITION, # guards potential use of the $rs in the future
+ $attrs,
);
}
# FIXME - temporarly force-override
delete $args->{require_join_free_condition};
- $ret->{join_free_condition} = UNRESOLVABLE_CONDITION;
+ delete $ret->{join_free_condition};
last;
}
}
if (@{ $rel_info->{cond} } == 0) {
$ret = {
condition => UNRESOLVABLE_CONDITION,
- join_free_condition => UNRESOLVABLE_CONDITION,
};
}
else {
if (
$args->{require_join_free_condition}
and
- ( ! $ret->{join_free_condition} or $ret->{join_free_condition} eq UNRESOLVABLE_CONDITION )
+ ! defined $ret->{join_free_condition}
) {
$self->throw_exception(
ucfirst sprintf "$exception_rel_id does not resolve to a %sjoin-free condition fragment",
# we got something back - sanity check and infer values if we can
my @nonvalues;
- if (
- $ret->{join_free_condition}
- and
- $ret->{join_free_condition} ne UNRESOLVABLE_CONDITION
- ) {
+ if( $ret->{join_free_condition} ) {
my $jfc_eqs = extract_equality_conditions(
$ret->{join_free_condition},
push @nonvalues, { $_ => $ret->{join_free_condition}{$_} };
}
else {
- # a join_free_condoition is fully qualified by definition
+ # a join_free_condition is fully qualified by definition
my ($col) = $_ =~ /\.(.+)/ or carp_unique(
'Internal error - extract_equality_conditions() returned a '
. "non-fully-qualified key '$_'. *Please* file a bugreport "