-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::Bin;
use strict;
use SL::DB::MetaSetup::Bin;
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
__PACKAGE__->meta->make_manager_class;
1;
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::Currency;
use strict;
use SL::DB::MetaSetup::Currency;
-
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-__PACKAGE__->meta->make_manager_class;
+use SL::DB::Manager::Currency;
1;
--- /dev/null
+package SL::DB::Manager::Currency;
+
+use strict;
+
+use SL::DB::Helper::Manager;
+use base qw(SL::DB::Helper::Manager);
+
+use SL::DB::Helper::Sorted;
+
+sub object_class { 'SL::DB::Currency' }
+
+__PACKAGE__->make_manager_methods;
+
+sub _sort_spec {
+ return ( default => [ 'id', 1 ],
+ columns => { SIMPLE => 'ALL',
+ map { ( $_ => "lower(currencies.$_)" ) } qw(name)
+ });
+}
+
+1;
--- /dev/null
+package SL::DB::Manager::Warehouse;
+
+use strict;
+
+use SL::DB::Helper::Manager;
+use base qw(SL::DB::Helper::Manager);
+
+use SL::DB::Helper::Sorted;
+
+sub object_class { 'SL::DB::Warehouse' }
+
+__PACKAGE__->make_manager_methods;
+
+sub _sort_spec {
+ return ( default => [ 'sortkey', 1 ],
+ columns => { SIMPLE => 'ALL',
+ map { ( $_ => "lower(warehouse.$_)" ) } qw(description)
+ });
+}
+
+1;
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::Warehouse;
use strict;
use SL::DB::MetaSetup::Warehouse;
+use SL::DB::Manager::Warehouse;
use SL::DB::Helper::ActsAsList;
-__PACKAGE__->meta->make_manager_class;
-
__PACKAGE__->meta->add_relationship(
bins => {
type => 'one to many',
}
);
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-#__PACKAGE__->meta->make_manager_class;
-
__PACKAGE__->meta->initialize;
+sub bins_sorted {
+ return [ sort { $a->id <=> $b->id } @{ shift()->bins || [] } ];
+}
+
sub first_bin {
- return shift()->bins->[0];
+ return shift()->bins_sorted->[0];
}
1;