use DBIx::Class::ResultSourceHandle;
use DBIx::Class::Carp;
-use DBIx::Class::_Util 'is_literal_value';
+use DBIx::Class::_Util qw(is_literal_value UNRESOLVABLE_CONDITION);
use Devel::GlobalDestruction;
use Try::Tiny;
use List::Util 'first';
else {
$res_args[$_] ||= {};
+ # hate everywhere - have to pass in as a plain hash
+ # pretending to be an object at least for now
$self->throw_exception("Unsupported object-like structure encountered: $res_args[$_]")
unless ref $res_args[$_] eq 'HASH';
-
- # hate everywhere
- $res_args[$_] = $self->relationship_info($rel_name)->{source}->result_class->new($res_args[$_]);
}
}
return wantarray ? @res : $res[0];
}
-our $UNRESOLVABLE_CONDITION = \ '1 = 0';
+# Keep this indefinitely. There is evidence of both CPAN and
+# darkpan using it, and there isn't much harm in an extra var
+# anyway.
+our $UNRESOLVABLE_CONDITION = UNRESOLVABLE_CONDITION;
+# YES I KNOW THIS IS EVIL
+# it is there to save darkpan from themselves, since internally
+# we are moving to a constant
+Internals::SvREADONLY($UNRESOLVABLE_CONDITION => 1);
# Resolves the passed condition to a concrete query fragment and a flag
# indicating whether this is a cross-table condition. Also an optional
;
for my $i (0..$#$obj_cols) {
- if (defined $args->{self_resultobj} and ! $obj->has_column_loaded($obj_cols->[$i])) {
+
+ # FIXME - temp shim
+ if (! blessed $obj) {
+ $cond->{"$plain_alias.$plain_cols->[$i]"} = $obj->{$obj_cols->[$i]};
+ }
+ elsif (
+ defined $args->{self_resultobj}
+ and
+ ! $obj->has_column_loaded($obj_cols->[$i])
+ ) {
$self->throw_exception(sprintf
"Unable to resolve relationship '%s' from object '%s': column '%s' not "
$obj_cols->[$i],
) if $obj->in_storage;
- return $UNRESOLVABLE_CONDITION;
+ return UNRESOLVABLE_CONDITION;
}
else {
$cond->{"$plain_alias.$plain_cols->[$i]"} = $obj->get_column($obj_cols->[$i]);
}
elsif (ref $args->{condition} eq 'ARRAY') {
if (@{$args->{condition}} == 0) {
- return $UNRESOLVABLE_CONDITION;
+ return UNRESOLVABLE_CONDITION;
}
elsif (@{$args->{condition}} == 1) {
return $self->_resolve_relationship_condition({