[Koha-bugs] [Bug 21684] Koha::Object[s]->delete methods must behave identically as the corresponding DBIx::Class ones

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Jan 7 15:27:40 CET 2020


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

--- Comment #33 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
(In reply to Marcel de Rooy from comment #31)
> How do we view this line now in both modules?
>     return $rv==0 ? "0E0" : $rv;
> Also in delete_missing.

I do not understand exactly what you mean.

> The Upload.t test also refers to -1 values. Are they still possible? At
> first glance the test should still be adjusted a bit more, although it
> passes now.

Indeed, done.

> Second patch
> +    my $deleted = $self->_result()->delete;
> +    if ( ref $deleted ) {
> +        my $object_class  = Koha::Object::_get_object_class(
> $self->_result->result_class );
> +        $deleted = $object_class->_new_from_dbic($deleted);
> +    }
> +    return $deleted;
> Isnt this a bit expensive to do since we will generally not even look at
> what we get back?

I do not think it's expensive, the _new_from_dbic will do nothing if the object
is not reused after ->delete. So only _get_object_class will be effective.

> Most often $obj->delete is not even tested.

It is widely tested in Objects.t

> Parameterize the return??

Not a good idea IMO. We must behave like DBIx::Class, it's the whole point of
this patchset.

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


More information about the Koha-bugs mailing list