Skip to content

Commit

Permalink
Merge 9a307e8 into a16f812
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Jul 12, 2016
2 parents a16f812 + 9a307e8 commit 35ec299
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
2 changes: 2 additions & 0 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ SQL::Abstract = 1.81
DateTime::Format::SQLite = 0.11
DBD::SQLite = 1.42

Catalyst::Authentication::Store::DBIx::Class = 0.1506

base = 2.18
parent = 0.232
namespace::autoclean = 0.28
Expand Down
41 changes: 27 additions & 14 deletions lib/RapidApp/DBIC/Component/VirtualColumns.pm
Original file line number Diff line number Diff line change
Expand Up @@ -318,31 +318,44 @@ sub set_column {
return $self->next::method($column, $value);
}

=head2 column_info
=head2 columns_info
Overloaded method. L<DBIx::Class::ResultSource/"column_info">
Overloaded method. L<DBIx::Class::ResultSource/columns_info>
Additionally returns the HASH key 'virtual' which indicates if the requested
column is virtual or not.
=cut

# keep as compat shim for 0.0828xx DBIC
sub column_info {
my ($self, $column) = @_;
$_[0]->columns_info([ $_[1] ])->{$_[1]};
}

# Fetch localized column info
if (defined $self->_virtual_columns
&& exists $self->_virtual_columns->{$column}) {
my $column_info = $self->_virtual_columns->{$column};
$column_info->{virtual} = 1;
return $column_info;
sub columns_info {
my( $self, $colnames ) = @_;

my %virt_cols;

if( my $vi = $self->_virtual_columns ) {
$virt_cols{$_} = {
%{ $vi->{$_} || {} },
virtual => 1,
} for keys %$vi;

# We can not ask DBIC about virtual columns
# New arrayref so we do not destroy the supplied argument
$colnames = [ grep
{ ! $virt_cols{$_} }
@$colnames
] if $colnames;
}

my $column_info = $self->next::method($column);
$column_info->{virtual} = 0;
return $column_info;
}

return {
%{ $self->next::method($colnames||()) },
%virt_cols
};
}

=head2 update
Expand Down

0 comments on commit 35ec299

Please sign in to comment.