Bugzilla – Attachment 61754 Details for
Bug 18361
Koha::Objects->find should accept composite primary keys
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18361: Koha::Objects->find should accept composite primary keys
Bug-18361-KohaObjects-find-should-accept-composite.patch (text/plain), 1.70 KB, created by
Marcel de Rooy
on 2017-03-31 11:59:29 UTC
(
hide
)
Description:
Bug 18361: Koha::Objects->find should accept composite primary keys
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-03-31 11:59:29 UTC
Size:
1.70 KB
patch
obsolete
>From 117aa299684cb0712cad71985102c34f73b51c99 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 31 Mar 2017 13:52:15 +0200 >Subject: [PATCH] Bug 18361: Koha::Objects->find should accept composite > primary keys >Content-Type: text/plain; charset=utf-8 > >Changes the $id parameter to an array. (IssuingRule has three keys.) >The build_object method in TestBuilder.pm has been adjusted to pass >multiple primary key values to find. > >Test plan: >Run t/db_dependent/Koha/Object.t >Run t/db_dependent/Koha/Objects.t >Run t/db_dependent/TestBuilder.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Objects.pm | 7 ++++--- > t/lib/TestBuilder.pm | 2 +- > 2 files changed, 5 insertions(+), 4 deletions(-) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 86a5789..7e69537 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -72,15 +72,16 @@ sub _new_from_dbic { > > my $object = Koha::Objects->find($id); > my $object = Koha::Objects->find( { keypart1 => $keypart1, keypart2 => $keypart2 } ); >+my $object = Koha::Objects->find($id1, $id2); # composite PK > > =cut > > sub find { >- my ( $self, $id ) = @_; >+ my ( $self, @id ) = @_; > >- return unless defined($id); >+ return unless @id; > >- my $result = $self->_resultset()->find($id); >+ my $result = $self->_resultset()->find(@id); > > return unless $result; > >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index 6509aee..ce8f601 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -74,7 +74,7 @@ sub build_object { > my @ids; > > foreach my $pk ( @pks ) { >- push @ids, { $pk => $hashref->{ $pk } }; >+ push @ids, $hashref->{ $pk }; > } > > my $object = $class->find( @ids ); >-- >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 18361
:
61754
|
62142
|
62143
|
62395
|
62396
|
62397
|
62909
|
62910
|
62911
|
64339
|
64340
|
64341
|
64347
|
64348
|
64349
|
64372
|
66006