[Koha-bugs] [Bug 20621] Add ability for Koha::Object objects to update themselves with database generated value automatically

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Oct 9 13:40:51 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20621

--- Comment #4 from Kyle M Hall <kyle at bywatersolutions.com> ---
(In reply to Fridolin SOMERS from comment #3)
> Ahhh ok that is why in unit tests we see for example in
> t/db_dependent/Members.t :
>   $borrowernumber = Koha::Patron->new( \%data )->store->borrowernumber;
>   my $patron = Koha::Patrons->find( $borrowernumber );
> 
> discard_changes() has a disturbing name i feel.
> 
> Should it use get_from_storage ?
>   my $patron = Koha::Patron->new( \%data )->store->get_from_storage;
> 
> In my opinion store() should update the object, that is a common behavior in
> any ORM i think.

My understanding is that get_from_storage has more overhead than
discard_changes, though they have the same end result. get_from_storage creates
and entirely new object, where discard_changes simply updates the existing
object.

https://metacpan.org/pod/DBIx::Class::Row#get_from_storage

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list