ObjectDB::Relationship::Proxy - proxy relationship for ObjectDB
package Comment; use strict; use warnings; use base 'ObjectDB'; __PACKAGE__->schema( table => 'comment', columns => [qw/master_id type content/], primary_keys => [qw/master_id type/], relationships => { master => { type => 'proxy', proxy_key => 'type', }, article => { type => 'many to one', class => 'Article', map => {master_id => 'id'} }, podcast => { type => 'many to one', class => 'Podcast', map => {master_id => 'id'} } } ); 1;
This is a proxy relationship. This way you can hold relationship name inside the database. In example above calling $comment->related('master') returns master object depending on $comment->column('type').
proxy_key
Column name used for getting relationship name.
Viacheslav Tykhanovskyi, vti@cpan.org.
vti@cpan.org
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.
To install ObjectDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ObjectDB
CPAN shell
perl -MCPAN -e shell install ObjectDB
For more information on module installation, please visit the detailed CPAN module installation guide.