Bugzilla – Attachment 88492 Details for
Bug 22700
Make biblio_metadata prefetchable from Koha::Biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22700: Make biblio_metadata prefetchable from Koha::Biblio
Bug-22700-Make-bibliometadata-prefetchable-from-Ko.patch (text/plain), 1.85 KB, created by
Martin Renvoize
on 2019-04-23 14:34:56 UTC
(
hide
)
Description:
Bug 22700: Make biblio_metadata prefetchable from Koha::Biblio
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2019-04-23 14:34:56 UTC
Size:
1.85 KB
patch
obsolete
>From 46ca895cb6ff523e4252da69364890d37eb2ffae Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 12 Apr 2019 13:46:04 -0300 >Subject: [PATCH] Bug 22700: Make biblio_metadata prefetchable from > Koha::Biblio > >This patch makes $biblio->metadata be prefetchable as the Coding >guidelines require. > >A new has_one relationship is added in the Biblio schema, named as the >accessor to also convey to proposed guidelines for readability. > >To test: >- Apply this patch >- Run: > $ kshell > k$ prove t/db_dependent/Koha/Biblio.t >=> SUCCESS: No regressions! >- Sign off :-D > >Signed-off-by: Michal Denar <black23@gmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Biblio.pm | 5 ++--- > Koha/Schema/Result/Biblio.pm | 7 +++++++ > 2 files changed, 9 insertions(+), 3 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 56f91859d5..48a585aea4 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -74,9 +74,8 @@ Returns a Koha::Biblio::Metadata object > sub metadata { > my ( $self ) = @_; > >- $self->{_metadata} ||= Koha::Biblio::Metadatas->find( { biblionumber => $self->id } ); >- >- return $self->{_metadata}; >+ my $metadata = $self->_result->metadata; >+ return Koha::Biblio::Metadata->_new_from_dbic($metadata); > } > > =head3 subtitles >diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm >index 53e806b81f..c2623268e2 100644 >--- a/Koha/Schema/Result/Biblio.pm >+++ b/Koha/Schema/Result/Biblio.pm >@@ -366,4 +366,11 @@ __PACKAGE__->has_many( > # Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-11 12:56:41 > # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ebn7Szfm8/HbrdAc7ekTnA > >+__PACKAGE__->has_one( >+ "metadata", >+ "Koha::Schema::Result::BiblioMetadata", >+ { "foreign.biblionumber" => "self.biblionumber" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > 1; >-- >2.20.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 22700
:
87928
|
87931
|
87943
|
88355
| 88492