Bug 23187 - Koha::Objects supports find_or_create without passing through the Koha::Object store method
Summary: Koha::Objects supports find_or_create without passing through the Koha::Objec...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P1 - high major (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 21761
Blocks:
  Show dependency treegraph
 
Reported: 2019-06-21 16:00 UTC by Martin Renvoize
Modified: 2020-05-01 13:16 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2019-06-21 16:00:39 UTC
+++ This bug was initially created as a clone of Bug #21761 +++

If we're adding triggers at the code level all over the place by overloading the store method we need to never ever let dbic handle it.. by allowing directly passing data to dbic's find_or_create method in Koha::Objects we are exposing ourselves to places in the codebase skipping the store triggers.
Comment 1 Jonathan Druart 2019-12-11 08:55:54 UTC
Should we remove Koha::Objects->find_or_create?
There are very few occurrences so far.
Comment 2 Martin Renvoize 2019-12-11 09:03:58 UTC
(In reply to Jonathan Druart from comment #1)
> Should we remove Koha::Objects->find_or_create?
> There are very few occurrences so far.

I reckon that's the most pragmatic approach.. it won't be too onerous to split the calls in two.. that's what happens behind the scenes in dbic land anyway.

However.. do we use any of the create_related or multi-create functionality of dbic?  That uses the internal find_or_create behind te scenes inside dbic.