Bugzilla – Attachment 97425 Details for
Bug 24432
order_by broken for date columns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24432: add Koha::Objects->from_api_mapping
Bug-24432-add-KohaObjects-fromapimapping.patch (text/plain), 1.98 KB, created by
Agustín Moyano
on 2020-01-15 23:18:38 UTC
(
hide
)
Description:
Bug 24432: add Koha::Objects->from_api_mapping
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2020-01-15 23:18:38 UTC
Size:
1.98 KB
patch
obsolete
>From 84ab48ac0eb77887fbb6db72d52028a7cb6d812c Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Wed, 15 Jan 2020 20:10:01 -0300 >Subject: [PATCH] Bug 24432: add Koha::Objects->from_api_mapping > >This patch adds from_api_mapping to Koha::Objects, in order to be able to get the mapping from a result set. > >To test: >1. apply this patch >2. prove t/db_dependent/Koha/Objects.t >3. sign off >--- > Koha/Objects.pm | 15 +++++++++++++++ > t/db_dependent/Koha/Objects.t | 19 ++++++++++++++++++- > 2 files changed, 33 insertions(+), 1 deletion(-) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 121e6f5a1c..4b08c79796 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -335,6 +335,21 @@ sub attributes_from_api { > return $self->{_singular_object}->attributes_from_api( $attributes ); > } > >+=head3 from_api_mapping >+ >+ my $mapped_attributes_hash = $objects->from_api_mapping; >+ >+Attributes map from the API to DBIC >+ >+=cut >+ >+sub from_api_mapping { >+ my ( $self ) = @_; >+ >+ $self->{_singular_object} ||= $self->object_class->new(); >+ return $self->{_singular_object}->from_api_mapping; >+} >+ > =head3 Koha::Objects->_wrap > > wraps the DBIC object in a corresponding Koha object >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index f9f172ea7f..d40d26be77 100644 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 19; >+use Test::More tests => 20; > use Test::Exception; > use Test::Warn; > >@@ -760,3 +760,20 @@ subtest "attributes_from_api() tests" => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest "from_api_mapping() tests" => sub { >+ >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $cities_rs = Koha::Cities->new; >+ my $city = Koha::City->new; >+ >+ is_deeply( >+ $cities_rs->from_api_mapping, >+ $city->from_api_mapping >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >\ No newline at end of file >-- >2.17.1
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 24432
:
97421
|
97424
|
97425
|
97426
|
97528
|
97529
|
97530
|
97660
|
97661
|
97662