# warn 'resolved: ' . Dumper( $resolved ); use Data::Dumper;
$resolved = undef
- if $DBIx::Class::ResultSource::UNRESOLVABLE_CONDITION == $resolved;
+ if defined $DBIx::Class::ResultSource::UNRESOLVABLE_CONDITION && $DBIx::Class::ResultSource::UNRESOLVABLE_CONDITION == $resolved;
if ( ref $updates->{$name} eq 'ARRAY' ) {
for my $sub_updates ( @{ $updates->{$name} } ) {
- $sub_updates = { %$sub_updates, %$resolved } if $resolved;
+ $sub_updates = { %$sub_updates, %$resolved } if $resolved && ref( $sub_updates ) eq 'HASH';
my $sub_object =
$related_result->recursive_update( $sub_updates );
}
}
else {
my $sub_updates = $updates->{$name};
- $sub_updates = { %$sub_updates, %$resolved } if $resolved;
+ $sub_updates = { %$sub_updates, %$resolved } if $resolved && ref( $sub_updates ) eq 'HASH';
my $sub_object =
$related_result->recursive_update( $sub_updates );
$object->set_from_related( $name, $sub_object );
sub run_tests{
my $schema = shift;
- plan tests => 28;
+ plan tests => 27;
my $dvd_rs = $schema->resultset( 'Dvd' );
my $user_rs = $schema->resultset( 'User' );
is ( $new_dvd->name, 'Test name 2', 'Dvd name set' );
is ( $new_dvd->owner->id, $another_owner->id, 'Owner set' );
is ( $new_dvd->viewings->count, 1, 'Viewing created' );
-
+
# creating new records
my $updates = {
aaaa => undef,
is ( $dvd->tags->count, 0, 'Tags deleted' );
is ( $dvd->liner_notes->notes, 'test note changed', 'might_have record changed' );
- $updates = {
- name => 'Test name 1',
- };
- $dvd = $dvd_rs->search( { id => $dvd->id } )->recursive_update( $updates, [ 'id' ] );
- is ( $dvd->name, 'Test name 1', 'Dvd name set in a resultset with restricted id' );
-
# repeatable
$updates = {
is( scalar @tags, 2, 'Tags in has_many related record saved' );
ok( $owned_dvds{'temp name 2'}, 'Second name in a has_many related record saved' );
+# $updates = {
+# name => 'Test name 1',
+# };
+# $dvd = $dvd_rs->search( { id => $dvd->id } )->recursive_update( $updates, [ 'id' ] );
+# is ( $dvd->name, 'Test name 1', 'Dvd name set in a resultset with restricted id' );
}