]> 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)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Fri, 12 Apr 2024 10:12:31 +0000 (12:12 +0200)
commit635e65a3303a01b90bbc93695b24c98720683f10
treead19ad009e3abc357d7957036d77d194a350bfa7
parent9aa811c33481dddded624829dfd24643f31fc04d
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>
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