Bug 16965: search_related returns an instanciated Koha::Objects-based object
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 25 Jul 2016 10:16:59 +0000 (11:16 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 21 Oct 2016 17:31:14 +0000 (17:31 +0000)
commit3d110a3c72432249613bc38333d4c0260a4356c4
treefa2d1bfd611bacdbe66437650e09259dbcf8761f
parentc84f41624bb8eefa44872e15746cef5393466fb8
Bug 16965: search_related returns an instanciated Koha::Objects-based object

Koha::Objects->search_related should return a Koha::Objects-based
object.
This search_related method should follow the same rules as the search
method, i.e. take into account what the caller want (scalar or list).
The problem here is that we do not know (in Koha::Objects) what is the
kind of objects we want to instanciate. To know it, this patch adds a
get_object_class, it will return the class of the object and the
resultset Koha::Object-based object.

The drawback of this method is that we will have to keep it up-to-date
every time we add a new Koha::Object class.

Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Objects.pm
t/db_dependent/Koha/Objects.t