Bugzilla – Attachment 35813 Details for
Bug 13019
Add base classes on which to build Koha objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13019 [QA Followup] - Allow chaining
Bug-13019-QA-Followup---Allow-chaining.patch (text/plain), 1.40 KB, created by
Kyle M Hall (khall)
on 2015-02-10 18:37:28 UTC
(
hide
)
Description:
Bug 13019 [QA Followup] - Allow chaining
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-02-10 18:37:28 UTC
Size:
1.40 KB
patch
obsolete
>From d4c092c9ee39eb9ce5955350cc8d97ff42a3699d Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 10 Feb 2015 13:30:32 -0500 >Subject: [PATCH] Bug 13019 [QA Followup] - Allow chaining > >By returning the object itself instead of a boolean, we can chain >methods together while retaining the exact same functionality. >--- > Koha/Object.pm | 4 ++-- > Koha/Objects.pm | 2 ++ > 2 files changed, 4 insertions(+), 2 deletions(-) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index bc2746f..a77eb5c 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -106,7 +106,7 @@ Returns: > sub store { > my ($self) = @_; > >- return $self->_result()->update_or_insert() ? 1 : 0; >+ return $self->_result()->update_or_insert() ? $self : undef; > } > > =head3 $object->in_storage(); >@@ -190,7 +190,7 @@ sub set { > } > } > >- return $self->_result()->set_columns($properties) ? 1 : undef; >+ return $self->_result()->set_columns($properties) ? $self : undef; > } > > =head3 $object->id(); >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 5413fb6..6b3100a 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -80,6 +80,8 @@ my $object = Koha::Objects->find( { keypart1 => $keypart1, keypart2 => $keypart2 > sub find { > my ( $self, $id ) = @_; > >+ return unless $id; >+ > my $result = $self->_resultset()->find($id); > > my $object = $self->object_class()->_new_from_dbic( $result ); >-- >1.7.2.5
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 13019
:
31964
|
32004
|
32007
|
32008
|
32009
|
32042
|
32043
|
32045
|
32056
|
32059
|
32065
|
32068
|
33418
|
33419
|
33420
|
33797
|
33840
|
33841
|
33842
|
33843
|
33844
|
33845
|
33846
|
33847
|
33848
|
33849
|
33850
|
33852
| 35813 |
35814
|
35815
|
35980