Revision 4aded4e8
Von Sven Schöling vor etwa 14 Jahren hinzugefügt
SL/DB/Object.pm | ||
---|---|---|
80 | 80 |
return $self; |
81 | 81 |
} |
82 | 82 |
|
83 |
sub make_attr_helper { |
|
84 |
my ($self) = @_; |
|
85 |
my $package = ref $self || $self; |
|
86 |
|
|
87 |
for my $col ($package->meta->columns) { |
|
88 |
next if $col->primary_key_position; # don't make attr helper for primary keys |
|
89 |
|
|
90 |
attr_number ($package, $col->name, -2) if $col->type =~ /numeric | real | float/xi; |
|
91 |
attr_percent($package, $col->name, -2) if $col->type =~ /numeric | real | float/xi; |
|
92 |
attr_number ($package, $col->name, 0) if $col->type =~ /int/xi; |
|
93 |
attr_date ($package, $col->name) if $col->type =~ /date | timestamp/xi; |
|
94 |
} |
|
95 |
|
|
96 |
return $self; |
|
97 |
} |
|
98 |
|
|
83 | 99 |
sub attr_number { |
84 | 100 |
SL::DB::Helpers::AttrNumber::define(@_); |
85 | 101 |
} |
Auch abrufbar als: Unified diff
stub für einen generische attrhelper.