It would be great if objects.search added the prefetch automatically when an embed action is requested.
Created attachment 97680 [details] [review] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D
Created attachment 97681 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/db_dependent/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D
This is missing tests for the helpers.
Created attachment 97848 [details] [review] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D
Created attachment 97849 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/db_dependent/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D
Created attachment 97851 [details] [review] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D
Created attachment 97852 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/db_dependent/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D
(In reply to Tomás Cohen Arazi from comment #3) > This is missing tests for the helpers. Just added missing tests!
Created attachment 97935 [details] [review] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D
Created attachment 97936 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/db_dependent/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D
Tests fail: prove t/db_dependent/Koha/Object* t/db_dependent/Koha/Objects.t .. 18/21 # Failed test 'Relationship matching method name is listed' # at t/db_dependent/Koha/Objects.t line 800. # Failed test 'Guessed the object class correctly' # at t/db_dependent/Koha/Objects.t line 804. # got: undef # expected: 'Koha::Acquisition::BasketGroup' # Looks like you failed 2 tests of 2. # Failed test 'prefetch_whitelist() tests' # at t/db_dependent/Koha/Objects.t line 809. # Looks like you failed 1 test of 21. t/db_dependent/Koha/Objects.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/21 subtests t/db_dependent/Koha/Object.t ... 17/18 # Failed test 'Relationship matching method name is listed' # at t/db_dependent/Koha/Object.t line 754. # Failed test 'Guessed the object class correctly' # at t/db_dependent/Koha/Object.t line 758. # got: undef # expected: 'Koha::Acquisition::BasketGroup' # Looks like you failed 2 tests of 2. # Failed test 'prefetch_whitelist() tests' # at t/db_dependent/Koha/Object.t line 763. # Looks like you failed 1 test of 18. t/db_dependent/Koha/Object.t ... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/18 subtests Test Summary Report ------------------- t/db_dependent/Koha/Objects.t (Wstat: 256 Tests: 21 Failed: 1) Failed test: 21 Non-zero exit status: 1 t/db_dependent/Koha/Object.t (Wstat: 256 Tests: 18 Failed: 1) Failed test: 18 Non-zero exit status: 1 Files=2, Tests=39, 22 wallclock secs ( 0.05 usr 0.01 sys + 17.92 cusr 3.05 csys = 21.03 CPU) Result: FAIL
Created attachment 98261 [details] [review] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D
Created attachment 98262 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/db_dependent/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D
(In reply to David Nind from comment #11) > Tests fail: > > prove t/db_dependent/Koha/Object* > > t/db_dependent/Koha/Objects.t .. 18/21 > # Failed test 'Relationship matching method name is listed' > # at t/db_dependent/Koha/Objects.t line 800. > > # Failed test 'Guessed the object class correctly' > # at t/db_dependent/Koha/Objects.t line 804. > # got: undef > # expected: 'Koha::Acquisition::BasketGroup' > # Looks like you failed 2 tests of 2. > > # Failed test 'prefetch_whitelist() tests' > # at t/db_dependent/Koha/Objects.t line 809. > # Looks like you failed 1 test of 21. > t/db_dependent/Koha/Objects.t .. Dubious, test returned 1 (wstat 256, 0x100) > Failed 1/21 subtests > t/db_dependent/Koha/Object.t ... 17/18 > # Failed test 'Relationship matching method name is listed' > # at t/db_dependent/Koha/Object.t line 754. > > # Failed test 'Guessed the object class correctly' > # at t/db_dependent/Koha/Object.t line 758. > # got: undef > # expected: 'Koha::Acquisition::BasketGroup' > # Looks like you failed 2 tests of 2. > > # Failed test 'prefetch_whitelist() tests' > # at t/db_dependent/Koha/Object.t line 763. > # Looks like you failed 1 test of 18. > t/db_dependent/Koha/Object.t ... Dubious, test returned 1 (wstat 256, 0x100) > Failed 1/18 subtests > > Test Summary Report > ------------------- > t/db_dependent/Koha/Objects.t (Wstat: 256 Tests: 21 Failed: 1) > Failed test: 21 > Non-zero exit status: 1 > t/db_dependent/Koha/Object.t (Wstat: 256 Tests: 18 Failed: 1) > Failed test: 18 > Non-zero exit status: 1 > Files=2, Tests=39, 22 wallclock secs ( 0.05 usr 0.01 sys + 17.92 cusr 3.05 > csys = 21.03 CPU) > Result: FAIL Hi David, thanks for testing. I just rebased and fixed tests. Could you please do another run? Regards.
Tests for prove t/db_dependent/Koha/REST/Plugin/Query.t generate this error message: Cannot detect source of 't/db_dependent/Koha/REST/Plugin/Query.t'! at /usr/share/perl/5.24/TAP/Parser/IteratorFactory.pm line 261. TAP::Parser::IteratorFactory::detect_source(TAP::Parser::IteratorFactory=HASH(0x562a13917438), TAP::Parser::Source=HASH(0x562a13917510)) called at /usr/share/perl/5.24/TAP/Parser/IteratorFactory.pm line 211 TAP::Parser::IteratorFactory::make_iterator(TAP::Parser::IteratorFactory=HASH(0x562a13917438), TAP::Parser::Source=HASH(0x562a13917510)) called at /usr/share/perl/5.24/TAP/Parser.pm line 472 TAP::Parser::_initialize(TAP::Parser=HASH(0x562a139170f0), HASH(0x562a136dc0e0)) called at /usr/share/perl/5.24/TAP/Object.pm line 55 TAP::Object::new("TAP::Parser", HASH(0x562a136dc0e0)) called at /usr/share/perl/5.24/TAP/Object.pm line 130 TAP::Object::_construct(TAP::Harness=HASH(0x562a1314e3f0), "TAP::Parser", HASH(0x562a136dc0e0)) called at /usr/share/perl/5.24/TAP/Harness.pm line 852 TAP::Harness::make_parser(TAP::Harness=HASH(0x562a1314e3f0), TAP::Parser::Scheduler::Job=HASH(0x562a13837648)) called at /usr/share/perl/5.24/TAP/Harness.pm line 651 TAP::Harness::_aggregate_single(TAP::Harness=HASH(0x562a1314e3f0), TAP::Parser::Aggregator=HASH(0x562a13168d48), TAP::Parser::Scheduler=HASH(0x562a138375e8)) called at /usr/share/perl/5.24/TAP/Harness.pm line 743 TAP::Harness::aggregate_tests(TAP::Harness=HASH(0x562a1314e3f0), TAP::Parser::Aggregator=HASH(0x562a13168d48), "t/db_dependent/Koha/REST/Plugin/Query.t") called at /usr/share/perl/5.24/TAP/Harness.pm line 558 TAP::Harness::__ANON__() called at /usr/share/perl/5.24/TAP/Harness.pm line 571 TAP::Harness::runtests(TAP::Harness=HASH(0x562a1314e3f0), "t/db_dependent/Koha/REST/Plugin/Query.t") called at /usr/share/perl/5.24/App/Prove.pm line 546 App::Prove::_runtests(App::Prove=HASH(0x562a13143888), HASH(0x562a135b1c90), "t/db_dependent/Koha/REST/Plugin/Query.t") called at /usr/share/perl/5.24/App/Prove.pm line 504 App::Prove::run(App::Prove=HASH(0x562a13143888)) called at /usr/bin/prove line 13
Created attachment 98348 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D
(In reply to David Nind from comment #15) > Tests for prove t/db_dependent/Koha/REST/Plugin/Query.t generate this error > message: > > Cannot detect source of 't/db_dependent/Koha/REST/Plugin/Query.t'! at > /usr/share/perl/5.24/TAP/Parser/IteratorFactory.pm line 261. > TAP::Parser::IteratorFactory::detect_source(TAP::Parser:: > IteratorFactory=HASH(0x562a13917438), > TAP::Parser::Source=HASH(0x562a13917510)) called at > /usr/share/perl/5.24/TAP/Parser/IteratorFactory.pm line 211 > TAP::Parser::IteratorFactory::make_iterator(TAP::Parser:: > IteratorFactory=HASH(0x562a13917438), > TAP::Parser::Source=HASH(0x562a13917510)) called at > /usr/share/perl/5.24/TAP/Parser.pm line 472 > TAP::Parser::_initialize(TAP::Parser=HASH(0x562a139170f0), > HASH(0x562a136dc0e0)) called at /usr/share/perl/5.24/TAP/Object.pm line 55 > TAP::Object::new("TAP::Parser", HASH(0x562a136dc0e0)) called at > /usr/share/perl/5.24/TAP/Object.pm line 130 > TAP::Object::_construct(TAP::Harness=HASH(0x562a1314e3f0), "TAP::Parser", > HASH(0x562a136dc0e0)) called at /usr/share/perl/5.24/TAP/Harness.pm line 852 > TAP::Harness::make_parser(TAP::Harness=HASH(0x562a1314e3f0), > TAP::Parser::Scheduler::Job=HASH(0x562a13837648)) called at > /usr/share/perl/5.24/TAP/Harness.pm line 651 > TAP::Harness::_aggregate_single(TAP::Harness=HASH(0x562a1314e3f0), > TAP::Parser::Aggregator=HASH(0x562a13168d48), > TAP::Parser::Scheduler=HASH(0x562a138375e8)) called at > /usr/share/perl/5.24/TAP/Harness.pm line 743 > TAP::Harness::aggregate_tests(TAP::Harness=HASH(0x562a1314e3f0), > TAP::Parser::Aggregator=HASH(0x562a13168d48), > "t/db_dependent/Koha/REST/Plugin/Query.t") called at > /usr/share/perl/5.24/TAP/Harness.pm line 558 > TAP::Harness::__ANON__() called at /usr/share/perl/5.24/TAP/Harness.pm line > 571 > TAP::Harness::runtests(TAP::Harness=HASH(0x562a1314e3f0), > "t/db_dependent/Koha/REST/Plugin/Query.t") called at > /usr/share/perl/5.24/App/Prove.pm line 546 > App::Prove::_runtests(App::Prove=HASH(0x562a13143888), > HASH(0x562a135b1c90), "t/db_dependent/Koha/REST/Plugin/Query.t") called at > /usr/share/perl/5.24/App/Prove.pm line 504 > App::Prove::run(App::Prove=HASH(0x562a13143888)) called at /usr/bin/prove > line 13 Ups!.. the path of Query.t was not in db_dependent. Sorry
Created attachment 98353 [details] [review] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
Created attachment 98354 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
Created attachment 98543 [details] [review] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
Created attachment 98544 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
Patches didn't apply so rebased this bug.
Created attachment 98602 [details] [review] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D Signed-off-by: David Nind <david@davidnind.com>
Created attachment 98603 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: David Nind <david@davidnind.com>
(In reply to Agustín Moyano from comment #22) > Patches didn't apply so rebased this bug. Not sure I needed to, but signed off again.
Created attachment 99349 [details] [review] Bug 24356: prefetch_whitelist tests This patch adds tests for the introduced methods. To test: 1. Run the tests :-D => SUCCESS: They pass! 2. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 99350 [details] [review] Bug 24356: Make objects.search prefetch embedded relations This patch makes the Koha::Object(s) derived classes expose information about prefetch-able relations. This is then used by a new helper to generate the prefetch information for the DBIC query. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object* \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Well written and clear patch which passes all qa script tests and works as expected. Passing QA
Nice work everyone! Pushed to master for 20.05
Enhancement not backported to 19.11.x