Revision 91b948e4
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/DB/Bin.pm | ||
---|---|---|
1 |
# This file has been auto-generated only because it didn't exist. |
|
2 |
# Feel free to modify it at will; it will not be overwritten automatically. |
|
3 |
|
|
4 | 1 |
package SL::DB::Bin; |
5 | 2 |
|
6 | 3 |
use strict; |
7 | 4 |
|
8 | 5 |
use SL::DB::MetaSetup::Bin; |
9 | 6 |
|
10 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
|
11 | 7 |
__PACKAGE__->meta->make_manager_class; |
12 | 8 |
|
13 | 9 |
1; |
SL/DB/Currency.pm | ||
---|---|---|
1 |
# This file has been auto-generated only because it didn't exist. |
|
2 |
# Feel free to modify it at will; it will not be overwritten automatically. |
|
3 |
|
|
4 | 1 |
package SL::DB::Currency; |
5 | 2 |
|
6 | 3 |
use strict; |
7 | 4 |
|
8 | 5 |
use SL::DB::MetaSetup::Currency; |
9 |
|
|
10 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
|
11 |
__PACKAGE__->meta->make_manager_class; |
|
6 |
use SL::DB::Manager::Currency; |
|
12 | 7 |
|
13 | 8 |
1; |
SL/DB/Manager/Currency.pm | ||
---|---|---|
1 |
package SL::DB::Manager::Currency; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use SL::DB::Helper::Manager; |
|
6 |
use base qw(SL::DB::Helper::Manager); |
|
7 |
|
|
8 |
use SL::DB::Helper::Sorted; |
|
9 |
|
|
10 |
sub object_class { 'SL::DB::Currency' } |
|
11 |
|
|
12 |
__PACKAGE__->make_manager_methods; |
|
13 |
|
|
14 |
sub _sort_spec { |
|
15 |
return ( default => [ 'id', 1 ], |
|
16 |
columns => { SIMPLE => 'ALL', |
|
17 |
map { ( $_ => "lower(currencies.$_)" ) } qw(name) |
|
18 |
}); |
|
19 |
} |
|
20 |
|
|
21 |
1; |
SL/DB/Manager/Warehouse.pm | ||
---|---|---|
1 |
package SL::DB::Manager::Warehouse; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use SL::DB::Helper::Manager; |
|
6 |
use base qw(SL::DB::Helper::Manager); |
|
7 |
|
|
8 |
use SL::DB::Helper::Sorted; |
|
9 |
|
|
10 |
sub object_class { 'SL::DB::Warehouse' } |
|
11 |
|
|
12 |
__PACKAGE__->make_manager_methods; |
|
13 |
|
|
14 |
sub _sort_spec { |
|
15 |
return ( default => [ 'sortkey', 1 ], |
|
16 |
columns => { SIMPLE => 'ALL', |
|
17 |
map { ( $_ => "lower(warehouse.$_)" ) } qw(description) |
|
18 |
}); |
|
19 |
} |
|
20 |
|
|
21 |
1; |
SL/DB/Warehouse.pm | ||
---|---|---|
1 |
# This file has been auto-generated only because it didn't exist. |
|
2 |
# Feel free to modify it at will; it will not be overwritten automatically. |
|
3 |
|
|
4 | 1 |
package SL::DB::Warehouse; |
5 | 2 |
|
6 | 3 |
use strict; |
7 | 4 |
|
8 | 5 |
use SL::DB::MetaSetup::Warehouse; |
6 |
use SL::DB::Manager::Warehouse; |
|
9 | 7 |
use SL::DB::Helper::ActsAsList; |
10 | 8 |
|
11 |
__PACKAGE__->meta->make_manager_class; |
|
12 |
|
|
13 | 9 |
__PACKAGE__->meta->add_relationship( |
14 | 10 |
bins => { |
15 | 11 |
type => 'one to many', |
... | ... | |
18 | 14 |
} |
19 | 15 |
); |
20 | 16 |
|
21 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
|
22 |
#__PACKAGE__->meta->make_manager_class; |
|
23 |
|
|
24 | 17 |
__PACKAGE__->meta->initialize; |
25 | 18 |
|
19 |
sub bins_sorted { |
|
20 |
return [ sort { $a->id <=> $b->id } @{ shift()->bins || [] } ]; |
|
21 |
} |
|
22 |
|
|
26 | 23 |
sub first_bin { |
27 |
return shift()->bins->[0]; |
|
24 |
return shift()->bins_sorted->[0];
|
|
28 | 25 |
} |
29 | 26 |
|
30 | 27 |
1; |
Auch abrufbar als: Unified diff
Manager für Warehouse- und Currency-Models