NAME

Persistence::ORM - Object-relational mapping.

SYNOPSIS

package Employee;

use Abstract::Meta::Class ':all';
use Persistence::ORM ':all';

entity 'emp';
column empno => has('$.no') ;
column ename => has('$.name');

DESCRIPTION

Object-relational mapping module.

EXPORT

entity, column, trigger by 'all' tag

ATTRIBUTES

class

class name

entity_name

entity name.

columns

Columns map between database column and object attribute

trigger

Defines tigger that will execute on one of the following event before_insert after_insert before_update after_update before_delete after_delete, on_fetch Takes event name as first parameter, and callback as secound parameter.

$entity_manager->trigger(before_insert => sub {
    my ($self) = @_;
    #do stuff
});

METHODS

entity

Creates a meta entity class.

column

Adds mapping between column name and related attribute. column (column => has '$.attr1');

initialise
mapping_meta

Returns meta enity class. Takes optionally package name as parameter.

_check_attribute

Checks if attributes mapped from column are unlbessed hash structure, if they are then dynamicly adds them Abstract::Meta::Attribute to Abstract::Meta::Class

add_column

Adds columns. Takes column name, attribute name;

attribute
deserialise

Deserialises resultset to object.

deserialise_eager_relation_attributes
deserialise_lazy_relation_attributes
map_hash_to_attributes_storage

Transform source hash to the object hash. Return hash where source key is mapped attribute storage key. Takes hash ref of field values.

map_object_attributes_to_column_values

Maps keys on passed in hash to coresponding columns. Takes object as parameter.

column_values

Transform objects attirubtes to column values

serialise

Serialised retrives date to object.

attribute_to_column
map_attributes_to_column_values

Maps keys from passed in hash to coresponding columns.

attribute_to_column_map
update_object
join_columns_values

Returns join columns values for passed in relation

unique_values

Return unique columns values

primary_key_values

Return primary key values

trigger
validate_trigger

Validates triggers types

run_event

SEE ALSO

Abstract::Meta::Class Persistence::Entity::Manager SQL::Entity

COPYRIGHT AND LICENSE

The SQL::Entity::ORM module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

AUTHOR

Adrian Witas, adrian@webapp.strefa.pl