frioux / DBIx-Class-Helpers

https://metacpan.org/pod/DBIx::Class::Helpers
20 stars 38 forks source link

DBIx::Class::Helper::Row::OnColumnMissing returns an empty list in list context #63

Closed dnmfarrell closed 8 years ago

dnmfarrell commented 8 years ago

When a DBIx::Class::Result uses this helper it changes the behavior of column accessor methods in newly created objects.

package MyApp::Schema::TestAccessor;
use warnings;
use strict;
use base qw( DBIx::Class::Core );

__PACKAGE__->load_components('Helper::Row::OnColumnMissing');
__PACKAGE__->table('test_accessor');
__PACKAGE__->add_columns(
  id => { },
  title => { },
  user_id => {},
);

sub on_column_missing {'nothing'}

1;
my $obj = $schema->resultset("TestAccessor")->create({id=>2,user_id=>1});
$obj->title; # undef
my @answers = $obj->title; # ()

But:

my $obj = $schema->resultset("TestAccessor")->find(2);
$obj->title; # undef
my @answers = $obj->title; # (undef)
frioux commented 8 years ago

Fixed and released as of 2.032002!