NAME

ObjectDB::Relationship::OneToMany - one to many relationship for ObjectDB

SYNOPSIS

package Article;

use strict;
use warnings;

use base 'ObjectDB';

__PACKAGE__->schema(
    table          => 'article',
    columns        => [qw/ id category_id author_id title /],
    primary_keys   => ['id'],
    auto_increment => 'id',

    relationships => {
        comments => {
            type  => 'one to many',
            class => 'Comment',
            map   => {id => 'comment_id'}
        }
    }
);

1;

DESCRIPTION

One to many relationship for ObjectDB.

ATTRIBUTES

map

Hash reference holding columns mappings.

METHODS

new

Returns new ObjectDB::Relationship::OneToMany instance.

to_source

Returns generated join arguments that are passed to the sql generator. Used internally.

AUTHOR

Viacheslav Tykhanovskyi, vti@cpan.org.

COPYRIGHT

Copyright (C) 2009, Viacheslav Tykhanovskyi.

This program is free software, you can redistribute it and/or modify it under the same terms as Perl 5.10.