Revision 842a2e4c
Von Moritz Bunkus vor fast 7 Jahren hinzugefügt
SL/DB/Object.pm | ||
---|---|---|
22 | 22 |
not_found save update import |
23 | 23 |
); |
24 | 24 |
|
25 |
my %db_to_presenter_mapping = ( |
|
26 |
Customer => 'CustomerVendor', |
|
27 |
Vendor => 'CustomerVendor', |
|
28 |
); |
|
29 |
|
|
25 | 30 |
sub new { |
26 | 31 |
my $class = shift; |
27 | 32 |
my $self = $class->SUPER::new(); |
... | ... | |
240 | 245 |
} |
241 | 246 |
|
242 | 247 |
sub presenter { |
243 |
my ($class_or_self) = @_; |
|
244 |
|
|
245 |
if (ref $class_or_self) { |
|
246 |
my $class = ref $class_or_self; |
|
247 |
$class =~ s{^SL::DB::}{SL::Presenter::}; |
|
248 |
return SL::DB::Helper::Presenter->new($class, $class_or_self); |
|
249 |
} else { |
|
250 |
$class_or_self =~ s{^SL::DB::}{SL::Presenter::}; |
|
251 |
return $class_or_self; |
|
252 |
} |
|
248 |
my ($self) = @_; |
|
249 |
|
|
250 |
my $class = ref $self; |
|
251 |
$class =~ s{^SL::DB::}{}; |
|
252 |
$class = "SL::Presenter::" . ($db_to_presenter_mapping{$class} // $class); |
|
253 |
|
|
254 |
return SL::DB::Helper::Presenter->new($class, $self); |
|
253 | 255 |
} |
254 | 256 |
|
255 | 257 |
sub as_debug_info { |
Auch abrufbar als: Unified diff
Presenter: richtige Presenter-Klasse bei DB-Klassen Customer/Vendor laden