Adrian Witas > Persistence-Entity > Persistence::ORM

Download:
Persistence-Entity-0.07.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

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 to_one one_to_many many_to_many LAZY EAGER NONE ALL ON_INSERT ON_UPDATE ON_DELETE by 'all' tag

ATTRIBUTES

class

class name

entity_name

entity name.

columns

A map between database column and object attribute

lobs

Assocation to LOB objects definition.

relationships

Assocation to objects relationship definition.

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
    });
entity_manager
mop_attribute_adapter

Name of the class that is an adapter to meta object protocols. That class have to implements Persistence::Attribute interface.

object_creation_method

Returns object creation method. Allowed values: bless or new

_attributes_to_columns

Cache for the attributes_to_columns method result

_columns_to_attributes

Cache for the columns_to_attributes method result

_columns_to_storage_attributes

Cache for the columns_to_storage_attributes method result

METHODS

entity

Creates a meta entity class.

mapping_meta

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

column

Adds mapping between column name and related attribute. Takes column name and attribute object as parameter.

    column ('column1' => has '$.attr1');
lob

Adds mapping between lob column name and related attribute.

    lob 'lob_column' => (
        attribute    => has('$.photo'),
        fetch_method => LAZY,
    );
covert_to_attributes

Converts passed in data structure to attributes

covert_to_lob_attributes

Converts passed in data structure to lob attributes

_create_meta_attribute

Creates a meta attribute

add_lob_column

Adds lob column. Takes lob column name, attribute name;

eager_fetch_lobs
lazy_fetch_lobs
attribute
deserialise

Deserialises resultset to object.

deserialise_eager_relation_attributes
deserialise_eager_lob_attributes
deserialise_lazy_relation_attributes
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
attributes_to_columns
columns_to_attributes
columns_to_storage_attributes
attribute_to_column

Returns column name. Takes attribute name.

storage_attribute_values

Transforms column values to the hash that can be blessed as an object. Takes hash ref of column_values

attribute_values

Transforms column values to the object attribute value hash. Takes hash ref of column_values

column_values

Transforms objects attributes to column values Takes object, optionally required columns. (by default all colunms)

attribute_values_to_column_values

Returns column values. Takes attribute values hash.

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

syntax highlighting: