failing test for object inflator
[dbsrgits/DBIx-Class-ResultSet-WithMetaData.git] / t / lib / DBICTest / Schema / ResultSet / Artist.pm
1 package DBICTest::Schema::ResultSet::Artist;
2
3 use Moose;
4 use Method::Signatures::Simple;
5 extends 'DBICTest::Schema::ResultSet';
6
7 method with_substr_multi () {
8   $self->_with_meta_hash( 
9     sub {
10       my $row = shift;
11       my $substr = substr($row->{name}, 0, 3);
12       my $substr2 = substr($row->{name}, 0, 4);
13       $row->{substr} = $substr;
14       $row->{substr2} = $substr2;
15       return $row;
16     }
17   );
18   return $self;
19 }
20
21 method with_substr_key () {
22   $self->_with_meta_key( 
23     substr => sub {
24       return substr(shift->{name}, 0, 3);
25     }
26   );
27   return $self;
28 }
29
30 method with_substr_key_obj () {
31   $self->_with_meta_key( 
32     substr => sub {
33       my ($hash, $obj) = @_;
34       return substr($obj->name, 0, 3);
35     }
36   );
37   return $self;
38 }
39
40 method with_substr_old () {
41   foreach my $row ($self->all) {
42     my $substr = substr($row->name, 0, 3);
43     $self->add_row_info(row => $row, info => { substr => $substr });
44   }
45   return $self;
46 }
47
48 1;