my $collector = shift;
my $label = shift;
my $path = shift;
+ my $ed = shift;
+ my $outer = 0;
+ if (!$ed) {
+ $ed = new_rstore_editor(xact=>1);
+ $outer = 1;
+ }
my $step = shift(@$path);
-
my $fhint = Fieldmapper->publish_fieldmapper->{$context->class_name}{links}{$step}{class};
my $fclass = $self->_fm_class_by_hint( $fhint );
$meth =~ s/Fieldmapper:://;
$meth =~ s/::/_/g;
- my $ed = grep( /open-ils.cstore/, @{$fclass->Controller} ) ?
- $self->editor :
- new_rstore_editor(($self->standalone ? () : (xact=>1)));
-
my $obj = $context->$step();
$logger->debug(
my $def_id = $self->event->event_def->id;
my $str_path = join('.', @$path);
- if ($self->standalone) {
- $ed->xact_begin || return undef;
- }
-
$obj = $_object_by_path_cache{$def_id}{$str_path}{$step}{$ffield}{$lval} ||
$ed->$meth( ($multi) ? { $ffield => $lval } : $lval);
$_object_by_path_cache{$def_id}{$str_path}{$step}{$ffield}{$lval} ||= $obj;
-
- if ($self->standalone) {
- $ed->xact_rollback || return undef;
- }
}
}
for (@$obj_list) {
my @path_clone = @$path;
- $self->_object_by_path( $_, $collector, $label, \@path_clone );
+ $self->_object_by_path( $_, $collector, $label, \@path_clone, $ed );
}
$obj = $$obj_list[0] if (!$multi || $rtype eq 'might_have');
}
}
+ $ed->rollback if ($outer);
return $obj;
}