I've been caught by this before myself.

I have a vague recollection of such a patch getting in at some point, then being reverted.. perhaps for performance reasons?

Either way.. there is Bug 20621 Add ability for Koha::Object objects to update themselves with database generated value automatically


Martin Renvoize

Development Team Manager

Community Release Manager (19.11, 20.05)


Phone: +44 (0) 1483 378728

Mobile: +44 (0) 7725 985 636

Email: martin.renvoize@ptfs-europe.com

Fax: +44 (0) 800 756 6384


www.ptfs-europe.com

 

 

 

Registered in the United Kingdom No. 06416372   VAT Reg No. 925 7211 30


The information contained in this email message may be privileged, confidential and protected from disclosure. If you are not the intended recipient, any dissemination, distribution or copying is strictly prohibited. If you think that you have received this email message in error, please email the sender at info@ptfs-europe.com





On Tue, 15 Sep 2020 at 20:59, Tomas Cohen Arazi <tomascohen@gmail.com> wrote:
Hi, I've been fixing a bug in Koha::Item->store, and I remembered I wasn't sure why we keep the current behaviour instead of making ->store return the ->get_from_storage result like:

    return $self->SUPER::store->get_from_storage;

I know this is 'how DBIC works' but I don't think there's much gain by avoiding it, and anyone calling ->store and doing something else afterwards, needs to remember ->discard_changes (or better ->get_from_storage) needs to be called in order to have the auto generated/updated fields the DB handles (autoincrement fields, timestamps, etc).

So, is there a reason to keep this as-is?

--
Tomás Cohen Arazi
Theke Solutions (http://theke.io)
✆ +54 9351 3513384
GPG: B2F3C15F
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/