<<

NAME

Koha::Object - Koha Object base class

SYNOPSIS

    use Koha::Object;
    my $object = Koha::Object->new({ property1 => $property1, property2 => $property2, etc... } );

DESCRIPTION

This class must always be subclassed.

API

Class Methods

Koha::Object->new();

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

Note that this cannot be used to retrieve record from the DB.

Koha::Object->_new_from_dbic();

my $object = Koha::Object->_new_from_dbic($dbic_row);

$object->store();

Saves the object in storage. If the object is new, it will be created. If the object previously existed, it will be updated.

Returns: 1 if the store was a success 0 if the store failed

$object->in_storage();

Returns true if the object has been previously stored.

$object->is_changed();

Returns true if the object has properties that are different from the properties of the object in storage.

$object->delete();

Removes the object from storage.

Returns: 1 if the deletion was a success 0 if the deletion failed -1 if the object was never in storage

$object->set( $properties_hashref )

$object->set( { property1 => $property1, property2 => $property2, property3 => $propery3, } );

Enables multiple properties to be set at once

Returns: 1 if all properties were set. 0 if one or more properties do not exist. undef if all properties exist but a different error prevents one or more properties from being set.

If one or more of the properties do not exist, no properties will be set.

$object->id();

Returns the id of the object if it has one.

$object->_result();

Returns the internal DBIC Row object

$object->_columns();

Returns an arrayref of the table columns

AUTOLOAD

The autoload method is used only to get and set values for an objects properties.

type

This method must be defined in the child class. The value is the name of the DBIC resultset. For example, for borrowers, the type method will return "Borrower".

AUTHOR

Kyle M Hall <kyle@bywatersolutions.com>

<<