deprecated add_row_info and added replacement method build_metadata
[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 () {
8   $self->build_metadata( 
9     modifier => sub () {
10       my $row = shift;
11       my $substr = substr($row->{name}, 0, 3);
12       $row->{substr} = $substr;
13       return $row;
14     }
15   );
16   return $self;
17 }
18
19 method with_substr_old () {
20   foreach my $row ($self->all) {
21     my $substr = substr($row->name, 0, 3);
22     $self->add_row_info(row => $row, info => { substr => $substr });
23   }
24   return $self;
25 }
26
27 1;