Dear Devs,
Inflate_column doesn't honour the accessor => key, for example:
use strict;
use warnings;
use base 'DBIx::Class';
use DateTime::Format::Pg;
__PACKAGE__->load_components(qw/ InflateColumn::DateTime Core /);
__PACKAGE__->table('ftm_v_time');
__PACKAGE__->add_columns(
qw/ timeid userid add_hours deduct_hours total_hours comments
except_count activeind moduserid
moddatetime /
);
__PACKAGE__->add_columns(
'time_in[1]' => { data_type => 'datetime', accessor => 'time_in_one' },
'time_in[2]' => { data_type => 'datetime', accessor => 'time_in_two' },
'time_out[1]' => { data_type => 'datetime', accessor =>
'time_out_one' },
'time_out[2]' => { data_type => 'datetime', accessor =>
'time_out_two' },
day => { data_type => 'datetime' },
);
for my $hours_col (qw/add_hours deduct_hours total_hours/) {
__PACKAGE__->inflate_column(
$hours_col,
{
inflate => sub {
DateTime::Format::Pg->parse_interval(shift);
},
deflate => sub {
DateTime::Format::Pg->format_interval(shift);
},
}
);
}
1;
The accessors; time_in_one, time_in_two etc. contain the original column
value.
I will look into this myself as soon as I can, but for now in TT I do:
[% time_in_one = 'time_in[1]' %] and value="[%
timesheet_input.${time_in_one} %]"
Thanks for your time,
Gavin.