]> git.koha-community.org Git - koha.git/commit
Bug 36483: Make API controllers use $c->objects->to_api
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 2 Apr 2024 12:43:51 +0000 (12:43 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 23 May 2024 12:47:41 +0000 (14:47 +0200)
commit6b648ed4a7e6a607d037dd6434a40e34874380dd
tree505dca4e2cdfe58c073b14746ce6282fd4352c59
parent86e78b5511686b33068f92317f3a9e3b690594da
Bug 36483: Make API controllers use $c->objects->to_api

This patch makes all controller methods using direct $object->to_api, rely on $c->objects->to_api.

Direct ->to_api calling prevents things like embeds, +strings, etc to be dealt with correctly.
In some cases this change reduces the code as the authors extracted the embed structure from the stash and passed it explicitly.

I left out two Patrons.pm cases because I need to study it a bit more.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 635e65a3303a01b90bbc93695b24c98720683f10)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
34 files changed:
Koha/REST/V1/Acquisitions/Vendors.pm
Koha/REST/V1/AdvancedEditorMacro.pm
Koha/REST/V1/Auth/Identity/Provider/Domains.pm
Koha/REST/V1/Auth/Identity/Providers.pm
Koha/REST/V1/Authorities.pm
Koha/REST/V1/BackgroundJobs.pm
Koha/REST/V1/Biblios.pm
Koha/REST/V1/Biblios/ItemGroups.pm
Koha/REST/V1/Biblios/ItemGroups/Items.pm
Koha/REST/V1/CashRegisters/Cashups.pm
Koha/REST/V1/Checkouts.pm
Koha/REST/V1/Cities.pm
Koha/REST/V1/Clubs/Holds.pm
Koha/REST/V1/Config/SMTP/Servers.pm
Koha/REST/V1/ERM/Agreements.pm
Koha/REST/V1/ERM/EHoldings/Packages/Local.pm
Koha/REST/V1/ERM/EHoldings/Titles/Local.pm
Koha/REST/V1/ERM/EUsage/DefaultUsageReports.pm
Koha/REST/V1/ERM/EUsage/UsageDataProviders.pm
Koha/REST/V1/ERM/Licenses.pm
Koha/REST/V1/Holds.pm
Koha/REST/V1/Illrequests.pm
Koha/REST/V1/ImportBatchProfiles.pm
Koha/REST/V1/Libraries.pm
Koha/REST/V1/Patrons/Account.pm
Koha/REST/V1/Patrons/Attributes.pm
Koha/REST/V1/Preservation/Processings.pm
Koha/REST/V1/Preservation/Trains.pm
Koha/REST/V1/Quotes.pm
Koha/REST/V1/ReturnClaims.pm
Koha/REST/V1/SearchFilter.pm
Koha/REST/V1/Suggestions.pm
Koha/REST/V1/Tickets.pm
Koha/REST/V1/TransferLimits.pm