Move get_distinct_col to App::Netdisco::DB::ResultSet so it can be used in all ResultSet's
This commit is contained in:
@@ -8,4 +8,25 @@ use base 'DBIx::Class::ResultSet';
|
||||
__PACKAGE__->load_components(
|
||||
qw{Helper::ResultSet::SetOperations Helper::ResultSet::Shortcut});
|
||||
|
||||
=head2 get_distinct_col( $column )
|
||||
|
||||
Returns an asciibetical sorted list of the distinct values in the given column
|
||||
of the Device table. This is useful for web forms when you want to provide a
|
||||
drop-down list of possible options.
|
||||
|
||||
=cut
|
||||
|
||||
sub get_distinct_col {
|
||||
my ($rs, $col) = @_;
|
||||
return $rs unless $col;
|
||||
|
||||
return $rs->search({},
|
||||
{
|
||||
columns => [$col],
|
||||
order_by => $col,
|
||||
distinct => 1
|
||||
}
|
||||
)->get_column($col)->all;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -518,27 +518,6 @@ sub get_releases {
|
||||
|
||||
}
|
||||
|
||||
=head2 get_distinct_col( $column )
|
||||
|
||||
Returns an asciibetical sorted list of the distinct values in the given column
|
||||
of the Device table. This is useful for web forms when you want to provide a
|
||||
drop-down list of possible options.
|
||||
|
||||
=cut
|
||||
|
||||
sub get_distinct_col {
|
||||
my ($rs, $col) = @_;
|
||||
return $rs unless $col;
|
||||
|
||||
return $rs->search({},
|
||||
{
|
||||
columns => [$col],
|
||||
order_by => $col,
|
||||
distinct => 1
|
||||
}
|
||||
)->get_column($col)->all;
|
||||
}
|
||||
|
||||
=head2 with_port_count
|
||||
|
||||
This is a modifier for any C<search()> which
|
||||
|
||||
Reference in New Issue
Block a user