Bugzilla – Attachment 60753 Details for
Bug 17992
REST api: Cities controller should not use ->unblessed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17992: REST api: Remove the use of ->unblessed from Cities controller
Bug-17992-REST-api-Remove-the-use-of--unblessed-fr.patch (text/plain), 2.12 KB, created by
Marcel de Rooy
on 2017-03-01 12:11:26 UTC
(
hide
)
Description:
Bug 17992: REST api: Remove the use of ->unblessed from Cities controller
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-03-01 12:11:26 UTC
Size:
2.12 KB
patch
obsolete
>From f14581e235d822cf0496bd3592dd97ab3cda76d8 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 25 Jan 2017 09:35:42 -0300 >Subject: [PATCH] Bug 17992: REST api: Remove the use of ->unblessed from > Cities controller >Content-Type: text/plain; charset=utf-8 > >As bug 17932 adds TO_JSON to Koha::Object(s), there's no need for using >it. Also, as this is a reference implementation for developers to copy >and paste it is sensible to make this change even when this is not >causing any bug. > >To test: >- Apply the patch >- Run: > $ sudo koha-shell kohadev > k$ cd kohaclone > k$ prove t/db_dependent/api/v1/cities.t >=> SUCCESS: Tests still pass! >- Sign off :-D > >Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/REST/V1/Cities.pm | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > >diff --git a/Koha/REST/V1/Cities.pm b/Koha/REST/V1/Cities.pm >index e8ababe..5d32ea9 100644 >--- a/Koha/REST/V1/Cities.pm >+++ b/Koha/REST/V1/Cities.pm >@@ -19,7 +19,6 @@ use Modern::Perl; > > use Mojo::Base 'Mojolicious::Controller'; > >-use C4::Auth qw( haspermission ); > use Koha::City; > use Koha::Cities; > >@@ -37,7 +36,7 @@ sub list { > } > > return try { >- $cities = Koha::Cities->search($filter)->unblessed; >+ $cities = Koha::Cities->search($filter); > return $c->$cb( $cities, 200 ); > } > catch { >@@ -59,7 +58,7 @@ sub get { > return $c->$cb( { error => "City not found" }, 404 ); > } > >- return $c->$cb( $city->unblessed, 200 ); >+ return $c->$cb( $city, 200 ); > } > > sub add { >@@ -69,7 +68,7 @@ sub add { > > return try { > $city->store; >- return $c->$cb( $city->unblessed, 200 ); >+ return $c->$cb( $city, 200 ); > } > catch { > if ( $_->isa('DBIx::Class::Exception') ) { >@@ -91,7 +90,7 @@ sub update { > $city = Koha::Cities->find( $args->{cityid} ); > $city->set( $args->{body} ); > $city->store(); >- return $c->$cb( $city->unblessed, 200 ); >+ return $c->$cb( $city, 200 ); > } > catch { > if ( not defined $city ) { >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17992
:
59548
|
60750
| 60753