Bug 13019 - Add base classes on which to build Koha objects
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 30 Sep 2014 19:05:30 +0000 (15:05 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 12 Feb 2015 18:21:01 +0000 (15:21 -0300)
commit6f0316a8d298b023fb74351d9ffff51fdeb31119
treecd358761c0ee22f678b951bc4bf8b16e9b376816
parent295fb70f62069c0b1fbed2d9bbdf2650f58e488c
Bug 13019 - Add base classes on which to build Koha objects

The idea behind this is to have a pair of base classes on which to build
our new generation of Koha objects. Koha::Object is a base class, which
in it's most basic form, is to represent a row in a table. For example,
Koha::Borrower inherits from Koha::Object. So too could Koha::Biblio
and Koha::Item for example.

Koha::Objects is to represent a way to fetch and manipulate sets of
objects. For example, Koha::Borrowers has a method to get a
Koha::Borrower object by id and a method to search for an get a list
of Koha::Borrower objects. Right now Koha::Objects has only the
essentials but can easily be extended and those enhancements will be
passed down to all the child classes based on it.

By using these classes as a base, we will add consistency to our
code, allow us to keep our code DRY, reduce bugs, and encapsulate our
database access among other benefits.

Test Plan:
1) Apply this patch
2) prove t/Object.t t/db_dependent/Object.t t/db_dependent/Objects.t

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Koha/Borrower.pm [new file with mode: 0644]
Koha/Borrowers.pm [new file with mode: 0644]
Koha/Object.pm [new file with mode: 0644]
Koha/Objects.pm [new file with mode: 0644]
t/Borrower.t [new file with mode: 0755]
t/db_dependent/Borrower.t [new file with mode: 0755]
t/db_dependent/Borrowers.t [new file with mode: 0755]