X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FInflateColumn%2FFile.pm;h=3a515a8f66c4a08f5979abb6613b360ee78001b4;hb=a2bd379666d729133d65c85dc775627937084b18;hp=aa06dbc8454da49594f2902604f3aad0eb93445b;hpb=8273e845426f0187b4ad6c4a1b42286fa09a648f;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/InflateColumn/File.pm b/lib/DBIx/Class/InflateColumn/File.pm index aa06dbc..3a515a8 100644 --- a/lib/DBIx/Class/InflateColumn/File.pm +++ b/lib/DBIx/Class/InflateColumn/File.pm @@ -43,10 +43,14 @@ sub register_column { sub _file_column_file { my ($self, $column, $filename) = @_; - my $column_info = $self->column_info($column); + my $column_info = $self->result_source->column_info($column); return unless $column_info->{is_file_column}; + # DO NOT CHANGE + # This call to id() is generally incorrect - will not DTRT on + # multicolumn key. However changing this may introduce + # backwards-comp regressions, thus leaving as is my $id = $self->id || $self->throw_exception( 'id required for filename generation' ); @@ -60,8 +64,10 @@ sub _file_column_file { sub delete { my ( $self, @rest ) = @_; - for ( $self->columns ) { - if ( $self->column_info($_)->{is_file_column} ) { + my $colinfos = $self->result_source->columns_info; + + for ( keys %$colinfos ) { + if ( $colinfos->{$_}{is_file_column} ) { rmtree( [$self->_file_column_file($_)->dir], 0, 0 ); last; # if we've deleted one, we've deleted them all } @@ -75,9 +81,11 @@ sub insert { # cache our file columns so we can write them to the fs # -after- we have a PK + my $colinfos = $self->result_source->columns_info; + my %file_column; - for ( $self->columns ) { - if ( $self->column_info($_)->{is_file_column} ) { + for ( keys %$colinfos ) { + if ( $colinfos->{$_}{is_file_column} ) { $file_column{$_} = $self->$_; $self->store_column($_ => $self->$_->{filename}); } @@ -206,14 +214,16 @@ Method made to be overridden for callback purposes. sub _file_column_callback {} -=head1 AUTHOR +=head1 FURTHER QUESTIONS? -Victor Igumnov +Check the list of L. -=head1 LICENSE +=head1 COPYRIGHT AND LICENSE -This library is free software, you can redistribute it and/or modify -it under the same terms as Perl itself. +This module is free software L +by the L. You can +redistribute it and/or modify it under the same terms as the +L. =cut