Pics count method. Fix counting when there is only one object.
[blog.pm-common-perl-mods.git] / Common-RDBO-Helper / t / lib / Post.pm
blob14fce42e62d6dd6be3075001147ef6c4cd1dccec
1 package Post;
3 use strict;
5 use base qw(DB::Object);
7 use Rose::Object::MakeMethods::Generic ( scalar => [ qw/ pic pic_count / ] );
9 use Common::RDBO::Helper::Post qw(:all);
11 __PACKAGE__->meta->setup(
12 table => 'post',
14 columns => [
15 qw/ id title content /,
16 addtime => { type => 'epoch' }
19 primary_key_columns => [ qw/ id / ],
21 relationships => [
22 tags => {
23 type => 'many to many',
24 map_class => 'PostTagMap',
25 map_from => 'post',
26 map_to => 'tag'
28 post_tag_map => {
29 type => 'one to many',
30 class => 'PostTagMap',
32 comments => {
33 type => 'one to many',
34 class => 'Comment',
35 column_map => { id => 'master_id' },
36 query_args => [ type => 'post' ]
38 pics => {
39 type => 'one to many',
40 class => 'Pic',
41 column_map => { id => 'master_id' },
42 query_args => [ type => 'post' ]
47 =head1 AUTHOR
49 vti
51 =head1 LICENSE
53 This library is free software, you can redistribute it and/or modify
54 it under the same terms as Perl itself.
56 =cut