]> git.koha-community.org Git - koha.git/commit
Bug 25303: Make Koha::Objects->delete loop on the object set
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 28 Apr 2020 12:37:43 +0000 (14:37 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 29 Apr 2020 18:05:22 +0000 (19:05 +0100)
commit25c8f087cbca8c3e39e973f3dca10590ea660bd1
treeed430a6e0cc540ab7de020df4b0d98a94986f854
parente289e400789d2ba6f00004b65564f1201f39f191
Bug 25303: Make Koha::Objects->delete loop on the object set

If we call Koha::Libraries->delete but Koha::Library->delete exists
(ie. Koha::Object->delete is overridden), then we Koha::Objects->delete
will be called and the overridden will not be executed.

This patch suggests to test if the method is overridden (using
Class::Inspector->function_exists). If so we loop on the different
objects of the set in a transaction and call the overridden ->delete method.

Existing tests widely cover this change.
t/db_dependent/Koha/Objects.t
    subtest 'Return same values as DBIx::Class' => sub {

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Objects.pm