Bugzilla – Attachment 102296 Details for
Bug 25043
Use of union in Koha::Objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25043: Play with union
Bug-25043-Play-with-union.patch (text/plain), 1.72 KB, created by
Jonathan Druart
on 2020-04-02 13:46:26 UTC
(
hide
)
Description:
Bug 25043: Play with union
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-02 13:46:26 UTC
Size:
1.72 KB
patch
obsolete
>From 7f4c044a9dad468b91e3fc51385737d5948deaee Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 2 Apr 2020 15:46:12 +0200 >Subject: [PATCH] Bug 25043: Play with union > >--- > Koha/Schema.pm | 5 ++++- > Koha/Schema/ResultSet.pm | 5 +++++ > test.pl | 10 ++++++++++ > 3 files changed, 19 insertions(+), 1 deletion(-) > create mode 100644 Koha/Schema/ResultSet.pm > create mode 100644 test.pl > >diff --git a/Koha/Schema.pm b/Koha/Schema.pm >index cffc631d5e..f401cbb58e 100644 >--- a/Koha/Schema.pm >+++ b/Koha/Schema.pm >@@ -9,7 +9,10 @@ use warnings; > > use base 'DBIx::Class::Schema'; > >-__PACKAGE__->load_namespaces; >+ >+__PACKAGE__->load_namespaces( >+ default_resultset_class => 'ResultSet', >+); > > > # Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 >diff --git a/Koha/Schema/ResultSet.pm b/Koha/Schema/ResultSet.pm >new file mode 100644 >index 0000000000..830a677b7d >--- /dev/null >+++ b/Koha/Schema/ResultSet.pm >@@ -0,0 +1,5 @@ >+package Koha::Schema::ResultSet; >+use strict; >+use warnings; >+use parent 'DBIx::Class::ResultSet'; >+__PACKAGE__->load_components('Helper::ResultSet::SetOperations'); >diff --git a/test.pl b/test.pl >new file mode 100644 >index 0000000000..af249eb465 >--- /dev/null >+++ b/test.pl >@@ -0,0 +1,10 @@ >+use Modern::Perl; >+use Koha::Database; >+my $borrowernumber = 5; >+my $holds = Koha::Database->new()->schema()->resultset('Reserve')->search({ borrowernumber => $borrowernumber }); >+my $old_holds = Koha::Database->new()->schema()->resultset('OldReserve')->search({ borrowernumber => $borrowernumber }); >+ >+$_->result_class('DBIx::Class::ResultClass::HashRefInflator') >+ for ($holds, $old_holds); >+ >+say $holds->union($old_holds)->count; >-- >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 25043
: 102296