<<

NAME

Koha::Objects - Koha Object set base class

SYNOPSIS

    use Koha::Objects;
    my @objects = Koha::Objects->search({ borrowernumber => $borrowernumber});

DESCRIPTION

This class must be subclassed.

API

Class Methods

Koha::Objects->new();

my $object = Koha::Objects->new();

Koha::Objects->_new_from_dbic();

my $object = Koha::Objects->_new_from_dbic( $resultset );

Koha::Objects->find();

my $object = Koha::Objects->find($id); my $object = Koha::Objects->find( { keypart1 => $keypart1, keypart2 => $keypart2 } );

Koha::Objects->find_or_create();

my $object = Koha::Objects->find_or_create( $attrs );

Koha::Objects->search();

my @objects = Koha::Objects->search($params);

search_related

    my @objects = Koha::Objects->search_related( $rel_name, $cond?, \%attrs? );
    my $objects = Koha::Objects->search_related( $rel_name, $cond?, \%attrs? );

Searches the specified relationship, optionally specifying a condition and attributes for matching records.

Koha::Objects->next();

my $object = Koha::Objects->next();

Returns the next object that is part of this set. Returns undef if there are no more objects to return.

Koha::Objects->reset();

Koha::Objects->reset();

resets iteration so the next call to next() will start agein with the first object in a set.

Koha::Objects->as_list();

Koha::Objects->as_list();

Returns an arrayref of the objects in this set.

Koha::Objects->unblessed

Returns an unblessed representation of objects.

Koha::Objects->_wrap

wraps the DBIC object in a corresponding Koha object

Koha::Objects->_resultset

Returns the internal resultset or creates it if undefined

columns

my @columns = Koha::Objects->columns

Return the table columns

AUTOLOAD

The autoload method is used call DBIx::Class method on a resultset.

Important: If you plan to use one of the DBIx::Class methods you must provide relevant tests in t/db_dependent/Koha/Objects.t Currently count, pager, update and delete are covered.

_type

The _type method must be set for all child classes. The value returned by it should be the DBIC resultset name. For example, for holds, _type should return 'Reserve'.

object_class

This method must be set for all child classes. The value returned by it should be the name of the Koha object class that is returned by this class. For example, for holds, object_class should return 'Koha::Hold'.

AUTHOR

Kyle M Hall <kyle@bywatersolutions.com>

<<