It would be handy to be able to safe_delete on an items result set. For example, if we wanted to cancel an order in the Koha:: namespace, we could just call $self->items->safe_delete;
Created attachment 110563 [details] [review] Bug 26509: Add CannotBeDeleted object exception This patch adds a new exception with tests for the stringification. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Koha/Exceptions.t => SUCCESS: Tests pass 3. Sign off :-D
Created attachment 110564 [details] [review] Bug 26509: Add Koha::Items->safe_delete This patch adds a handy method that can be used to call safe_delete on a resultset. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Items.t => SUCCESS: Tests pass! 3. Sign off :-D
Created attachment 110579 [details] [review] Bug 26509: Add CannotBeDeleted object exception This patch adds a new exception with tests for the stringification. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Koha/Exceptions.t => SUCCESS: Tests pass 3. Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 110580 [details] [review] Bug 26509: Add Koha::Items->safe_delete This patch adds a handy method that can be used to call safe_delete on a resultset. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Items.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
All works as expected.
Created attachment 110629 [details] [review] Bug 26509: Add CannotBeDeleted object exception This patch adds a new exception with tests for the stringification. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Koha/Exceptions.t => SUCCESS: Tests pass 3. Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 110630 [details] [review] Bug 26509: Add Koha::Items->safe_delete This patch adds a handy method that can be used to call safe_delete on a resultset. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Items.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
FYI I don't plan to push patches that add new methods which are not effectively used.
(In reply to Jonathan Druart from comment #8) > FYI I don't plan to push patches that add new methods which are not > effectively used. Yes, this is part of a tree that makes use of it. This is used in bug 26515, which I'm currently rewriting.
Created attachment 111373 [details] [review] Bug 26509: Make safe_delete return the number of deleted objects It must the behaviour for all Koha::Objects->delete methods
There are doubts about the usefulness of this method. I dropped its use on bug 26515. Setting 'In discussion' until there's a real use for it.