Bugzilla – Attachment 61156 Details for
Bug 18093
Add the Koha::Objects->get_column method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18093: Koha::Objects->get_column should not return a DBIC object
Bug-18093-KohaObjects-getcolumn-should-not-return-.patch (text/plain), 2.01 KB, created by
Marcel de Rooy
on 2017-03-16 07:39:18 UTC
(
hide
)
Description:
Bug 18093: Koha::Objects->get_column should not return a DBIC object
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-03-16 07:39:18 UTC
Size:
2.01 KB
patch
obsolete
>From 3762d5526819d8d5e4c6657d6917cae77486addd Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 15 Mar 2017 18:58:55 -0300 >Subject: [PATCH] Bug 18093: Koha::Objects->get_column should not return a DBIC > object >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Objects.pm | 13 ++++++++++++- > t/db_dependent/Koha/Objects.t | 2 +- > 2 files changed, 13 insertions(+), 2 deletions(-) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 9afb02d..4a90621 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -252,6 +252,17 @@ sub unblessed { > return [ map { $_->unblessed } $self->as_list ]; > } > >+=head3 Koha::Objects->get_column >+ >+Return all the values of this set for a given column >+ >+=cut >+ >+sub get_column { >+ my ($self, $column_name) = @_; >+ return $self->_resultset->get_column( $column_name )->all; >+} >+ > =head3 Koha::Objects->TO_JSON > > Returns an unblessed representation of objects, suitable for JSON output. >@@ -335,7 +346,7 @@ Currently count, pager, update and delete are covered. > sub AUTOLOAD { > my ( $self, @params ) = @_; > >- my @known_methods = qw( count pager update delete result_class single get_column ); >+ my @known_methods = qw( count pager update delete result_class single ); > my $method = our $AUTOLOAD; > $method =~ s/.*:://; > >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index 70c258b..db840dd 100644 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -131,7 +131,7 @@ subtest 'get_column' => sub { > plan tests => 1; > my @cities = Koha::Cities->search; > my @city_names = map { $_->city_name } @cities; >- is_deeply( [ Koha::Cities->search->get_column('city_name')->all ], \@city_names, 'Koha::Objects->get_column should be allowed' ); >+ is_deeply( [ Koha::Cities->search->get_column('city_name') ], \@city_names, 'Koha::Objects->get_column should be allowed' ); > }; > > subtest 'Exceptions' => sub { >-- >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 18093
:
60104
|
60115
|
61154
|
61155
| 61156