- # only handles related result classes with single primary keys
- if ( 1 == scalar @related_pks ) {
- my @fk = keys %$resolved;
- $object->$name->search(
- { $related_pks[0] => { -not_in => \@updated_ids } } )
- ->update( { $fk[0] => undef } );
- }
+ #warn "\tCOND: " . Dumper(\%cond);
+ #my $rel_delist_cnt = $rs_rel_delist->count;
+ if ( $if_not_submitted eq 'delete' ) {
+
+ #warn "\tdeleting related rows: $rel_delist_cnt\n";
+ $rs_rel_delist->delete;
+
+ # # only handles related result classes with single primary keys
+ # if ( 1 == $rel_col_cnt ) {
+ # $object->$name->search(
+ # { $rel_cols[0] =>
+ # { -not_in => [ map ( $_->id, @updated_objs ) ] }
+ # }
+ # )->delete;
+ # }
+ # else {
+ # warn "multi-column relationships aren't supported\n";
+ # }
+ }
+ elsif ( $if_not_submitted eq 'set_to_null' ) {
+
+ #warn "\tnullifying related rows: $rel_delist_cnt\n";
+ my %update = map { $_ => undef } @rel_cols;
+ $rs_rel_delist->update( \%update );
+
+ # # only handles related result classes with single primary keys
+ # if ( 1 == $rel_col_cnt ) {
+ # $object->$name->search(
+ # { $rel_cols[0] =>
+ # { -not_in => [ map ( $_->id, @updated_objs ) ] }
+ # }
+ # )->update( { $rel_cols[0] => undef } );
+ # }
+ # else {
+ # warn "multi-column relationships aren't supported\n";
+ # }