Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e6535205

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID e6535205268abb2fe58855f627a41ae389e7c509
  • Vorgänger 3dee3e56
  • Nachfolger 4d9d7d51

ActsAsList-Helfer: get_full_list() liefert alle Items in der selben Liste wie $self

Unterschiede anzeigen:

SL/DB/Helper/ActsAsList.pm
4 4

  
5 5
use parent qw(Exporter);
6 6
our @EXPORT = qw(move_position_up move_position_down add_to_list remove_from_list reorder_list configure_acts_as_list
7
                 get_previous_in_list get_next_in_list);
7
                 get_previous_in_list get_next_in_list get_full_list);
8 8

  
9 9
use Carp;
10 10

  
......
123 123
  return get_previous_or_next($self, 'previous');
124 124
}
125 125

  
126
sub get_full_list {
127
  my ($self) = @_;
128

  
129
  my $group_by = get_spec(ref $self, 'group_by') || [];
130
  $group_by    = [ $group_by ] if $group_by && !ref $group_by;
131
  my @where    = map { ($_ => $self->$_) } @{ $group_by };
132

  
133
  return $self->_get_manager_class->get_all(where => \@where, sort_by => column_name($self) . ' ASC');
134
}
135

  
126 136
sub reorder_list {
127 137
  my ($class_or_self, @ids) = @_;
128 138

  
......
417 427
Fetches the next item in the list. Returns C<undef> if C<$self> is
418 428
already the last one.
419 429

  
430
=item C<get_full_list>
431

  
432
Fetches all items in the same list as C<$self> and returns them as an
433
array reference.
434

  
420 435
=item C<reorder_list @ids>
421 436

  
422 437
Re-orders the objects given in C<@ids> by their position in C<@ids> by

Auch abrufbar als: Unified diff