[Dbix-class] Problem using DBIx::Class::ResultClass::HashRefInflator

Bogdan Lucaciu bogdan at sinapticode.ro
Mon Jan 12 12:37:22 GMT 2009


On Monday 12 January 2009 13:27:42 Jochen Luig wrote:
> sub dbic_HashRefInflator {
>     my $resultset = $schema->resultset('MyAppDB::Request');
>
> $resultset->result_class('DBIx::Class::ResultClass::HashRefInflator');
>     my @req = $resultset->search(
>         {message_id => \"IN (173, 174, 171, 1, 168, 144, 177, 111, 178,
> 172, 95, 196, 179)"},
>         {
>          columns=>[qw/ id message_id created status amount /]
>         },      
>         );
> }

search will create a new ResultSet instance,  as rtfs suggests:

sub search {
  my $self = shift;
  my $rs = $self->search_rs( @_ );
  return (wantarray ? $rs->all : $rs);
}

try this instead:

sub dbic_HashRefInflator {
    my $resultset = $schema->resultset('MyAppDB::Request')->search(;
        {message_id => \"IN (173, 174, 171, 1, 168, 144, 177, 111, 178,
172, 95, 196, 179)"},
        {
         columns=>[qw/ id message_id created status amount /] 
        },      
        );
$resultset->result_class('DBIx::Class::ResultClass::HashRefInflator');
@req = $resultset->all;
}


-- 
Bogdan Lucaciu
Lead Developer, Sinapticode



More information about the DBIx-Class mailing list