Revision 4180aaea
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/DB/Object.pm | ||
---|---|---|
60 | 60 |
|
61 | 61 |
my %types = map { $_->name => $_->type } ref($self)->meta->columns; |
62 | 62 |
|
63 |
# Special case for *_as_man_days/*_as_man_days_unit: the _unit |
|
64 |
# variation must always be called after the non-unit method. |
|
65 |
my @man_days_attributes = grep { m/_as_man_days$/ } keys %attributes; |
|
66 |
foreach my $attribute (@man_days_attributes) { |
|
67 |
my $value = delete $attributes{$attribute}; |
|
68 |
$self->$attribute(defined($value) && ($value eq '') ? undef : $value); |
|
69 |
} |
|
70 |
|
|
63 | 71 |
while (my ($attribute, $value) = each %attributes) { |
64 | 72 |
my $type = lc($types{$attribute} || 'text'); |
65 | 73 |
$value = $type eq 'boolean' ? ($value ? 't' : 'f') |
Auch abrufbar als: Unified diff
AttrDuration-Helfer