Bugzilla – Attachment 33849 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 Follow-up] Rename new_from_dbic and few typos
SIGNED-OFF-Bug-13019-QA-Follow-up-Rename-newfromdb.patch (text/plain), 4.33 KB, created by
Kyle M Hall (khall)
on 2014-11-24 12:58:31 UTC
(
hide
)
Description:
Bug 13019: [QA Follow-up] Rename new_from_dbic and few typos
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-11-24 12:58:31 UTC
Size:
4.33 KB
patch
obsolete
>From 2ba73c2c22bf43d50563c70370ee9dc3e80b52e9 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 24 Nov 2014 12:46:43 +0100 >Subject: [PATCH] [SIGNED-OFF] Bug 13019: [QA Follow-up] Rename new_from_dbic and few typos > >Since new_from_dbic is not meant as a public method, this patch adds >a prefix to the name of this internal routine. For the same reason I >removed it from t/Borrower.t. >Removed one use overload-line in Objects (not used). >Resolved a few typos. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Object.pm | 6 +++--- > Koha/Objects.pm | 26 ++++++++++++-------------- > t/Borrower.t | 3 +-- > 3 files changed, 16 insertions(+), 19 deletions(-) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index 0093ed1..ff712c9 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -69,13 +69,13 @@ sub new { > > } > >-=head3 Koha::Object->new_from_dbic(); >+=head3 Koha::Object->_new_from_dbic(); > >-my $object = Koha::Object->new_from_dbic($dbic_row); >+my $object = Koha::Object->_new_from_dbic($dbic_row); > > =cut > >-sub new_from_dbic { >+sub _new_from_dbic { > my ( $class, $dbic_row ) = @_; > my $self = {}; > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 5d2d6d0..5413fb6 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -17,8 +17,6 @@ package Koha::Objects; > # with Koha; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-use overload "0+" => "count", "<>" => "next", fallback => 1; >- > use Modern::Perl; > > use Carp; >@@ -59,13 +57,13 @@ sub new { > bless( $self, $class ); > } > >-=head3 Koha::Objects->new_from_dbic(); >+=head3 Koha::Objects->_new_from_dbic(); > >-my $object = Koha::Objects->new_from_dbic( $resultset ); >+my $object = Koha::Objects->_new_from_dbic( $resultset ); > > =cut > >-sub new_from_dbic { >+sub _new_from_dbic { > my ( $class, $resultset ) = @_; > my $self = { _resultset => $resultset }; > >@@ -84,7 +82,7 @@ sub find { > > my $result = $self->_resultset()->find($id); > >- my $object = $self->object_class()->new_from_dbic( $result ); >+ my $object = $self->object_class()->_new_from_dbic( $result ); > > return $object; > } >@@ -108,7 +106,7 @@ sub search { > my $class = ref($self) ? ref($self) : $self; > my $rs = $self->_resultset()->search($params); > >- return $class->new_from_dbic($rs); >+ return $class->_new_from_dbic($rs); > } > } > >@@ -126,7 +124,7 @@ sub count { > > =head3 Koha::Objects->next(); > >-my $object = Koha::Object->next(); >+my $object = Koha::Objects->next(); > > Returns the next object that is part of this set. > Returns undef if there are no more objects to return. >@@ -134,12 +132,12 @@ Returns undef if there are no more objects to return. > =cut > > sub next { >- my ( $self, $id ) = @_; >+ my ( $self ) = @_; > > my $result = $self->_resultset()->next(); > return unless $result; > >- my $object = $self->object_class()->new_from_dbic( $result ); >+ my $object = $self->object_class()->_new_from_dbic( $result ); > > return $object; > } >@@ -154,7 +152,7 @@ with the first object in a set. > =cut > > sub reset { >- my ( $self, $id ) = @_; >+ my ( $self ) = @_; > > $self->_resultset()->reset(); > >@@ -170,7 +168,7 @@ Returns an arrayref of the objects in this set. > =cut > > sub as_list { >- my ( $self, $id ) = @_; >+ my ( $self ) = @_; > > my @dbic_rows = $self->_resultset()->all(); > >@@ -181,14 +179,14 @@ sub as_list { > > =head3 Koha::Objects->_wrap > >-wraps the DBIC object in a corrosponding Koha object >+wraps the DBIC object in a corresponding Koha object > > =cut > > sub _wrap { > my ( $self, @dbic_rows ) = @_; > >- my @objects = map { $self->object_class()->new_from_dbic( $_ ) } @dbic_rows; >+ my @objects = map { $self->object_class()->_new_from_dbic( $_ ) } @dbic_rows; > > return @objects; > } >diff --git a/t/Borrower.t b/t/Borrower.t >index a1fb190..3ce7f06 100755 >--- a/t/Borrower.t >+++ b/t/Borrower.t >@@ -27,8 +27,7 @@ BEGIN { > use_ok('Koha::Borrower'); > } > >-my $result = Koha::Database->new()->schema()->resultset('Borrower')->new({ surname => 'Test Borrower' }); >-my $object = Koha::Borrower->new_from_dbic( $result ); >+my $object = Koha::Borrower->new( { surname => 'Test Borrower' } ); > > is( $object->surname(), 'Test Borrower', "Accessor returns correct value" ); > >-- >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