[Koha-bugs] [Bug 25303] Koha::Objects->delete should not skip overridden object class ->delete

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Apr 30 12:58:03 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25303

--- Comment #15 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
(In reply to Jonathan Druart from comment #14)
> This follow-up is doing this:
> 
> -    $holds->delete;
> +    $biblio->holds->delete;
> 
> I was not expected such behaviour changes, it's not as easy as fixing the
> tests. Did you check the occurrences in the code?

I haven't. But that's why I highlighted the behavior change. I'm sure there
wouldn't be placed in which we do the same we did on those tests.

> Maybe we should call ->reset before the loop instead?

I think we should. We should be consistent with DBIC behaviour and the code
change you propose looks correct. The good thing is that you have a good schema
for the regression tests that are needed.

> 
> @ Koha/Objects.pm:185 @ sub delete {
>      if ( Class::Inspector->function_exists( $self->object_class, 'delete' )
> ) {
>          my $objects_deleted;
>          $self->_resultset->result_source->schema->txn_do( sub {
> +            $self->reset;
>              while ( my $o = $self->next ) {
>                  $o->delete;
>                  $objects_deleted++;

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list