1 package SL::Controller::Helper::GetModels::Base;
4 use parent 'Rose::Object';
5 use Scalar::Util qw(weaken);
7 use Rose::Object::MakeMethods::Generic (
8 scalar => [ qw(get_models disabled finalized) ],
12 sub read_params { die 'implement me' }
14 sub finalize { die 'implement me' }
17 $_[0]->get_models($_[1]);
23 my ($self, @args) = @_;
26 for my $field (qw(query with_objects)) {
27 $final_args->{$field} = [ map { @{ $_->{$field} || [] } } @args ];
30 for my $field (qw(page per_page sort_by)) {
32 next unless defined $arg->{$field};
33 $final_args->{$field} //= $arg->{$field};
42 return !$self->disabled;
53 SL::Controller::Helper::GetModels::Base - base class for GetModels plugins
57 package SL::Controller::Helper::Getmodels::...;
58 use parent 'SL::Controller::Helper::Getmodels::Base'
60 sub read_params { ... }
66 This is a base class for plugins of the GetModels framework for controllers. It
67 provides some common ground.
75 This will be called when GetModels transitions to C<Init> phase.
76 Make sure that you don't need anything from source after that.
80 This will be called when GetModels transitions to C<finalized> phase. Make sure
81 that no internal state or configuration gets changed after this.
85 Common function to merge the output of various callbacks.
89 =head1 BUGS AND CAVEATS
95 Sven Schöling E<lt>s.schoeling@linet-services.deE<gt>