From: Luke Saunders Date: Mon, 16 Aug 2010 10:28:26 +0000 (+0200) Subject: inflator working transparently X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4cac0ed673bc17698d8e736fa4d4fbb70666c7fe;p=dbsrgits%2FDBIx-Class-ResultSet-WithMetaData.git inflator working transparently --- diff --git a/lib/DBIx/Class/ResultSet/WithMetaData.pm b/lib/DBIx/Class/ResultSet/WithMetaData.pm index d460542..01a9853 100644 --- a/lib/DBIx/Class/ResultSet/WithMetaData.pm +++ b/lib/DBIx/Class/ResultSet/WithMetaData.pm @@ -141,9 +141,11 @@ resulting data merged with them. method display () { my $rs = $self->search({}); - $rs->result_class('DBIx::Class::ResultClass::HashRefInflator'); +# $rs->result_class('DBIx::Class::ResultClass::HashRefInflator'); + $rs->result_class('DBIx::Class::WithMetaData::Inflator'); my @rows; - foreach my $row ($rs->all) { + foreach my $row_rep ($rs->all) { + my ($row, $row_obj) = @{$row_rep}; # THIS BLOCK IS DEPRECATED if (my $info = $self->row_info_for(id => $self->_mk_id(row => $row))) { $row = { %{$row}, %{$info} }; diff --git a/lib/DBIx/Class/WithMetaData/Inflator.pm b/lib/DBIx/Class/WithMetaData/Inflator.pm new file mode 100644 index 0000000..6f42dd0 --- /dev/null +++ b/lib/DBIx/Class/WithMetaData/Inflator.pm @@ -0,0 +1,21 @@ +package DBIx::Class::WithMetaData::Inflator; + +use strict; +use warnings; +use Moose; +extends 'DBIx::Class::ResultClass::HashRefInflator'; + +around inflate_result => sub { + my $orig = shift; + my $self = shift; + + my $hash = $self->$orig(@_); + + my ($source, @rest) = @_; + my $row = $source->result_class->inflate_result(@_); + warn $row; + warn $self; + return [$hash, $row]; +}; + +1;