Bugzilla – Attachment 135431 Details for
Bug 30861
Add the ability to stash extra data in a Koha::Object
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30861: Add Koha::Object::stash
Bug-30861-Add-KohaObjectstash.patch (text/plain), 1.12 KB, created by
Kyle M Hall (khall)
on 2022-05-27 14:27:23 UTC
(
hide
)
Description:
Bug 30861: Add Koha::Object::stash
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-05-27 14:27:23 UTC
Size:
1.12 KB
patch
obsolete
>From 3b5f5a74a4278f5ba7ffc0f2f2bed451b92b5b1e Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 27 May 2022 10:27:03 -0400 >Subject: [PATCH] Bug 30861: Add Koha::Object::stash > >--- > Koha/Object.pm | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index ef554d5e56..b314fbdda2 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -379,6 +379,33 @@ sub add_message { > return $self; > } > >+=head3 $object->stash >+ >+Add the ability to stash things in an object >+ >+$object->stash({ key => $value }); >+$object->stash({ key1 => $value1, key2 => $value2 }); >+ >+my $value = $object->stash($key); >+ >+my $stash = $object->stash; >+ >+=cut >+ >+sub stash { >+ my ( $self, $params ) = @_; >+ >+ if ( !$params ) { >+ return $self->{_stash}; >+ } >+ elsif ( ref $params eq 'HASH' ) { >+ $self->{_stash}->{$_} = $params->{$_} for keys %$params; >+ } >+ else { >+ return $self->{_stash}->{$params}; >+ } >+} >+ > =head3 $object->TO_JSON > > Returns an unblessed representation of the object, suitable for JSON output. >-- >2.32.0 (Apple Git-132)
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 30861
: 135431