Removed unneedable RDBO exported function.
[blog.pm.git] / lib / Blog / RDBO / Post.pm
blobfdf37e9d746ff066c0f385f282e25b157e1d4c64
1 package Blog::RDBO::Post;
3 use strict;
5 use base qw(Blog::DB::Object::I18N::Static);
7 use Rose::Object::MakeMethods::Generic( scalar => [ 'comment_count' ] );
9 __PACKAGE__->meta->setup(
10 table => 'post',
12 columns => [
13 qw/ id key orig_lang /,
14 addtime => { type => 'epoch', default => 'now' },
15 modtime => { type => 'epoch', default => 'now'}
18 primary_key_columns => [ qw/ id / ],
20 unique_key => [ qw/ key / ],
22 relationships => [
23 post_i18n => {
24 type => 'one to many',
25 class => 'Blog::RDBO::PostI18N',
26 column_map => { id => 'post_id' }
28 tags => {
29 type => 'many to many',
30 map_class => 'Blog::RDBO::PostTagMap',
31 map_from => 'post',
32 map_to => 'tag'
34 post_tag_map => {
35 type => 'one to many',
36 class => 'Blog::RDBO::PostTagMap',
38 comments => {
39 type => 'one to many',
40 class => 'Blog::RDBO::Comment',
41 column_map => { id => 'post_id' }
46 __PACKAGE__->utf8_columns( qw/ key / );
48 __PACKAGE__->meta->column( 'modtime' )->add_trigger(
49 event => 'on_save',
50 code => sub {
51 my $self = shift;
52 my $value = $self->modtime;
54 $self->modtime( time );
59 =head1 AUTHOR
61 vti
63 =head1 LICENSE
65 This library is free software, you can redistribute it and/or modify
66 it under the same terms as Perl itself.
68 =cut