[Koha-bugs] [Bug 31894] Extend Hold hooks with more actions

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Oct 25 16:40:16 CEST 2022


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

--- Comment #8 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
(In reply to Stefan Berndtsson from comment #4)
> I can't say why all the others did it this way. My hooks were just copies of
> the model used everywhere else.
Ha. Do not assume that copy/paste creates correct code :)

> I can reason about a situation where it will likely matter. If the plugin
> forks/threads before doing its work, there is a chance that the originally
> stored object has been changed after the hook is called, but before the
> plugin has actually done its work. By fetching a new object, this is not the
> case.

This cannot be correct. The interval between the store and get_from_storage is
before the first plugin is called. The result of get_from_storage is passed.

> I also do remember having seen a situation where the state of $self after
> store was not the same as the newly fetched object, but I can't recall how
> or where this was the case.
Thats correct. When you pass $self to the plugin, the plugin can change it
since it is a reference. That is in line with the intention:
    @responses = Koha::Plugins->call($method, @args)
Note: Pass your arguments as refs, when you want subsequent plugins to use the
value updated by preceding plugins, provided that these plugins support that.

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


More information about the Koha-bugs mailing list