Now Koha::Object(s) implement 'to_api' and 'attributes_from_api' there's no need to implement such mappings on the controllers for simple Koha::Object<->API conversions. The to_api mappings have already been moved to Koha::Object level. It is time for the to_model ones.
Created attachment 96703 [details] [review] Bug 24321: Add Koha::Objects->attributes_from_api This patch makes the 'attributes_from_api' method from the singular class available from the result set class. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Objects.t => SUCCESS: Tests pass! 4. Sign off :-D 5. Yeah, I skipped 3 :-P
Created attachment 96704 [details] [review] Bug 24321: Make dbic_merge_sorting accept a result set as parameter This patch makes dbic_merge_sorting accept a result set as parameter and solves a FIXME in _build_order_atom. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D
Created attachment 96705 [details] [review] Bug 24321: Make objects.search use mappings from Koha::Object(s) This patch simplifies the objects.search helper so it relies entirely on the result set object for the attribute mappings. The result is no more to_api or to_model mappings are passed. The controllers need to be cleaned up after this patch. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => SUCCESS: Tests pass! 3. Sign off :-D Note: the original version of this helpers accepted arbitrary mappings and are now constrianed to real mappings on the Koha::Object level. As such, the number of tests got reduced.
Created attachment 96706 [details] [review] Bug 24312: Clean /cities
Created attachment 96707 [details] [review] Bug 24312: Clean /acquisitions/funds
Created attachment 96708 [details] [review] Bug 24312: Clean /acquisitions/vendors
Created attachment 96709 [details] [review] Bug 24321: Clean /libraries
Created attachment 96710 [details] [review] Bug 24321: Clean /checkouts
Created attachment 96711 [details] [review] Bug 24321: Add Koha::Objects->attributes_from_api This patch makes the 'attributes_from_api' method from the singular class available from the result set class. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Objects.t => SUCCESS: Tests pass! 4. Sign off :-D 5. Yeah, I skipped 3 :-P
Created attachment 96712 [details] [review] Bug 24321: Make dbic_merge_sorting accept a result set as parameter This patch makes dbic_merge_sorting accept a result set as parameter and solves a FIXME in _build_order_atom. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D
Created attachment 96713 [details] [review] Bug 24321: Make objects.search use mappings from Koha::Object(s) This patch simplifies the objects.search helper so it relies entirely on the result set object for the attribute mappings. The result is no more to_api or to_model mappings are passed. The controllers need to be cleaned up after this patch. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => SUCCESS: Tests pass! 3. Sign off :-D Note: the original version of this helpers accepted arbitrary mappings and are now constrianed to real mappings on the Koha::Object level. As such, the number of tests got reduced.
Created attachment 96714 [details] [review] Bug 24321: Clean /cities
Created attachment 96715 [details] [review] Bug 24321: Clean /acquisitions/funds
Created attachment 96716 [details] [review] Bug 24321: Clean /acquisitions/vendors
Created attachment 96717 [details] [review] Bug 24321: Clean /libraries
Created attachment 96718 [details] [review] Bug 24321: Clean /checkouts
Created attachment 96719 [details] [review] Bug 24321: Clean /biblios
Created attachment 96720 [details] [review] Bug 24321: Clean /items
Created attachment 96721 [details] [review] Bug 24321: Clean /patrons/{patron_id}/account
Created attachment 96722 [details] [review] Bug 24321: Clean /holds
Created attachment 96744 [details] [review] Bug 24321: Clean /patrons
Full test plan: - Apply this patchset and run: $ kshell k$ prove t/db_dependent/Koha/Objects.t \ t/Koha/REST/Plugin/Query.t \ t/db_dependent/Koha/REST/Plugin/Objects.t \ t/db_dependent/api/v1 => SUCCESS: Tests pass!
Created attachment 96840 [details] [review] Bug 24321: Add Koha::Objects->attributes_from_api This patch makes the 'attributes_from_api' method from the singular class available from the result set class. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Objects.t => SUCCESS: Tests pass! 4. Sign off :-D 5. Yeah, I skipped 3 :-P
Created attachment 96841 [details] [review] Bug 24321: Make dbic_merge_sorting accept a result set as parameter This patch makes dbic_merge_sorting accept a result set as parameter and solves a FIXME in _build_order_atom. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D
Created attachment 96842 [details] [review] Bug 24321: Make objects.search use mappings from Koha::Object(s) This patch simplifies the objects.search helper so it relies entirely on the result set object for the attribute mappings. The result is no more to_api or to_model mappings are passed. The controllers need to be cleaned up after this patch. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => SUCCESS: Tests pass! 3. Sign off :-D Note: the original version of this helpers accepted arbitrary mappings and are now constrianed to real mappings on the Koha::Object level. As such, the number of tests got reduced.
Created attachment 96843 [details] [review] Bug 24321: Clean /cities
Created attachment 96844 [details] [review] Bug 24321: Clean /acquisitions/funds
Created attachment 96845 [details] [review] Bug 24321: Clean /acquisitions/vendors
Created attachment 96846 [details] [review] Bug 24321: Clean /libraries
Created attachment 96847 [details] [review] Bug 24321: Clean /checkouts
Created attachment 96848 [details] [review] Bug 24321: Clean /biblios
Created attachment 96849 [details] [review] Bug 24321: Clean /items
Created attachment 96850 [details] [review] Bug 24321: Clean /patrons/{patron_id}/account
Created attachment 96851 [details] [review] Bug 24321: Clean /holds
Created attachment 96852 [details] [review] Bug 24321: Clean /patrons
Rebased on top of bug 21684 which is in master
Created attachment 96874 [details] [review] Bug 24321: Add Koha::Objects->attributes_from_api This patch makes the 'attributes_from_api' method from the singular class available from the result set class. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Objects.t => SUCCESS: Tests pass! 4. Sign off :-D 5. Yeah, I skipped 3 :-P Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96875 [details] [review] Bug 24321: Make dbic_merge_sorting accept a result set as parameter This patch makes dbic_merge_sorting accept a result set as parameter and solves a FIXME in _build_order_atom. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96876 [details] [review] Bug 24321: Make objects.search use mappings from Koha::Object(s) This patch simplifies the objects.search helper so it relies entirely on the result set object for the attribute mappings. The result is no more to_api or to_model mappings are passed. The controllers need to be cleaned up after this patch. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => SUCCESS: Tests pass! 3. Sign off :-D Note: the original version of this helpers accepted arbitrary mappings and are now constrianed to real mappings on the Koha::Object level. As such, the number of tests got reduced. Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96877 [details] [review] Bug 24321: Clean /cities Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96878 [details] [review] Bug 24321: Clean /acquisitions/funds Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96879 [details] [review] Bug 24321: Clean /acquisitions/vendors Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96880 [details] [review] Bug 24321: Clean /libraries Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96881 [details] [review] Bug 24321: Clean /checkouts Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96882 [details] [review] Bug 24321: Clean /biblios Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96883 [details] [review] Bug 24321: Clean /items Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96884 [details] [review] Bug 24321: Clean /patrons/{patron_id}/account Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96885 [details] [review] Bug 24321: Clean /holds Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96886 [details] [review] Bug 24321: Clean /patrons Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96887 [details] [review] Bug 24321: (follow-up) Fix number of tests in t/db_dependent/Koha/Objects.t Test plan: prove t/db_dependent/Koha/Objects.t Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 96939 [details] [review] Bug 24321: Add Koha::Objects->attributes_from_api This patch makes the 'attributes_from_api' method from the singular class available from the result set class. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Objects.t => SUCCESS: Tests pass! 4. Sign off :-D 5. Yeah, I skipped 3 :-P Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96940 [details] [review] Bug 24321: Make dbic_merge_sorting accept a result set as parameter This patch makes dbic_merge_sorting accept a result set as parameter and solves a FIXME in _build_order_atom. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/Koha/REST/Plugin/Query.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96941 [details] [review] Bug 24321: Make objects.search use mappings from Koha::Object(s) This patch simplifies the objects.search helper so it relies entirely on the result set object for the attribute mappings. The result is no more to_api or to_model mappings are passed. The controllers need to be cleaned up after this patch. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => SUCCESS: Tests pass! 3. Sign off :-D Note: the original version of this helpers accepted arbitrary mappings and are now constrianed to real mappings on the Koha::Object level. As such, the number of tests got reduced. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96942 [details] [review] Bug 24321: Clean /cities Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96943 [details] [review] Bug 24321: Clean /acquisitions/funds Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96944 [details] [review] Bug 24321: Clean /acquisitions/vendors Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96945 [details] [review] Bug 24321: Clean /libraries Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96946 [details] [review] Bug 24321: Clean /checkouts Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96947 [details] [review] Bug 24321: Clean /biblios Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96948 [details] [review] Bug 24321: Clean /items Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96949 [details] [review] Bug 24321: Clean /patrons/{patron_id}/account Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96950 [details] [review] Bug 24321: Clean /holds Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96951 [details] [review] Bug 24321: Clean /patrons Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 96952 [details] [review] Bug 24321: (follow-up) Fix number of tests in t/db_dependent/Koha/Objects.t Test plan: prove t/db_dependent/Koha/Objects.t Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Nice work everyone! Pushed to master for 20.05
Tomas this would not apply to the 19.11.x branch. Can you assist me if you need this backported? error: could not apply fabcedca05... Bug 24321: Add Koha::Objects->attributes_from_api hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' or 'git rm <paths>' hint: and commit the result with 'git commit'
enhancement not backported to 19.11.x
*** Bug 19250 has been marked as a duplicate of this bug. ***